Module: PolarisViewHelpers::Helper
- Defined in:
- lib/polaris_view_helpers/helper.rb
Instance Method Summary collapse
- #polaris_annotated_section(heading: '', description: '', &block) ⇒ Object
- #polaris_annotated_section_input(form, attribute, input, &block) ⇒ Object
- #polaris_annotated_section_select(form, attribute, select_options = [], element_type = :select, &block) ⇒ Object
- #polaris_annotated_section_text_field(form, attribute, element_type = :text_field, &block) ⇒ Object
- #polaris_banner(options, &block) ⇒ Object
- #polaris_banner_actions(&block) ⇒ Object
- #polaris_button_link_to(name = nil, link_destination = nil, button_options = nil, &block) ⇒ Object
- #polaris_button_tag(name, button_options) ⇒ Object
- #polaris_form_layout_item(form, att, text = nil, &block) ⇒ Object
- #polaris_form_layout_item_select(form, att, text = nil, &block) ⇒ Object
- #polaris_model_errors(model) ⇒ Object
- #polaris_page_actions(options) ⇒ Object
Instance Method Details
#polaris_annotated_section(heading: '', description: '', &block) ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/polaris_view_helpers/helper.rb', line 68 def polaris_annotated_section(heading:'', description:'', &block) render( partial: 'polaris/annotated_section', locals: { heading: heading, description: description, block: block } ) end |
#polaris_annotated_section_input(form, attribute, input, &block) ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/polaris_view_helpers/helper.rb', line 136 def polaris_annotated_section_input(form, attribute, input, &block) unless attribute.is_a? Array attribute = [attribute] end render( partial: 'polaris/annotated_section_input', locals: { form: form, attribute: attribute, input: input, block: block } ) end |
#polaris_annotated_section_select(form, attribute, select_options = [], element_type = :select, &block) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/polaris_view_helpers/helper.rb', line 119 def polaris_annotated_section_select(form, attribute, = [], element_type = :select, &block) unless attribute.is_a? Array attribute = [attribute] end render( partial: 'polaris/annotated_section_select', locals: { form: form, attribute: attribute, element_type: element_type, select_options: , block: block } ) end |
#polaris_annotated_section_text_field(form, attribute, element_type = :text_field, &block) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/polaris_view_helpers/helper.rb', line 103 def polaris_annotated_section_text_field(form, attribute, element_type = :text_field, &block) unless attribute.is_a? Array attribute = [attribute] end render( partial: 'polaris/annotated_section_text_field', locals: { form: form, attribute: attribute, element_type: element_type, block: block } ) end |
#polaris_banner(options, &block) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/polaris_view_helpers/helper.rb', line 4 def (, &block) render( partial: 'polaris/banner', locals: { options: , block: block } ) end |
#polaris_banner_actions(&block) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/polaris_view_helpers/helper.rb', line 11 def (&block) render( partial: 'polaris/banner_actions', locals: { block: block } ) end |
#polaris_button_link_to(name = nil, link_destination = nil, button_options = nil, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/polaris_view_helpers/helper.rb', line 18 def (name = nil, link_destination = nil, = nil, &block) if block_given? , link_destination, name = link_destination, name, nil end ||= {} additional_classes = "" ([:modifiers] || []).each do |modifier| additional_classes += "Polaris-Button--#{modifier} " end render( partial: 'polaris/button_link_to', locals: { name: name, block: block, additional_classes: additional_classes, link_destination: link_destination, method: [:method] } ) end |
#polaris_button_tag(name, button_options) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/polaris_view_helpers/helper.rb', line 54 def (name, ) additional_classes = "" ([:modifiers] || []).each do |modifier| additional_classes += "Polaris-Button--#{modifier} " end [:additional_classes] = additional_classes [:name] = name render( partial: 'polaris/button_tag', locals: ) end |
#polaris_form_layout_item(form, att, text = nil, &block) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/polaris_view_helpers/helper.rb', line 79 def polaris_form_layout_item(form, att, text = nil, &block) render( partial: 'polaris/form_layout_item', locals: { form: form, att: att, text: text, block: block } ) end |
#polaris_form_layout_item_select(form, att, text = nil, &block) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/polaris_view_helpers/helper.rb', line 91 def polaris_form_layout_item_select(form, att, text = nil, &block) render( partial: 'polaris/form_layout_item_select', locals: { form: form, att: att, text: text, block: block } ) end |
#polaris_model_errors(model) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/polaris_view_helpers/helper.rb', line 40 def polaris_model_errors model render( partial: 'polaris/model_errors', locals: { model: model } ) end |
#polaris_page_actions(options) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/polaris_view_helpers/helper.rb', line 47 def polaris_page_actions() render( partial: 'polaris/page_actions', locals: ) end |