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, options = {}, 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
- #polaris_tab(text, link_path, active = nil) ⇒ Object
- #polaris_tabs(&block) ⇒ Object
Instance Method Details
#polaris_annotated_section(heading: '', description: '', &block) ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/polaris_view_helpers/helper.rb', line 89 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
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/polaris_view_helpers/helper.rb', line 158 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
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/polaris_view_helpers/helper.rb', line 141 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, options = {}, element_type = :text_field, &block) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/polaris_view_helpers/helper.rb', line 124 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, options: , block: block } ) end |
#polaris_banner(options, &block) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/polaris_view_helpers/helper.rb', line 25 def (, &block) render( partial: 'polaris/banner', locals: { options: , block: block } ) end |
#polaris_banner_actions(&block) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/polaris_view_helpers/helper.rb', line 32 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
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/polaris_view_helpers/helper.rb', line 39 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
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/polaris_view_helpers/helper.rb', line 75 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
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/polaris_view_helpers/helper.rb', line 100 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
112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/polaris_view_helpers/helper.rb', line 112 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
61 62 63 64 65 66 |
# File 'lib/polaris_view_helpers/helper.rb', line 61 def polaris_model_errors model render( partial: 'polaris/model_errors', locals: { model: model } ) end |
#polaris_page_actions(options) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/polaris_view_helpers/helper.rb', line 68 def polaris_page_actions() render( partial: 'polaris/page_actions', locals: ) end |
#polaris_tab(text, link_path, active = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/polaris_view_helpers/helper.rb', line 11 def polaris_tab(text, link_path, active = nil) unless active.present? active = link_path == request.original_fullpath end render( partial: 'polaris/tab', locals: { text: text, link_path: link_path, active: active } ) end |
#polaris_tabs(&block) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/polaris_view_helpers/helper.rb', line 4 def polaris_tabs(&block) render( partial: 'polaris/tabs', locals: { block: block } ) end |