Flowdock
Ruby on Rails latest stable (v6.1.7.7) - 0 notes
  • 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?

Module deprecated or moved

This module is deprecated or moved on the latest stable version. The last existing version (v1.0.0) is shown here.

THIS IS AN EXPERIMENTAL FEATURE

Which means that it doesn’t yet work on all systems. We’re still working on full compatibility. It’s thus not advised to use this unless you’ve verified it to work fully on all the systems that is a part of your environment. Consider this an extended preview.

Provides a set of methods to be used in your views to help with the rendering of Ajax enabled status updating during a multipart upload.

The basic mechanism for upload progress is that the form will post to a hidden <iframe> element, then poll a status action that will replace the contents of a status container. <a href="/rails/Client">Client</a> Javascript hooks are provided for begin and finish of the update.

If you wish to have a DTD that will validate this page, use XHTML Transitional because this DTD supports the <iframe> element.

Typical usage

In your upload view:

  <%= form_tag_with_upload_progress({ :action => 'create' }) %>
    <%= file_field "document", "file" %>
    <%= submit_tag "Upload" %>
    <%= upload_status_tag %>
  <%= end_form_tag %>

In your controller:

  class DocumentController < ApplicationController
    upload_status_for  :create

    def create
      # ... Your document creation action
    end
  end

Javascript callback on begin and finished

In your upload view:

  <%= form_tag_with_upload_progress({ :action => 'create' }, {
      :begin => "alert('upload beginning'),
      :finish => "alert('upload finished')}) %>
    <%= file_field "document", "file" %>
    <%= submit_tag "Upload" %>
    <%= upload_status_tag %>
  <%= end_form_tag %>

CSS Styling of the status text and progress bar

See upload_status_text_tag and upload_status_progress_bar_tag for references of the IDs and CSS classes used.

Default styling is included with the scaffolding CSS.

Constants

FREQUENCY = 2.0

FREQUENCY_DECAY = 1.8

Attributes

Show files where this module is defined (1 file)
Register or log in to add new notes.