Class: DocumentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DocumentsController
- Defined in:
- app/controllers/documents_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
create a document (direct upload).
-
#crop_form ⇒ Object
TODO: test display the image editor.
-
#get_uf ⇒ Object
TODO: test display an upload field.
-
#new ⇒ Object
add a new document to the current node.
-
#show ⇒ Object
show the result of an upload.
-
#upload ⇒ Object
Create a document with upload progression (upload in mongrel).
- #upload_progress ⇒ Object
Methods included from Zena::App
Instance Method Details
#create ⇒ Object
create a document (direct upload). Used when javascript is disabled.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/documents_controller.rb', line 30 def create create_document respond_to do |format| if @node.new_record? @node.skin_id ||= current_site.root_node.skin_id flash.now[:error] = _("Upload failed.") unless @node.respond_to?('target_klass') # Could we find another way to fake the new object as acting like a template ? class << @node def target_klass; nil; end end end format.html { render :action => 'new'} else flash.now[:notice] = _("Upload succeeded.") format.html { redirect_to document_url(@node[:zip]) } end end end |
#crop_form ⇒ Object
TODO: test display the image editor
71 72 73 74 75 |
# File 'app/controllers/documents_controller.rb', line 71 def crop_form respond_to do |format| format.js end end |
#get_uf ⇒ Object
TODO: test display an upload field.
65 66 67 |
# File 'app/controllers/documents_controller.rb', line 65 def get_uf render_get_uf end |
#new ⇒ Object
add a new document to the current node
13 14 15 16 17 18 19 20 |
# File 'app/controllers/documents_controller.rb', line 13 def new # Use the Template class so that we can use the same object in forms which need the Template properties. @node = @parent.new_child(:class => Template) respond_to do |format| format.html end end |
#show ⇒ Object
show the result of an upload
23 24 25 26 27 |
# File 'app/controllers/documents_controller.rb', line 23 def show respond_to do |format| format.html end end |
#upload ⇒ Object
Create a document with upload progression (upload in mongrel)
53 54 55 56 57 |
# File 'app/controllers/documents_controller.rb', line 53 def upload create_document render_upload end |
#upload_progress ⇒ Object
59 60 61 |
# File 'app/controllers/documents_controller.rb', line 59 def upload_progress render_upload_progress end |