Skip to content

Instantly share code, notes, and snippets.

@mwhagedorn
Created September 16, 2010 20:55
Show Gist options
  • Save mwhagedorn/583152 to your computer and use it in GitHub Desktop.
Save mwhagedorn/583152 to your computer and use it in GitHub Desktop.
-config = extjs_form_for [@matter, @item],:fileUpload => true,:form_var =>form_id,:config_only=>true do |f|
= f.error_messages
=f.check_box :done, :fieldLabel =>"Completed"
=f.text_field :item, :fieldLabel => "Task"
=f.text_field :asignee_name, :fieldLabel =>"Assigned To"
=f.date_field :delivery_date, :fieldLabel =>"Due", :value =>f.object.delivery_date ? f.object.delivery_date.strftime("%m-%d-%Y"):""
=f.check_box :critical, :fieldLabel =>"Critical"
=f.select :reminder, [["1 Day Before",1],["2 Days Before",2],["3 Days Before",3],["4 Days Before",4],["5 Days Before",5],["1 Week Before",7]],:fieldLabel =>"Reminder"
=f.numeric_field :estimate, :fieldLabel =>"Estimate"
=f.text_area :description
-f.panel :border =>false, :contentEl =>"item-file-field"
=f.text_field :reportage, :fieldLabel => "Status"
= f.submit @item.new_record? ? "Create Task" :"Update Task",
= f.submit "Cancel", :cls => "x-btn-link", :handler => v("function() { Ext.getCmp('action_window').hide();Ext.getCmp('action_window').find('formpanel').destroy; }")
#item-file-field
.x-form-item
-fields_for [@matter,@item] do |f|
=f.label :attachments, "Attachments",:class =>"x-form-item-label", :style =>"width:150px"
- @item.attachments.each do |document|
%p
= link_to h(document.name), download_document_path(document)
- if document.can_be_deleted_by?(@current_user)
= link_to image_tag("/images/icons/delete.png"),document_path(document), :method => "delete",:confirm => "Are you sure you want to delete this document?"
=f.file_field :attachments, :name =>"item[attachments]"
#form-body-items
-config['renderTo']='form-body-items'
-config['frame'] = false
-extjs_onready("Ext.create(#{config.to_json})")
=extjs_render
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment