Module: RightRails::Helpers::Forms
- Defined in:
- lib/right_rails/helpers/forms.rb
Overview
RightJS specific form features module
Defined Under Namespace
Modules: FormBuilderMethods, InstanceTagMethods, Util
Instance Method Summary collapse
-
#autocomplete_field(object_name, method, options) ⇒ Object
(also: #autocompleter_field)
The form_for level autocomplete-field generator.
-
#autocomplete_field_tag(name, value, options) ⇒ Object
(also: #autocompleter_field_tag)
Autocompletion field tag.
-
#calendar_field(object_name, method, options = {}) ⇒ Object
The form_for level calendar field generator.
-
#calendar_field_tag(name, value = nil, options = {}) ⇒ Object
Generates the calendar field tag.
-
#colorpicker_field(object_name, method, options = {}) ⇒ Object
A colorpicker field for a form.
-
#colorpicker_field_tag(name, value, options = {}) ⇒ Object
a standalone colorpicker field tag.
-
#rater(object_name, method, options = {}) ⇒ Object
The form level rater generator.
-
#rater_display(value, options = {}) ⇒ Object
Builds a dummy rater, just for displaying purposes.
-
#rater_tag(name, value, options = {}) ⇒ Object
The rater widget basic generator.
-
#rte_field(object_name, method, options = {}) ⇒ Object
a rte-field for a form.
-
#rte_field_tag(name, value, options = {}) ⇒ Object
a standalone RTE field tag.
-
#slider(object_name, method, options = {}) ⇒ Object
The form_for level slider widget generator.
-
#slider_tag(name, value, options = {}) ⇒ Object
The slider widget generator.
-
#tags_field(object_name, method, options = {}) ⇒ Object
a tags-field for a form.
-
#tags_field_tag(name, value, options = {}) ⇒ Object
a standalone tags field tag.
Instance Method Details
#autocomplete_field(object_name, method, options) ⇒ Object Also known as: autocompleter_field
The form_for level autocomplete-field generator
38 39 40 41 42 43 44 |
# File 'lib/right_rails/helpers/forms.rb', line 38 def autocomplete_field(object_name, method, ) = Util.(self, ) tag = ActionView::Helpers::InstanceTag.new( object_name, method, self, .delete(:object)) tag.to_autocomplete_field_tag() end |
#autocomplete_field_tag(name, value, options) ⇒ Object Also known as: autocompleter_field_tag
Autocompletion field tag
The options should contain an url or a list of local options
31 32 33 |
# File 'lib/right_rails/helpers/forms.rb', line 31 def autocomplete_field_tag(name, value, ) text_field_tag name, value, Util.(self, ) end |
#calendar_field(object_name, method, options = {}) ⇒ Object
The form_for level calendar field generator
18 19 20 21 22 23 24 |
# File 'lib/right_rails/helpers/forms.rb', line 18 def calendar_field(object_name, method, ={}) = Util.(self, ) tag = ActionView::Helpers::InstanceTag.new( object_name, method, self, .delete(:object)) tag.to_calendar_field_tag() end |
#calendar_field_tag(name, value = nil, options = {}) ⇒ Object
Generates the calendar field tag
The options might contain the usual html options along with the RightJS Calendar options
11 12 13 |
# File 'lib/right_rails/helpers/forms.rb', line 11 def calendar_field_tag(name, value=nil, ={}) text_field_tag name, value, Util.(self, ) end |
#colorpicker_field(object_name, method, options = {}) ⇒ Object
A colorpicker field for a form
107 108 109 110 111 112 113 |
# File 'lib/right_rails/helpers/forms.rb', line 107 def colorpicker_field(object_name, method, ={}) = Util.(self, ) ActionView::Helpers::InstanceTag.new( object_name, method, self, .delete(:object) ).to_colorpicker_field_tag() end |
#colorpicker_field_tag(name, value, options = {}) ⇒ Object
a standalone colorpicker field tag
100 101 102 |
# File 'lib/right_rails/helpers/forms.rb', line 100 def colorpicker_field_tag(name, value, ={}) text_field_tag name, value, Util.(self, ) end |
#rater(object_name, method, options = {}) ⇒ Object
The form level rater generator
78 79 80 81 82 83 |
# File 'lib/right_rails/helpers/forms.rb', line 78 def rater(object_name, method, ={}) object = .delete(:object) ActionView::Helpers::InstanceTag.new(object_name, method, self, object ).to_rater_tag(Util.(self, )) + "\n" + Util.rater_generator(self, object_name, nil, , method) end |
#rater_display(value, options = {}) ⇒ Object
Builds a dummy rater, just for displaying purposes
88 89 90 91 92 93 94 95 |
# File 'lib/right_rails/helpers/forms.rb', line 88 def rater_display(value, ={}) rightjs_require_module 'rater' content_tag :div, RightRails::Helpers.html_safe((0...([:size] || 5)).to_a.collect{ |i| content_tag :div, RightRails::Helpers.html_safe('★'), :class => i < value ? RightRails::Config.rightjs_version < 2 ? "right-rater-glow" : "active" : nil }.join('')), :class => "#{RightRails::Helpers.css_prefix}-rater #{RightRails::Helpers.css_prefix}-rater-disabled" end |
#rater_tag(name, value, options = {}) ⇒ Object
The rater widget basic generator
70 71 72 73 |
# File 'lib/right_rails/helpers/forms.rb', line 70 def rater_tag(name, value, ={}) hidden_field_tag(name, value, Util.(self, )) + "\n" + Util.rater_generator(self, name, value, ) end |
#rte_field(object_name, method, options = {}) ⇒ Object
a rte-field for a form
143 144 145 146 147 148 149 |
# File 'lib/right_rails/helpers/forms.rb', line 143 def rte_field(object_name, method, ={}) = Util.(self, ) ActionView::Helpers::InstanceTag.new( object_name, method, self, .delete(:object) ).to_rte_field_tag() end |
#rte_field_tag(name, value, options = {}) ⇒ Object
a standalone RTE field tag
136 137 138 |
# File 'lib/right_rails/helpers/forms.rb', line 136 def rte_field_tag(name, value, ={}) text_area_tag name, value, Util.(self, ) end |
#slider(object_name, method, options = {}) ⇒ Object
The form_for level slider widget generator
60 61 62 63 64 65 |
# File 'lib/right_rails/helpers/forms.rb', line 60 def (object_name, method, ={}) object = .delete(:object) ActionView::Helpers::InstanceTag.new(object_name, method, self, object ).(Util.(self, )) + "\n" + Util.(self, object_name, nil, , method) end |
#slider_tag(name, value, options = {}) ⇒ Object
The slider widget generator
52 53 54 55 |
# File 'lib/right_rails/helpers/forms.rb', line 52 def (name, value, ={}) hidden_field_tag(name, value, Util.(self, )) + "\n" + Util.(self, name, value, ) end |
#tags_field(object_name, method, options = {}) ⇒ Object
a tags-field for a form
125 126 127 128 129 130 131 |
# File 'lib/right_rails/helpers/forms.rb', line 125 def (object_name, method, ={}) = Util.(self, ) ActionView::Helpers::InstanceTag.new( object_name, method, self, .delete(:object) ).() end |
#tags_field_tag(name, value, options = {}) ⇒ Object
a standalone tags field tag
118 119 120 |
# File 'lib/right_rails/helpers/forms.rb', line 118 def (name, value, ={}) text_field_tag name, value, Util.(self, ) end |