Class: Katello::KatelloFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- Katello::KatelloFormBuilder
- Defined in:
- app/helpers/katello/katello_form_builder.rb
Instance Method Summary collapse
-
#editable(name, options) ⇒ Object
Support for rendering jquery.jeditable fields.
- #field(name, *args, &block) ⇒ Object
- #submit(*args) ⇒ Object
- #tabindex ⇒ Object
Instance Method Details
#editable(name, options) ⇒ Object
Support for rendering jquery.jeditable fields. Instead of writing complete html code for the field and the label it allows to use ‘editable’ form helper.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/helpers/katello/katello_form_builder.rb', line 42 def editable(name, ) .symbolize_keys! [:editable] = true if [:editable].nil? [:type] ||= "edit_panel_element" = {} [:name] = "%s[%s]" % [@object_name, name.to_s] [:'data-url'] = [:'data-url'] || [:data_url] || [:data_url] .update([:tag]) if .key? :tag css_class = "%s " % [:class].to_s css_class += "editable %s" % [:type].to_s if [:editable] css_class.strip! = {} [:label] = [:label] [:help] = [:help] [:label_help] = [:label_help] [:input_wrapper] = {} [:input_wrapper][:class] = css_class [:input_wrapper][:tag_options] = base(name, ) do if block_given? yield else @object.send(name) end end end |
#field(name, *args, &block) ⇒ Object
11 12 13 |
# File 'app/helpers/katello/katello_form_builder.rb', line 11 def field(name, *args, &block) base(name, *args, &block) end |
#submit(*args) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'app/helpers/katello/katello_form_builder.rb', line 73 def submit(*args) = args. .symbolize_keys! [:tabindex] ||= tabindex args.push content_tag :div, :class => "grid_5 la prefix_2" do super end end |
#tabindex ⇒ Object
83 84 85 86 |
# File 'app/helpers/katello/katello_form_builder.rb', line 83 def tabindex @tabindex ||= [:tabindex] || 0 @tabindex += 1 end |