Class: DeadSimpleCMS::Rails::ActionView::FormBuilders::SimpleForm
- Inherits:
-
SimpleForm::FormBuilder
- Object
- SimpleForm::FormBuilder
- DeadSimpleCMS::Rails::ActionView::FormBuilders::SimpleForm
- Includes:
- Interface
- Defined in:
- lib/dead_simple_cms/rails/action_view/form_builders/simple_form.rb
Overview
Public: SimpleForm builder for use with the Dead Simple CMS The class names embed into this builder are for twitter bootstrap.
Direct Known Subclasses
Constant Summary collapse
- AS_LOOKUP =
Public: Translation of the Attribute::Type::Base#input_type to :as option for SimpleForm.
Hash.new { |h, k| k }.update(:radio => :radio_buttons, :check_box => :boolean)
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Interface
#actions, #fields_for_group, included, #preview, #radio_buttons
Class Method Details
.form_for_method ⇒ Object
16 17 18 |
# File 'lib/dead_simple_cms/rails/action_view/form_builders/simple_form.rb', line 16 def self.form_for_method :simple_form_for end |
Instance Method Details
#attribute(attribute) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dead_simple_cms/rails/action_view/form_builders/simple_form.rb', line 20 def attribute(attribute) as = AS_LOOKUP[attribute.input_type] hint = attribute.hint.to_s.dup hint << %{ <a href="#{attribute.value}" target="_blank">preview</a>} if attribute.is_a?(Attribute::Type::Image) = {:required => attribute.required, :hint => hint, :as => as, :label => attribute.label} if attribute.length [:input_html] = {maxlength: attribute.length} end if attribute.is_a?(Attribute::Type::CollectionSupport) && (collection = attribute.collection) [:collection] = collection [:include_blank] = false if as==:select end input(attribute.identifier, .merge()) end |
#update ⇒ Object
36 37 38 |
# File 'lib/dead_simple_cms/rails/action_view/form_builders/simple_form.rb', line 36 def update (:submit, "Update", ) end |