Module: Zafu::Process::Forms
- Defined in:
- lib/zafu/process/forms.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/zafu/process/forms.rb', line 4 def self.included(base) base. :make_form end |
Instance Method Details
#r_form ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/zafu/process/forms.rb', line 8 def r_form unless @params[:on].nil? || @params[:on].split(',').include?(@context[:ajax_action]) return '' end return parser_error('Cannot render update form in list context.') if node.list_context? = @markup.set_id([:id]) if [:id] @markup.set_param(:style, [:style]) if [:style] if descendant('form_tag') # We have a specific place to insert our form out (:form_options => , :form => self, :form_prefix => dom_name) else r_form_tag() end end |
#r_form_tag(options = context[:form_options]) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/zafu/process/forms.rb', line 28 def r_form_tag( = context[:form_options]) form_tag() do |opts| # Render error messages tag (opts[:form_helper]) # Render form elements out (opts.merge(:form_prefix => dom_name)) # Render hidden fields (these must go after normal elements so that focusFirstElement works) hidden_fields = form_hidden_fields() out "<div class='hidden'>" hidden_fields.each do |k,v| if v.kind_of?(String) v = "'#{v}'" unless v.kind_of?(String) && ['"', "'"].include?(v[0..0]) out "<input type='hidden' name='#{k}' value=#{v}/>" elsif v.kind_of?(Array) # We use ['ffff'] to indicate that the content is already escaped and ready for ERB. out v.first end end out '</div>' end end |