Module: Tramway::Helpers::ViewsHelper
- Includes:
- ComponentHelper
- Included in:
- ApplicationHelper, BaseComponent
- Defined in:
- lib/tramway/helpers/views_helper.rb
Overview
Provides view-oriented helpers for ActionView
Instance Method Summary collapse
-
#tramway_back_button ⇒ Object
rubocop:enable Metrics/ParameterLists.
- #tramway_badge(text:, type: nil, color: nil) ⇒ Object
-
#tramway_button(path: nil, text: nil, method: :get, link: false, form_options: {}, **options) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- #tramway_cell ⇒ Object
- #tramway_container(id: nil) ⇒ Object
- #tramway_flash(text:, type:, **options) ⇒ Object
- #tramway_form_for(object, size: :middle, **options) ⇒ Object
- #tramway_header(headers: nil, columns: nil) ⇒ Object
- #tramway_row(**options) ⇒ Object
- #tramway_table(**options) ⇒ Object
- #tramway_title(text: nil) ⇒ Object
Methods included from ComponentHelper
Instance Method Details
#tramway_back_button ⇒ Object
rubocop:enable Metrics/ParameterLists
48 49 50 |
# File 'lib/tramway/helpers/views_helper.rb', line 48 def component 'tailwinds/back_button' end |
#tramway_badge(text:, type: nil, color: nil) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/tramway/helpers/views_helper.rb', line 60 def tramway_badge(text:, type: nil, color: nil) component 'tailwinds/badge', text:, type:, color: end |
#tramway_button(path: nil, text: nil, method: :get, link: false, form_options: {}, **options) ⇒ Object
rubocop:disable Metrics/ParameterLists
42 43 44 45 |
# File 'lib/tramway/helpers/views_helper.rb', line 42 def (path: nil, text: nil, method: :get, link: false, form_options: {}, **, &) component 'tailwinds/button', text:, path:, method:, link:, form_options:, color: .delete(:color), type: .delete(:type), size: .delete(:size), options:, & end |
#tramway_cell ⇒ Object
37 38 39 |
# File 'lib/tramway/helpers/views_helper.rb', line 37 def tramway_cell(&) component 'tailwinds/table/cell', & end |
#tramway_container(id: nil) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/tramway/helpers/views_helper.rb', line 52 def tramway_container(id: nil, &) if id.present? component 'tailwinds/containers/narrow', id: id, & else component 'tailwinds/containers/narrow', & end end |
#tramway_flash(text:, type:, **options) ⇒ Object
71 72 73 |
# File 'lib/tramway/helpers/views_helper.rb', line 71 def tramway_flash(text:, type:, **) component 'tailwinds/flash', text:, type:, options: end |
#tramway_form_for(object, size: :middle, **options) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/tramway/helpers/views_helper.rb', line 9 def tramway_form_for(object, *, size: :middle, **, &) form_for( object, *, **.merge(builder: Tailwinds::Form::Builder, size:), & ) end |
#tramway_header(headers: nil, columns: nil) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/tramway/helpers/views_helper.rb', line 22 def tramway_header(headers: nil, columns: nil, &) component 'tailwinds/table/header', headers:, columns:, & end |
#tramway_row(**options) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/tramway/helpers/views_helper.rb', line 29 def tramway_row(**, &) component 'tailwinds/table/row', cells: .delete(:cells), href: .delete(:href), options:, & end |
#tramway_table(**options) ⇒ Object
18 19 20 |
# File 'lib/tramway/helpers/views_helper.rb', line 18 def tramway_table(**, &) component 'tailwinds/table', options:, & end |
#tramway_title(text: nil) ⇒ Object
67 68 69 |
# File 'lib/tramway/helpers/views_helper.rb', line 67 def tramway_title(text: nil, &) component 'tailwinds/title', text:, & end |