Module: IronAdmin::ThemeHelper
- Defined in:
- app/helpers/iron_admin/theme_helper.rb
Overview
Helper methods for accessing themed CSS classes.
Provides convenience methods for generating Tailwind class strings based on the current theme configuration.
Instance Method Summary collapse
-
#cp_badge_count ⇒ String
Badge count classes.
-
#cp_body_text ⇒ String
Body text classes.
-
#cp_btn_danger ⇒ String
Danger button classes.
-
#cp_btn_filter_apply ⇒ String
Filter apply button classes.
-
#cp_btn_ghost ⇒ String
Ghost button classes.
-
#cp_btn_primary ⇒ String
Primary button classes.
-
#cp_btn_primary_lg ⇒ String
Large primary button classes.
-
#cp_btn_secondary ⇒ String
Secondary button classes.
-
#cp_card ⇒ String
Card classes.
-
#cp_checkbox_class ⇒ String
Checkbox classes.
-
#cp_file_input_class ⇒ String
File input classes.
-
#cp_filter_input_class ⇒ String
Filter input classes.
-
#cp_focus ⇒ String
Focus ring classes.
-
#cp_heading ⇒ String
Heading classes.
-
#cp_input_class ⇒ String
Text input classes.
-
#cp_label_text ⇒ String
Label text classes.
-
#cp_link ⇒ String
Link classes.
-
#cp_link_muted ⇒ String
Muted link classes.
-
#cp_muted_text ⇒ String
Muted text classes.
-
#cp_navbar_search_class ⇒ String
Navbar search input classes.
-
#cp_scope_active ⇒ String
Active scope tab classes.
-
#cp_scope_inactive ⇒ String
Inactive scope tab classes.
-
#cp_search_class ⇒ String
Search input classes.
-
#cp_select_class ⇒ String
Select input classes.
-
#cp_sidebar_bg ⇒ String
Sidebar background classes.
-
#cp_sidebar_group_label ⇒ String
Sidebar group label classes.
-
#cp_sidebar_link ⇒ String
Sidebar link classes.
-
#cp_sidebar_title ⇒ String
Sidebar title classes.
-
#cp_table_border ⇒ String
Table border classes.
-
#cp_table_header_bg ⇒ String
Table header background classes.
-
#cp_table_row_hover ⇒ String
Table row hover classes.
-
#cp_textarea_class ⇒ String
Textarea classes.
-
#t ⇒ IronAdmin::Configuration::Theme
Returns the current theme configuration.
Instance Method Details
#cp_badge_count ⇒ String
Returns Badge count classes.
123 124 125 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 123 def cp_badge_count "inline-flex items-center justify-center h-5 min-w-5 px-1 rounded-full #{t.badge_count} text-xs font-bold" end |
#cp_body_text ⇒ String
Returns Body text classes.
164 165 166 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 164 def cp_body_text t.body_text end |
#cp_btn_danger ⇒ String
Returns Danger button classes.
34 35 36 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 34 def cp_btn_danger "px-4 py-2 #{t.border_radius} #{t.btn_danger}" end |
#cp_btn_filter_apply ⇒ String
Returns Filter apply button classes.
128 129 130 131 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 128 def cp_btn_filter_apply "inline-flex items-center px-3 #{t.border_radius} #{t.btn_primary} " \ "text-sm font-medium transition duration-150 ease-in-out py-1.5" end |
#cp_btn_ghost ⇒ String
Returns Ghost button classes.
39 40 41 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 39 def cp_btn_ghost "inline-flex items-center gap-2 px-4 py-2 #{t.border_radius} #{t.btn_ghost}" end |
#cp_btn_primary ⇒ String
Returns Primary button classes.
16 17 18 19 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 16 def cp_btn_primary "inline-flex items-center px-4 py-2 #{t.border_radius} #{t.btn_primary} " \ "transition duration-150 ease-in-out" end |
#cp_btn_primary_lg ⇒ String
Returns Large primary button classes.
22 23 24 25 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 22 def cp_btn_primary_lg "inline-flex items-center px-5 text-sm font-medium #{t.border_radius} shadow-sm " \ "#{t.btn_primary} transition duration-150 ease-in-out cursor-pointer py-2.5" end |
#cp_btn_secondary ⇒ String
Returns Secondary button classes.
28 29 30 31 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 28 def cp_btn_secondary "inline-flex items-center px-5 text-sm font-medium #{t.border_radius} shadow-sm " \ "#{t.btn_secondary} transition duration-150 ease-in-out py-2.5" end |
#cp_card ⇒ String
Returns Card classes.
159 160 161 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 159 def cp_card "#{t.card_bg} #{t.border_radius} #{t.card_shadow}" end |
#cp_checkbox_class ⇒ String
Returns Checkbox classes.
83 84 85 86 87 88 89 90 91 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 83 def cp_checkbox_class "h-4.5 w-4.5 appearance-none rounded border #{t.input_border} #{t.card_bg} shadow-sm transition duration-150 " \ "ease-in-out #{t.checkbox_checked} " \ "checked:bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" \ "%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22white%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22" \ "M16.707%205.293a1%201%200%20010%201.414l-8%208a1%201%200%2001-1.414%200l-4-4a1%201%200%20011.414-1.414L8" \ "%2012.586l7.293-7.293a1%201%200%20011.414%200z%22%20clip-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E')] " \ "bg-[length:100%_100%] bg-center bg-no-repeat focus:ring-offset-1 cursor-pointer" end |
#cp_file_input_class ⇒ String
Returns File input classes.
194 195 196 197 198 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 194 def cp_file_input_class "block w-full text-sm #{t.body_text} file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 " \ "file:text-sm file:font-medium file:bg-gray-100 file:text-gray-700 hover:file:bg-gray-200 " \ "file:cursor-pointer cursor-pointer" end |
#cp_filter_input_class ⇒ String
Returns Filter input classes.
94 95 96 97 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 94 def cp_filter_input_class "block w-full appearance-none #{t.border_radius} border #{t.input_border} #{t.card_bg} px-3 py-2 text-sm " \ "#{t.body_text} shadow-sm outline-none transition duration-150 ease-in-out #{t.input_focus}" end |
#cp_focus ⇒ String
Returns Focus ring classes.
54 55 56 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 54 def cp_focus t.input_focus end |
#cp_heading ⇒ String
Returns Heading classes.
154 155 156 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 154 def cp_heading "#{t.heading_weight} #{t.font_family}".strip end |
#cp_input_class ⇒ String
Returns Text input classes.
59 60 61 62 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 59 def cp_input_class "block w-full appearance-none #{t.border_radius} border #{t.input_border} #{t.card_bg} px-3.5 py-2.5 text-sm " \ "#{t.body_text} shadow-sm outline-none placeholder:text-gray-400 transition duration-150 ease-in-out #{t.input_focus}" end |
#cp_label_text ⇒ String
Returns Label text classes.
174 175 176 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 174 def cp_label_text t.label_text end |
#cp_link ⇒ String
Returns Link classes.
44 45 46 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 44 def cp_link t.link end |
#cp_link_muted ⇒ String
Returns Muted link classes.
49 50 51 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 49 def cp_link_muted t.link_muted end |
#cp_muted_text ⇒ String
Returns Muted text classes.
169 170 171 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 169 def cp_muted_text t.muted_text end |
#cp_navbar_search_class ⇒ String
Returns Navbar search input classes.
106 107 108 109 110 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 106 def "block w-full appearance-none #{t.border_radius} border #{t.input_border} #{t.} pl-10 pr-4 py-2 text-sm " \ "#{t.body_text} shadow-sm outline-none transition duration-150 ease-in-out placeholder:text-gray-400 " \ "#{t.input_focus} #{t.}" end |
#cp_scope_active ⇒ String
Returns Active scope tab classes.
113 114 115 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 113 def cp_scope_active t.scope_active end |
#cp_scope_inactive ⇒ String
Returns Inactive scope tab classes.
118 119 120 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 118 def cp_scope_inactive t.scope_inactive end |
#cp_search_class ⇒ String
Returns Search input classes.
100 101 102 103 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 100 def cp_search_class "block w-full appearance-none #{t.border_radius} border #{t.input_border} #{t.card_bg} pl-10 pr-4 py-2 text-sm " \ "#{t.body_text} shadow-sm outline-none placeholder:text-gray-400 transition duration-150 ease-in-out #{t.input_focus}" end |
#cp_select_class ⇒ String
Returns Select input classes.
65 66 67 68 69 70 71 72 73 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 65 def cp_select_class "block w-full appearance-none #{t.border_radius} border #{t.input_border} #{t.card_bg} px-3.5 py-2.5 pr-10 text-sm " \ "#{t.body_text} shadow-sm outline-none transition duration-150 ease-in-out #{t.input_focus} " \ "bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20" \ "viewBox%3D%220%200%2020%2020%22%20fill%3D%22%236b7280%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22" \ "M5.23%207.21a.75.75%200%20011.06.02L10%2011.168l3.71-3.938a.75.75%200%20111.08%201.04l-4.25%204.5a.75.75" \ "%200%2001-1.08%200l-4.25-4.5a.75.75%200%2001.02-1.06z%22%20clip-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E')] " \ "bg-[length:1.25rem_1.25rem] bg-[position:right_0.5rem_center] bg-no-repeat" end |
#cp_sidebar_bg ⇒ String
Returns Sidebar background classes.
134 135 136 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 134 def t. end |
#cp_sidebar_group_label ⇒ String
Returns Sidebar group label classes.
149 150 151 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 149 def t. end |
#cp_sidebar_link ⇒ String
Returns Sidebar link classes.
144 145 146 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 144 def "#{t.} #{t.}" end |
#cp_sidebar_title ⇒ String
Returns Sidebar title classes.
139 140 141 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 139 def t. end |
#cp_table_border ⇒ String
Returns Table border classes.
189 190 191 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 189 def cp_table_border t.table_border end |
#cp_table_header_bg ⇒ String
Returns Table header background classes.
179 180 181 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 179 def cp_table_header_bg t.table_header_bg end |
#cp_table_row_hover ⇒ String
Returns Table row hover classes.
184 185 186 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 184 def cp_table_row_hover t.table_row_hover end |
#cp_textarea_class ⇒ String
Returns Textarea classes.
76 77 78 79 80 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 76 def cp_textarea_class "block w-full appearance-none #{t.border_radius} border #{t.input_border} #{t.card_bg} px-3.5 py-2.5 text-sm " \ "#{t.body_text} shadow-sm outline-none placeholder:text-gray-400 transition duration-150 ease-in-out " \ "#{t.input_focus} resize-y" end |
#t ⇒ IronAdmin::Configuration::Theme
Returns the current theme configuration.
11 12 13 |
# File 'app/helpers/iron_admin/theme_helper.rb', line 11 def t IronAdmin.configuration.theme end |