antony / grails-ajax-uploader

The Grails Ajax-Uploader plugin is a Grails Tag Library which implements Andrew Valum's excellent file uploader. Supporting drag and drop, progress/status updates, multiple file uploads and more for your application. Visit http://www.grails.org/plugin/ajax-uploader for detailed documentation and feature list.
http://www.grails.org/plugin/ajax-uploader
15 stars 15 forks source link

Added the Ability to Change Button Text and to Display a Host Message #12

Closed hart404 closed 12 years ago

hart404 commented 12 years ago

I wanted the ability to change the button text. I added an optional buttonText attribute to the uploader tag and changed the fileuploader.js to support this attribute. For example:

I also modified the fileuploader.js to display a message from the host which is returned with the JSON response:

} catch (FileUploadException e) { log.error("Failed to upload file.", e) return render(text: [success:false, message: e.message] as JSON, contentType:'text/json') }

These changes seem useful. Can you tell me how I would go about getting these changes incorporated in the plugin, please?

Phil H

antony commented 12 years ago

Hi There,

These do sound like a good idea - thanks for your contributions. To incorporate these changes, the steps you would need to take are:

  1. Fork this repo and that of valums file-uploader: https://github.com/valums/file-uploader
  2. Make your changes as necessary - the .js changes need to go into the valums repository as I do not own the fileuploader.js file. Please make sure you include unit tests for your changes :)
  3. Click 'pull request' when you have made your changes - I'll then incorporate the changes into my project and publish a new version of the plugin. Done!

It might be worth noting that your FileUploader message renders back to the browser as a 'text/json' type - unfortunately this doesn't work in IE6, which is why the original plugin renders text/plain instead - sorry about that!