Module: BootstrapConcerns::ComponentsHelper
- Defined in:
- lib/bootstrap_concerns/components_helper.rb
Instance Method Summary collapse
- #assign_icon ⇒ Object
- #boolean_false_icon ⇒ Object
- #boolean_true_icon ⇒ Object
- #bs_button_to(name = nil, options = nil, html_options = nil) ⇒ Object
- #bs_link_or_button_to(method_name, name, options, html_options) ⇒ Object
- #bs_link_to(name = nil, options = nil, html_options = nil) ⇒ Object
- #copy_icon ⇒ Object
- #delete_icon(text = "Delete") ⇒ Object
- #download_icon ⇒ Object
- #edit_icon ⇒ Object
- #export_icon(label = "Export") ⇒ Object
- #flash_alert_color(key) ⇒ Object
- #icon(name, text) ⇒ Object
- #import_icon ⇒ Object
- #new_icon(label = "New") ⇒ Object
- #rename_icon ⇒ Object
- #search_icon ⇒ Object
Instance Method Details
#assign_icon ⇒ Object
3 4 5 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 3 def assign_icon icon("box-arrow-in-left", "Assign") end |
#boolean_false_icon ⇒ Object
7 8 9 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 7 def boolean_false_icon content_tag(:i, "", class: "bi bi-x-circle-fill") end |
#boolean_true_icon ⇒ Object
11 12 13 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 11 def boolean_true_icon content_tag(:i, "", class: "bi bi-check-circle-fill") end |
#bs_button_to(name = nil, options = nil, html_options = nil) ⇒ Object
15 16 17 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 15 def (name = nil, = nil, = nil, &) (:button_to, name, , , &) end |
#bs_link_or_button_to(method_name, name, options, html_options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 19 def (method_name, name, , , &) = if block_given? ||= {} else ||= {} end .merge!(Option.()) public_send( method_name, name, , , & ) end |
#bs_link_to(name = nil, options = nil, html_options = nil) ⇒ Object
38 39 40 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 38 def bs_link_to(name = nil, = nil, = nil, &) (:link_to, name, , , &) end |
#copy_icon ⇒ Object
42 43 44 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 42 def copy_icon icon("files", "Copy") end |
#delete_icon(text = "Delete") ⇒ Object
46 47 48 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 46 def delete_icon(text = "Delete") icon("trash", text) end |
#download_icon ⇒ Object
50 51 52 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 50 def download_icon icon("download", "Download") end |
#edit_icon ⇒ Object
54 55 56 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 54 def edit_icon icon("pencil-square", "Edit") end |
#export_icon(label = "Export") ⇒ Object
58 59 60 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 58 def export_icon(label = "Export") icon("filetype-xlsx", label) end |
#flash_alert_color(key) ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 62 def flash_alert_color(key) case key.to_s when "notice" "success" when "alert" "danger" else key end end |
#icon(name, text) ⇒ Object
73 74 75 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 73 def icon(name, text) content_tag("i", "", class: "bi bi-#{name}") + content_tag(:span, text, class: "ms-1 d-none d-sm-inline") end |
#import_icon ⇒ Object
77 78 79 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 77 def import_icon icon("box-arrow-in-down", "Import") end |
#new_icon(label = "New") ⇒ Object
81 82 83 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 81 def new_icon(label = "New") icon("file-earmark-plus", label) end |
#rename_icon ⇒ Object
85 86 87 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 85 def rename_icon icon("input-cursor-text", "Rename") end |
#search_icon ⇒ Object
89 90 91 |
# File 'lib/bootstrap_concerns/components_helper.rb', line 89 def search_icon icon("search", "Search") end |