Class: CitizenBudgetModel::CitizenBudgetFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- CitizenBudgetModel::CitizenBudgetFormBuilder
- Defined in:
- app/controllers/citizen_budget_model_controller.rb
Instance Method Summary collapse
- #buttons(options = {}) ⇒ Object
- #check_box(method, options = {}, checked_value = '1', unchecked_value = '0') ⇒ Object
- #email_field(method, options = {}) ⇒ Object
- #errors ⇒ Object
- #number_field(method, options = {}) ⇒ Object
- #password_field(method, options = {}) ⇒ Object
- #select(method, choices = nil, options = {}, html_options = {}) ⇒ Object
- #submit ⇒ Object
- #text_field(method, options = {}) ⇒ Object
- #text_field_without_label ⇒ Object
- #translated_text_area(method, options = {}) ⇒ Object
- #translated_text_field(method, options = {}) ⇒ Object
Instance Method Details
#buttons(options = {}) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 100 def ( = {}) @template.concat(submit) if block_given? yield end if object.persisted? @template.concat(@template.link_to(.fetch(:context, object), class: 'btn btn-danger pull-right', method: :delete, data: {confirm: _('Are you sure?')}) do @template.content_tag(:span, nil, class: 'glyphicon glyphicon-trash') + ' ' + _('Delete') end) end nil end |
#check_box(method, options = {}, checked_value = '1', unchecked_value = '0') ⇒ Object
88 89 90 91 92 93 94 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 88 def check_box(method, = {}, checked_value = '1', unchecked_value = '0') return unless @template.visible?(object, method) content = @template.content_tag(:label, super(method, , checked_value, unchecked_value) + ' ' + object.class.human_attribute_name(method)) @template.content_tag(:div, content, class: 'checkbox') end |
#email_field(method, options = {}) ⇒ Object
72 73 74 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 72 def email_field(method, = {}) wrapper_and_label(method, super(method, ())) end |
#errors ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 45 def errors if object.errors.any? content = ActiveSupport::SafeBuffer.new object.errors..each do || content << @template.content_tag(:li, ) end @template.content_tag(:div, @template.content_tag(:ul, content), class: 'alert alert-danger') end end |
#number_field(method, options = {}) ⇒ Object
76 77 78 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 76 def number_field(method, = {}) wrapper_and_label(method, super(method, ())) end |
#password_field(method, options = {}) ⇒ Object
80 81 82 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 80 def password_field(method, = {}) wrapper_and_label(method, super(method, ())) end |
#select(method, choices = nil, options = {}, html_options = {}) ⇒ Object
84 85 86 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 84 def select(method, choices = nil, = {}, = {}) wrapper_and_label(method, super(method, choices, , ())) end |
#submit ⇒ Object
96 97 98 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 96 def submit (_('Save'), class: 'btn btn-primary') end |
#text_field(method, options = {}) ⇒ Object
68 69 70 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 68 def text_field(method, = {}) wrapper_and_label(method, super(method, ())) end |
#text_field_without_label ⇒ Object
65 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 65 alias_method :text_field_without_label, :text_field |
#translated_text_area(method, options = {}) ⇒ Object
61 62 63 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 61 def translated_text_area(method, = {}) translated(:text_area_without_label, method, ) end |
#translated_text_field(method, options = {}) ⇒ Object
57 58 59 |
# File 'app/controllers/citizen_budget_model_controller.rb', line 57 def translated_text_field(method, = {}) translated(:text_field_without_label, method, ) end |