Flowdock
method

finish_upload_status

Importance_2
v1.0.0 - Show latest stable - 0 notes - Class: ActionController::UploadProgress
  • 1.0.0 (0)
  • 1.1.6
  • 1.2.6
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.8
  • 3.0.0
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.8
  • 3.2.13
  • 4.0.2
  • 4.1.8
  • 4.2.1
  • 4.2.7
  • 4.2.9
  • 5.0.0.1
  • 5.1.7
  • 5.2.3
  • 6.0.0
  • 6.1.3.1
  • 6.1.7.7
  • 7.0.0
  • 7.1.3.2
  • What's this?
finish_upload_status(client_js_argument='') public

Overwrites the body rendered if the upload comes from a form that tracks the progress of the upload. After clearing the body and any redirects, this method then renders the helper finish_upload_status

This method only needs to be called if you wish to pass a javascript parameter to your finish event handler that you optionally define in form_with_upload_progress

Parameter:

client_js_argument:a string containing a Javascript expression that will be evaluated and passed to your finish handler of form_tag_with_upload_progress.

You can pass a String, Number or Boolean.

Strings

Strings contain Javascript code that will be evaluated on the client. If you wish to pass a string to the client finish callback, you will need to include quotes in the client_js_argument you pass to this method.

Example

  finish_upload_status("\"Finished\"")
  finish_upload_status("'Finished #{@document.title}'")
  finish_upload_status("{success: true, message: 'Done!'}")
  finish_upload_status("function() { alert('Uploaded!'); }")

Numbers / Booleans

Numbers and Booleans can either be passed as Number objects or string versions of number objects as they are evaluated by Javascript the same way as in Ruby.

Example

  finish_upload_status(0)
  finish_upload_status(@document.file.size)
  finish_upload_status("10")

Nil

To pass nil to the finish callback, use a string "undefined"

Example

  finish_upload_status(@message || "undefined")

Redirection

If you action performs a redirection then finish_upload_status will recognize the redirection and properly create the Javascript to perform the redirection in the proper location.

It is possible to redirect and pass a parameter to the finish callback.

Example

  redirect_to :action => 'show', :id => @document.id
  finish_upload_status("'Redirecting you to your new file'")
Show source
Register or log in to add new notes.