Class: Adminpanel::AdminpanelFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- Adminpanel::AdminpanelFormBuilder
show all
- Includes:
- ApplicationHelper
- Defined in:
- app/helpers/adminpanel/adminpanel_form_builder.rb
Instance Method Summary
collapse
-
#body(&block) ⇒ Object
-
#boolean(method, *args) ⇒ Object
-
#collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object
def radio_button_group(name, buttons, options) options.reverse_merge! :label => name options.reverse_merge! :html => {} output = “”.
-
#datepicker(method, *args) ⇒ Object
-
#email_field(method, *args) ⇒ Object
-
#email_field_original ⇒ Object
-
#enum_field(method, *args) ⇒ Object
-
#file_field(method, *args) ⇒ Object
-
#file_field_original ⇒ Object
-
#footer(&block) ⇒ Object
-
#gallery_field(method, *args) ⇒ Object
-
#image_field(method, *args) ⇒ Object
-
#number_field(method, *args) ⇒ Object
-
#number_field_original ⇒ Object
-
#password_field(method, *args) ⇒ Object
-
#password_field_original ⇒ Object
-
#resource_select(method, *args) ⇒ Object
-
#select(method, select_options, *args) ⇒ Object
-
#submit(method, *args) ⇒ Object
-
#text_area(method, *args) ⇒ Object
-
#text_area_original ⇒ Object
-
#text_field(method, *args) ⇒ Object
-
#text_field_original ⇒ Object
-
#wysiwyg_field(method, *args) ⇒ Object
#adminpanel_form_for, #full_title, #is_current_section?, #link_to_add_fields, #main_root_path, #route_symbol, #symbol_class
#active_tab, #belong_to_object_name, #class_name_downcase, #demodulize_class, #field_value, #get_oauth_link, #is_customized_field?, #pluralize_model, #relationship_ids, #table_type
#breadcrumb_add, #render_breadcrumb
#current_user, #current_user=, #sign_in, #sign_out, #signed_in?
Instance Method Details
#body(&block) ⇒ Object
12
13
14
15
16
17
18
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 12
def body(&block)
@template.content_tag :div, class: 'widget-body' do
@template.content_tag :div, class: 'widget-forms clearfix' do
yield
end
end
end
|
#boolean(method, *args) ⇒ Object
90
91
92
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 90
def boolean(method, *args)
base_layout method, *args, 'boolean_base'
end
|
#collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object
def radio_button_group(name, buttons, options) options.reverse_merge! :label => name options.reverse_merge! :html => {} output = “”
buttons.each do |b| output = @template.content_tag(:label, radio_button_original(name, b, options) b.capitalize, :class => “radio”) end
@template.content_tag :div, :class => “control-group” do @template.content_tag(:label, options, :class => “control-label”) + @template.content_tag(:div, output, { :class => “controls”}, false) end end
81
82
83
84
85
86
87
88
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 81
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {})
super method, collection, value_method, text_method, options, html_options do |b|
b.label class: 'checkbox' do
b.check_box +
b.label
end
end
end
|
#datepicker(method, *args) ⇒ Object
145
146
147
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 145
def datepicker(method, *args)
base_layout( method, *args, 'datepickerize_base' )
end
|
#email_field(method, *args) ⇒ Object
129
130
131
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 129
def email_field(method, *args)
base_layout( method, *args, 'email_field_original' )
end
|
#email_field_original ⇒ Object
9
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 9
alias_method :email_field_original, :email_field
|
#enum_field(method, *args) ⇒ Object
94
95
96
97
98
99
100
101
102
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 94
def enum_field(method, *args)
select(
method,
self.object.class.send(method.pluralize).map{|option, value|
[I18n.t("#{self.object.class.name.demodulize.downcase}.#{option}"), option]
},
*args
)
end
|
#file_field(method, *args) ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 40
def file_field(method, *args)
file_input = base_layout(method, *args, 'file_field_original')
if !object.nil? && !object.new_record? "#{title_layout(method)}#{file_input}".html_safe
else
file_input
end
end
|
#file_field_original ⇒ Object
10
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 10
alias_method :file_field_original, :file_field
|
20
21
22
23
24
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 20
def (&block)
@template.content_tag :div, class: 'widget-footer' do
yield
end
end
|
#gallery_field(method, *args) ⇒ Object
50
51
52
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 50
def gallery_field(method, *args)
base_layout method, *args, 'gallery_base'
end
|
#image_field(method, *args) ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 30
def image_field(method, *args)
image_input = base_layout(method, *args, 'file_field_original')
if !object.nil? && !object.new_record? "#{thumbnail_layout(method)}#{image_input}".html_safe
else
image_input
end
end
|
#number_field(method, *args) ⇒ Object
121
122
123
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 121
def number_field(method, *args)
base_layout( method, *args, 'number_field_original' )
end
|
#number_field_original ⇒ Object
8
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 8
alias_method :number_field_original, :number_field
|
#password_field(method, *args) ⇒ Object
125
126
127
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 125
def password_field(method, *args)
base_layout( method, *args, 'password_field_original' )
end
|
#password_field_original ⇒ Object
7
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 7
alias_method :password_field_original, :password_field
|
#resource_select(method, *args) ⇒ Object
104
105
106
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 104
def resource_select(method, *args)
select method, Adminpanel.displayable_resources.map{|resource| [symbol_class(resource).display_name, resource.to_s]}, *args
end
|
#select(method, select_options, *args) ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 108
def select(method, select_options, *args)
options = args.
label = options['label']
options.delete('label')
options.reverse_merge! class: 'span7', include_blank: '(Seleccione por favor)';
@template.content_tag :div, class: "control-group" do
@template.content_tag(:label, label, class: "control-label") +
@template.content_tag(:div, super(method, select_options, options), class: "controls")
end
end
|
#submit(method, *args) ⇒ Object
133
134
135
136
137
138
139
140
141
142
143
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 133
def submit(method, *args)
options = args.
options.reverse_merge!(
class: 'btn btn-primary',
data: {
disable_with: I18n.t('action.submitting')
}
)
super(method, *args << options)
end
|
#text_area(method, *args) ⇒ Object
62
63
64
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 62
def text_area(method, *args)
base_layout method, *args, 'text_area_original'
end
|
#text_area_original ⇒ Object
6
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 6
alias_method :text_area_original, :text_area
|
#text_field(method, *args) ⇒ Object
26
27
28
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 26
def text_field(method, *args)
base_layout method, *args, 'text_field_original'
end
|
#text_field_original ⇒ Object
4
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 4
alias_method :text_field_original, :text_field
|
#wysiwyg_field(method, *args) ⇒ Object
54
55
56
57
58
59
60
|
# File 'app/helpers/adminpanel/adminpanel_form_builder.rb', line 54
def wysiwyg_field(method, *args)
options = args.
options.reverse_merge! class: 'wysihtml5 span7'
base_layout method, options, 'text_area_original'
end
|