iron_admin 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +129 -1
- data/README.md +48 -1
- data/UPGRADING.md +495 -8
- data/app/assets/tailwind/iron_admin/engine.css +79 -4
- data/app/components/iron_admin/dashboards/activity_feed_component/item_component.html.haml +6 -9
- data/app/components/iron_admin/dashboards/activity_feed_component.html.haml +6 -5
- data/app/components/iron_admin/dashboards/activity_feed_component.rb +21 -24
- data/app/components/iron_admin/dashboards/chart_component.html.haml +3 -5
- data/app/components/iron_admin/dashboards/chart_component.rb +86 -24
- data/app/components/iron_admin/dashboards/concerns/themed_card.rb +39 -0
- data/app/components/iron_admin/dashboards/metric_card_component.html.haml +8 -7
- data/app/components/iron_admin/dashboards/metric_card_component.rb +2 -0
- data/app/components/iron_admin/dashboards/progress_component.html.haml +11 -7
- data/app/components/iron_admin/dashboards/progress_component.rb +11 -6
- data/app/components/iron_admin/dashboards/quick_links_component/link_component.html.haml +8 -9
- data/app/components/iron_admin/dashboards/quick_links_component.html.haml +6 -5
- data/app/components/iron_admin/dashboards/quick_links_component.rb +4 -12
- data/app/components/iron_admin/dashboards/recent_table_component.html.haml +15 -10
- data/app/components/iron_admin/dashboards/recent_table_component.rb +49 -0
- data/app/components/iron_admin/dashboards/stats_grid_component/stat_component.html.haml +13 -14
- data/app/components/iron_admin/dashboards/stats_grid_component.html.haml +1 -0
- data/app/components/iron_admin/dashboards/stats_grid_component.rb +9 -11
- data/app/components/iron_admin/filters/bar_component.html.haml +8 -6
- data/app/components/iron_admin/filters/bar_component.rb +56 -9
- data/app/components/iron_admin/filters/control_styles.rb +82 -0
- data/app/components/iron_admin/filters/date_range_component.html.haml +9 -4
- data/app/components/iron_admin/filters/date_range_component.rb +10 -6
- data/app/components/iron_admin/filters/search_component.html.haml +4 -4
- data/app/components/iron_admin/filters/search_component.rb +3 -5
- data/app/components/iron_admin/filters/select_filter_component.html.haml +1 -1
- data/app/components/iron_admin/filters/select_filter_component.rb +5 -16
- data/app/components/iron_admin/form/belongs_to_autocomplete_component.html.haml +9 -5
- data/app/components/iron_admin/form/belongs_to_autocomplete_component.rb +10 -8
- data/app/components/iron_admin/form/belongs_to_component.html.haml +2 -2
- data/app/components/iron_admin/form/belongs_to_component.rb +4 -18
- data/app/components/iron_admin/form/checkbox_component.rb +2 -3
- data/app/components/iron_admin/form/concerns/form_input_behavior.rb +1 -1
- data/app/components/iron_admin/form/control_classes.rb +108 -0
- data/app/components/iron_admin/form/date_picker_component.rb +3 -7
- data/app/components/iron_admin/form/field_wrapper_component.html.haml +3 -3
- data/app/components/iron_admin/form/field_wrapper_component.rb +3 -3
- data/app/components/iron_admin/form/nested_form_component.html.haml +4 -5
- data/app/components/iron_admin/form/nested_form_component.rb +12 -2
- data/app/components/iron_admin/form/select_component.html.haml +1 -1
- data/app/components/iron_admin/form/select_component.rb +2 -16
- data/app/components/iron_admin/form/text_input_component.rb +1 -5
- data/app/components/iron_admin/form/textarea_component.rb +1 -5
- data/app/components/iron_admin/layout/flash_component.html.haml +1 -1
- data/app/components/iron_admin/layout/flash_component.rb +4 -3
- data/app/components/iron_admin/layout/navbar_component.html.haml +15 -9
- data/app/components/iron_admin/layout/navbar_component.rb +29 -1
- data/app/components/iron_admin/layout/shell_component.html.haml +4 -4
- data/app/components/iron_admin/layout/shell_component.rb +16 -3
- data/app/components/iron_admin/layout/sidebar_component.html.haml +21 -25
- data/app/components/iron_admin/layout/sidebar_component.rb +76 -1
- data/app/components/iron_admin/layout/theme_switcher_component.html.haml +15 -0
- data/app/components/iron_admin/layout/theme_switcher_component.rb +74 -0
- data/app/components/iron_admin/resources/actions_component.html.haml +15 -8
- data/app/components/iron_admin/resources/actions_component.rb +34 -2
- data/app/components/iron_admin/resources/breadcrumb_component.html.haml +3 -3
- data/app/components/iron_admin/resources/breadcrumb_component.rb +8 -7
- data/app/components/iron_admin/resources/bulk_actions_component.html.haml +9 -8
- data/app/components/iron_admin/resources/bulk_actions_component.rb +47 -4
- data/app/components/iron_admin/resources/data_table_component.html.haml +15 -15
- data/app/components/iron_admin/resources/data_table_component.rb +34 -3
- data/app/components/iron_admin/resources/related_list_component.html.haml +7 -7
- data/app/components/iron_admin/resources/related_list_component.rb +26 -2
- data/app/components/iron_admin/resources/show_field_component.html.haml +3 -3
- data/app/components/iron_admin/resources/show_field_component.rb +10 -4
- data/app/components/iron_admin/resources/styles.rb +136 -0
- data/app/components/iron_admin/ui/alert_component.html.haml +2 -2
- data/app/components/iron_admin/ui/alert_component.rb +27 -31
- data/app/components/iron_admin/ui/badge_component.rb +40 -20
- data/app/components/iron_admin/ui/button_component.rb +37 -11
- data/app/components/iron_admin/ui/card_component.rb +3 -3
- data/app/components/iron_admin/ui/dropdown_component.html.haml +1 -1
- data/app/components/iron_admin/ui/dropdown_component.rb +34 -13
- data/app/components/iron_admin/ui/empty_state_component.html.haml +4 -5
- data/app/components/iron_admin/ui/empty_state_component.rb +2 -2
- data/app/components/iron_admin/ui/modal_component.html.haml +5 -5
- data/app/components/iron_admin/ui/modal_component.rb +6 -4
- data/app/components/iron_admin/ui/pagination_component.html.haml +14 -14
- data/app/components/iron_admin/ui/pagination_component.rb +26 -9
- data/app/components/iron_admin/ui/scopes_component.html.haml +2 -2
- data/app/components/iron_admin/ui/scopes_component.rb +44 -11
- data/app/components/iron_admin/ui/tooltip_component.rb +11 -4
- data/app/controllers/iron_admin/application_controller.rb +58 -4
- data/app/controllers/iron_admin/audit_controller.rb +30 -6
- data/app/controllers/iron_admin/concerns/action_executable.rb +37 -0
- data/app/controllers/iron_admin/concerns/assignable_references.rb +149 -0
- data/app/controllers/iron_admin/concerns/authorizable.rb +11 -0
- data/app/controllers/iron_admin/concerns/blank_password_filterable.rb +21 -0
- data/app/controllers/iron_admin/concerns/event_emittable.rb +47 -7
- data/app/controllers/iron_admin/concerns/filterable.rb +34 -9
- data/app/controllers/iron_admin/concerns/nested_permittable.rb +5 -3
- data/app/controllers/iron_admin/concerns/nested_tenant_check.rb +159 -0
- data/app/controllers/iron_admin/concerns/polymorphic_references.rb +131 -0
- data/app/controllers/iron_admin/concerns/scopeable.rb +54 -7
- data/app/controllers/iron_admin/concerns/searchable.rb +3 -3
- data/app/controllers/iron_admin/concerns/tenant_assignable.rb +118 -0
- data/app/controllers/iron_admin/concerns/tenant_containment.rb +146 -0
- data/app/controllers/iron_admin/exports_controller.rb +2 -2
- data/app/controllers/iron_admin/imports_controller.rb +1 -1
- data/app/controllers/iron_admin/resources_controller.rb +48 -41
- data/app/controllers/iron_admin/search_controller.rb +1 -2
- data/app/controllers/iron_admin/themes_controller.rb +50 -0
- data/app/controllers/iron_admin/tools_controller.rb +58 -5
- data/app/helpers/iron_admin/action_form_helper.rb +19 -0
- data/app/helpers/iron_admin/application_helper.rb +93 -16
- data/app/helpers/iron_admin/assignable_records_helper.rb +32 -0
- data/app/helpers/iron_admin/component_overrides_helper.rb +9 -4
- data/app/helpers/iron_admin/field_display_helper.rb +88 -43
- data/app/helpers/iron_admin/related_records_helper.rb +51 -0
- data/app/helpers/iron_admin/theme_helper.rb +56 -46
- data/app/javascript/iron_admin/controllers/cp_bulk_select_controller.js +12 -0
- data/app/javascript/iron_admin/controllers/cp_chart_controller.js +4 -0
- data/app/javascript/iron_admin/controllers/cp_disclosure_controller.js +19 -0
- data/app/javascript/iron_admin/controllers/cp_search_shortcut_controller.js +39 -0
- data/app/javascript/iron_admin/index.js +4 -0
- data/app/views/iron_admin/audit/index.html.haml +78 -81
- data/app/views/iron_admin/dashboard/index.html.haml +10 -9
- data/app/views/iron_admin/form/_action_field.html.haml +50 -0
- data/app/views/iron_admin/form/_nested_row.html.haml +18 -13
- data/app/views/iron_admin/imports/new.html.haml +14 -13
- data/app/views/iron_admin/imports/preview.html.haml +24 -21
- data/app/views/iron_admin/resources/_form.html.haml +70 -68
- data/app/views/iron_admin/resources/action_form.html.haml +16 -59
- data/app/views/iron_admin/resources/bulk_action_form.html.haml +20 -58
- data/app/views/iron_admin/resources/edit.html.haml +3 -3
- data/app/views/iron_admin/resources/index.html.haml +87 -74
- data/app/views/iron_admin/resources/new.html.haml +2 -2
- data/app/views/iron_admin/resources/show.html.haml +53 -41
- data/app/views/iron_admin/search/index.html.haml +17 -9
- data/app/views/iron_admin/shared/_pagination.html.haml +13 -10
- data/app/views/iron_admin/shared/error.html.haml +16 -12
- data/app/views/iron_admin/tools/action_form.html.haml +9 -55
- data/app/views/iron_admin/tools/show.html.haml +4 -5
- data/app/views/layouts/iron_admin/_document_head.html.haml +24 -0
- data/app/views/layouts/iron_admin/application.html.haml +4 -17
- data/app/views/layouts/iron_admin/minimal.html.haml +7 -0
- data/config/importmap.rb +2 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +1 -0
- data/docs/FAQ.md +87 -37
- data/docs/README.md +8 -2
- data/docs/components/README.md +6 -2
- data/docs/components/dashboard-components.md +24 -35
- data/docs/components/filter-components.md +44 -92
- data/docs/components/form-components.md +16 -32
- data/docs/components/resource-components.md +46 -27
- data/docs/components/ui-components.md +44 -26
- data/docs/getting-started/installation.md +5 -1
- data/docs/getting-started/quick-start.md +36 -23
- data/docs/guides/authentication.md +182 -42
- data/docs/guides/components.md +97 -15
- data/docs/guides/custom-adapters.md +24 -4
- data/docs/guides/dashboard.md +68 -44
- data/docs/guides/export.md +24 -8
- data/docs/guides/extending.md +206 -51
- data/docs/guides/fields.md +229 -70
- data/docs/guides/imports.md +33 -18
- data/docs/guides/resources.md +333 -111
- data/docs/guides/theming.md +930 -58
- data/docs/guides/troubleshooting.md +7 -3
- data/docs/plugin-system-design.md +8 -7
- data/docs/reference/configuration.md +51 -16
- data/docs/reference/routes.md +1 -0
- data/docs/reference/theme-properties.md +101 -38
- data/lib/generators/iron_admin/install/templates/initializer.rb.tt +7 -2
- data/lib/generators/iron_admin/install_audit/templates/create_iron_admin_audit_entries.rb.tt +2 -0
- data/lib/iron_admin/action_field.rb +11 -0
- data/lib/iron_admin/adapters/active_record.rb +95 -0
- data/lib/iron_admin/adapters/base.rb +107 -0
- data/lib/iron_admin/adapters/http/query.rb +21 -0
- data/lib/iron_admin/adapters/http.rb +84 -4
- data/lib/iron_admin/adapters/mongoid.rb +96 -2
- data/lib/iron_admin/audit_log.rb +64 -6
- data/lib/iron_admin/authentication_warning.rb +31 -0
- data/lib/iron_admin/concerns/filter_definable.rb +15 -1
- data/lib/iron_admin/concerns/nestable.rb +25 -0
- data/lib/iron_admin/concerns/scope_countable.rb +56 -0
- data/lib/iron_admin/concerns/soft_deletable.rb +28 -9
- data/lib/iron_admin/configuration/components.rb +14 -3
- data/lib/iron_admin/configuration/theme/neutral_defaults.rb +179 -0
- data/lib/iron_admin/configuration/theme.rb +292 -87
- data/lib/iron_admin/configuration.rb +340 -45
- data/lib/iron_admin/dashboard.rb +22 -38
- data/lib/iron_admin/engine.rb +16 -2
- data/lib/iron_admin/errors.rb +3 -0
- data/lib/iron_admin/field.rb +78 -17
- data/lib/iron_admin/field_inferrer.rb +61 -3
- data/lib/iron_admin/field_override_warning.rb +67 -0
- data/lib/iron_admin/import/import_preview.rb +56 -7
- data/lib/iron_admin/import/importer.rb +91 -14
- data/lib/iron_admin/import/tenant_precheck.rb +67 -0
- data/lib/iron_admin/plugin/registration.rb +64 -0
- data/lib/iron_admin/plugin_registry.rb +3 -2
- data/lib/iron_admin/policy.rb +22 -12
- data/lib/iron_admin/policy_coverage_warning.rb +46 -0
- data/lib/iron_admin/request_context.rb +18 -0
- data/lib/iron_admin/resource.rb +218 -77
- data/lib/iron_admin/resource_registry.rb +86 -13
- data/lib/iron_admin/scope_counts.rb +73 -0
- data/lib/iron_admin/tenant_scope.rb +30 -0
- data/lib/iron_admin/tool.rb +61 -12
- data/lib/iron_admin/tool_context.rb +10 -6
- data/lib/iron_admin/version.rb +1 -1
- data/lib/iron_admin.rb +29 -2
- metadata +37 -7
|
@@ -38,10 +38,9 @@ module IronAdmin
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
# @api private
|
|
41
|
-
# @return [String] CSS classes for checkbox input
|
|
41
|
+
# @return [String] CSS classes for checkbox input, with the engine's check mark
|
|
42
42
|
def checkbox_classes
|
|
43
|
-
|
|
44
|
-
"transition duration-150 ease-in-out"
|
|
43
|
+
ControlClasses.checkbox(theme)
|
|
45
44
|
end
|
|
46
45
|
|
|
47
46
|
# @api private
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module IronAdmin
|
|
4
|
+
module Form
|
|
5
|
+
# Tailwind classes of form controls. Colors, borders, radii and shadows come
|
|
6
|
+
# from the theme; each state swaps classes instead of adding a second class
|
|
7
|
+
# for the same CSS property.
|
|
8
|
+
#
|
|
9
|
+
# @example An input with an error
|
|
10
|
+
# ControlClasses.input(theme, error: true)
|
|
11
|
+
module ControlClasses
|
|
12
|
+
# Horizontal padding of a text input without an icon or a prefix.
|
|
13
|
+
# @return [String]
|
|
14
|
+
INPUT_PADDING = "px-3"
|
|
15
|
+
|
|
16
|
+
# @return [String]
|
|
17
|
+
TRANSITION = "transition duration-150 ease-in-out"
|
|
18
|
+
|
|
19
|
+
module_function
|
|
20
|
+
|
|
21
|
+
# @param theme [IronAdmin::Configuration::Theme]
|
|
22
|
+
# @param error [Boolean] Whether the value failed validation
|
|
23
|
+
# @param muted [Boolean] Readonly or disabled
|
|
24
|
+
# @param padding [String] Horizontal padding, such as "pl-9 pr-3" beside an icon
|
|
25
|
+
# @return [String] Classes of a one-line text input, 36px high
|
|
26
|
+
def input(theme, error: false, muted: false, padding: INPUT_PADDING)
|
|
27
|
+
"block w-full h-9 #{padding} text-sm outline-hidden #{TRANSITION} " \
|
|
28
|
+
"#{field_box(theme, error:, muted:)} #{theme.placeholder_text}".squish
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @param theme [IronAdmin::Configuration::Theme]
|
|
32
|
+
# @param error [Boolean] Whether the value failed validation
|
|
33
|
+
# @param muted [Boolean] Readonly or disabled
|
|
34
|
+
# @return [String] Classes of a textarea, as high as its rows
|
|
35
|
+
def textarea(theme, error: false, muted: false)
|
|
36
|
+
"block w-full px-3 py-2 text-sm resize-y outline-hidden #{TRANSITION} " \
|
|
37
|
+
"#{field_box(theme, error:, muted:)} #{theme.placeholder_text}".squish
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @param theme [IronAdmin::Configuration::Theme]
|
|
41
|
+
# @param error [Boolean] Whether the value failed validation
|
|
42
|
+
# @param muted [Boolean] Disabled
|
|
43
|
+
# @return [String] Classes of a select, 36px high, with the engine's chevron
|
|
44
|
+
def select(theme, error: false, muted: false)
|
|
45
|
+
"block w-full h-9 appearance-none pl-3 pr-9 text-sm outline-hidden cp-select-chevron #{TRANSITION} " \
|
|
46
|
+
"#{field_box(theme, error:, muted:)}".squish
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# @param theme [IronAdmin::Configuration::Theme]
|
|
50
|
+
# @param error [Boolean] Whether the upload failed validation
|
|
51
|
+
# @return [String] Classes of a file input, 36px high; a line in the input's border color sets off its button
|
|
52
|
+
def file_input(theme, error: false)
|
|
53
|
+
"block w-full h-9 pl-1 pr-3 py-1 text-sm cursor-pointer outline-hidden #{TRANSITION} " \
|
|
54
|
+
"file:mr-3 file:h-7 file:px-3 file:border-r file:border-inherit file:text-sm file:font-medium " \
|
|
55
|
+
"file:cursor-pointer #{field_box(theme, error:)}".squish
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# @param theme [IronAdmin::Configuration::Theme]
|
|
59
|
+
# @return [String] Classes of a checkbox with the engine's check mark
|
|
60
|
+
def checkbox(theme)
|
|
61
|
+
"h-4 w-4 shrink-0 appearance-none cursor-pointer cp-checkbox-mark #{TRANSITION} " \
|
|
62
|
+
"disabled:cursor-not-allowed disabled:opacity-50 #{theme.checkbox_radius} #{toggle_box(theme)}".squish
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# @param theme [IronAdmin::Configuration::Theme]
|
|
66
|
+
# @return [String] Classes of a radio button with the engine's dot
|
|
67
|
+
def radio(theme)
|
|
68
|
+
"h-4 w-4 shrink-0 appearance-none rounded-full cursor-pointer cp-radio-mark #{TRANSITION} " \
|
|
69
|
+
"disabled:cursor-not-allowed disabled:opacity-50 #{toggle_box(theme)}".squish
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# @param theme [IronAdmin::Configuration::Theme]
|
|
73
|
+
# @param variant [Symbol] :primary, :secondary, :danger or :ghost
|
|
74
|
+
# @return [String] Classes of a button, or a link styled as one, 36px high
|
|
75
|
+
# @raise [ArgumentError] For an unknown variant
|
|
76
|
+
def button(theme, variant = :primary)
|
|
77
|
+
"inline-flex h-9 shrink-0 items-center justify-center gap-2 px-3.5 text-sm font-medium whitespace-nowrap " \
|
|
78
|
+
"cursor-pointer #{TRANSITION} disabled:pointer-events-none disabled:opacity-50 " \
|
|
79
|
+
"#{theme.control_radius} #{button_colors(theme, variant)}".squish
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# An error swaps the border and focus classes; a muted control swaps the background.
|
|
83
|
+
def field_box(theme, error: false, muted: false)
|
|
84
|
+
state = error ? theme.input_error : "#{theme.input_border} #{theme.input_focus}"
|
|
85
|
+
background = muted ? "#{theme.surface_muted} cursor-not-allowed" : theme.card_bg
|
|
86
|
+
"#{theme.control_radius} #{theme.border_width} #{state} #{background} #{theme.body_text} #{theme.control_shadow}"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# checkbox_border, not input_border: a hover border color would cover the checked one.
|
|
90
|
+
def toggle_box(theme)
|
|
91
|
+
"#{theme.border_width} #{theme.checkbox_border} #{theme.card_bg} #{theme.control_shadow} #{theme.checkbox_checked}"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# btn_primary carries its own focus outline; the other variants take the theme's focus ring.
|
|
95
|
+
def button_colors(theme, variant)
|
|
96
|
+
case variant
|
|
97
|
+
when :primary then "#{theme.btn_primary} #{theme.control_shadow}"
|
|
98
|
+
when :secondary then "#{theme.btn_secondary} #{theme.control_shadow} #{theme.focus_ring}"
|
|
99
|
+
when :danger then "#{theme.btn_danger} #{theme.control_shadow} #{theme.focus_ring}"
|
|
100
|
+
when :ghost then "#{theme.btn_ghost} #{theme.focus_ring}"
|
|
101
|
+
else raise ArgumentError, "Unknown button variant: #{variant.inspect}"
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
private_class_method :field_box, :toggle_box, :button_colors
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -55,9 +55,9 @@ module IronAdmin
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
# @api private
|
|
58
|
-
# @return [IronAdmin::Configuration::Theme] Theme
|
|
58
|
+
# @return [IronAdmin::Configuration::Theme] Theme of the current request
|
|
59
59
|
def theme
|
|
60
|
-
IronAdmin.
|
|
60
|
+
IronAdmin.current_theme
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# @api private
|
|
@@ -73,11 +73,7 @@ module IronAdmin
|
|
|
73
73
|
# @api private
|
|
74
74
|
# @return [String] CSS classes for date input field
|
|
75
75
|
def input_classes
|
|
76
|
-
|
|
77
|
-
"#{theme.border_radius} #{theme.input_border} #{theme.card_bg} #{theme.body_text} #{theme.input_focus}"
|
|
78
|
-
base += " !border-red-400 focus:!border-red-500 focus:!ring-red-500/20" if has_error
|
|
79
|
-
base += " bg-gray-50 cursor-not-allowed" if disabled
|
|
80
|
-
base
|
|
76
|
+
ControlClasses.input(theme, error: has_error, muted: disabled)
|
|
81
77
|
end
|
|
82
78
|
|
|
83
79
|
# @api private
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
%label{ for: name, class: label_classes }
|
|
3
3
|
= label
|
|
4
4
|
- if required
|
|
5
|
-
%span.
|
|
5
|
+
%span{ class: theme.error_text } *
|
|
6
6
|
|
|
7
7
|
= content
|
|
8
8
|
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
- if has_errors?
|
|
14
14
|
%div{ class: error_classes }
|
|
15
|
-
= heroicon "exclamation-circle", variant: :mini, options: { class: "h-4 w-4
|
|
16
|
-
%p.text-sm.
|
|
15
|
+
= heroicon "exclamation-circle", variant: :mini, options: { class: "h-4 w-4 shrink-0 #{theme.error_text}" }
|
|
16
|
+
%p.text-sm{ class: theme.error_text }
|
|
17
17
|
= errors.join(", ")
|
|
@@ -43,9 +43,9 @@ module IronAdmin
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
# @api private
|
|
46
|
-
# @return [IronAdmin::Configuration::Theme] Theme
|
|
46
|
+
# @return [IronAdmin::Configuration::Theme] Theme of the current request
|
|
47
47
|
def theme
|
|
48
|
-
IronAdmin.
|
|
48
|
+
IronAdmin.current_theme
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# @api private
|
|
@@ -63,7 +63,7 @@ module IronAdmin
|
|
|
63
63
|
# @api private
|
|
64
64
|
# @return [String] CSS classes for label element
|
|
65
65
|
def label_classes
|
|
66
|
-
"block text-sm font-medium #{theme.label_text} mb-1.5"
|
|
66
|
+
"block text-sm font-medium #{theme.label_text} #{theme.field_label_transform} mb-1.5"
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# @api private
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
"cp-nested-form-allow-destroy-value": allow_destroy,
|
|
4
4
|
"cp-nested-form-sortable-value": sortable? } }
|
|
5
5
|
|
|
6
|
-
.flex.items-center.justify-between.mb-4
|
|
7
|
-
%
|
|
6
|
+
.flex.items-center.justify-between.gap-3.mb-4
|
|
7
|
+
%h2{ class: title_classes }= title
|
|
8
8
|
- if show_add_button?
|
|
9
|
-
%button
|
|
10
|
-
class: "
|
|
11
|
-
data: { action: "cp-nested-form#addRow" } }
|
|
9
|
+
%button{ type: "button", class: add_button_classes, data: { action: "cp-nested-form#addRow" } }
|
|
10
|
+
= heroicon "plus", variant: :mini, options: { class: "h-4 w-4" }
|
|
12
11
|
= I18n.t("iron_admin.nested_form.add_button", default: "Add row")
|
|
13
12
|
|
|
14
13
|
-# Hidden template for JS cloning of new rows
|
|
@@ -33,9 +33,9 @@ module IronAdmin
|
|
|
33
33
|
@current_user = current_user
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
# @return [IronAdmin::Configuration::Theme] Theme
|
|
36
|
+
# @return [IronAdmin::Configuration::Theme] Theme of the current request
|
|
37
37
|
def theme
|
|
38
|
-
IronAdmin.
|
|
38
|
+
IronAdmin.current_theme
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# @return [String] Human-readable title for the section header
|
|
@@ -43,6 +43,16 @@ module IronAdmin
|
|
|
43
43
|
name.to_s.humanize
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
# @return [String] Classes of the section title (h2)
|
|
47
|
+
def title_classes
|
|
48
|
+
"#{theme.card_title} #{theme.heading_font}".squish
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @return [String] Classes of the "Add row" button
|
|
52
|
+
def add_button_classes
|
|
53
|
+
ControlClasses.button(theme, :secondary)
|
|
54
|
+
end
|
|
55
|
+
|
|
46
56
|
# @return [Boolean] Whether to show the "Add" button (has_many only)
|
|
47
57
|
def show_add_button?
|
|
48
58
|
kind == :has_many
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
%select{ name: name, id: name, class: select_classes, disabled: effectively_disabled
|
|
1
|
+
%select{ name: name, id: name, class: select_classes, disabled: effectively_disabled? }
|
|
2
2
|
- if include_blank
|
|
3
3
|
%option{ value: "" }= include_blank.is_a?(String) ? include_blank : "Select..."
|
|
4
4
|
- options.each do |option|
|
|
@@ -50,23 +50,9 @@ module IronAdmin
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# @api private
|
|
53
|
-
# @return [String] CSS classes for select element
|
|
53
|
+
# @return [String] CSS classes for select element, with the engine's chevron
|
|
54
54
|
def select_classes
|
|
55
|
-
|
|
56
|
-
"transition duration-150 ease-in-out #{theme.border_radius} #{theme.input_border} " \
|
|
57
|
-
"#{theme.card_bg} #{theme.body_text} #{theme.input_focus}"
|
|
58
|
-
base += " !border-red-400 focus:!border-red-500 focus:!ring-red-500/20" if has_error
|
|
59
|
-
base += " bg-gray-50 cursor-not-allowed" if effectively_disabled?
|
|
60
|
-
base
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
# @api private
|
|
64
|
-
# @return [String] Inline CSS style for dropdown chevron
|
|
65
|
-
def chevron_style
|
|
66
|
-
"background-image: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' " \
|
|
67
|
-
"viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' " \
|
|
68
|
-
"stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\"); background-position: right 0.5rem center; " \
|
|
69
|
-
"background-repeat: no-repeat; background-size: 1.5em 1.5em; padding-right: 2.5rem;"
|
|
55
|
+
ControlClasses.select(theme, error: has_error, muted: effectively_disabled?)
|
|
70
56
|
end
|
|
71
57
|
end
|
|
72
58
|
end
|
|
@@ -53,11 +53,7 @@ module IronAdmin
|
|
|
53
53
|
# @api private
|
|
54
54
|
# @return [String] CSS classes for text input field
|
|
55
55
|
def input_classes
|
|
56
|
-
|
|
57
|
-
"#{theme.border_radius} #{theme.input_border} #{theme.card_bg} #{theme.body_text} #{theme.input_focus}"
|
|
58
|
-
base += " !border-red-400 focus:!border-red-500 focus:!ring-red-500/20" if has_error
|
|
59
|
-
base += " bg-gray-50 cursor-not-allowed" if effectively_disabled? || readonly
|
|
60
|
-
base
|
|
56
|
+
ControlClasses.input(theme, error: has_error, muted: effectively_disabled? || readonly)
|
|
61
57
|
end
|
|
62
58
|
|
|
63
59
|
# Renders the text input.
|
|
@@ -57,11 +57,7 @@ module IronAdmin
|
|
|
57
57
|
# @api private
|
|
58
58
|
# @return [String] CSS classes for textarea element
|
|
59
59
|
def textarea_classes
|
|
60
|
-
|
|
61
|
-
"resize-y #{theme.border_radius} #{theme.input_border} #{theme.card_bg} #{theme.body_text} #{theme.input_focus}"
|
|
62
|
-
base += " !border-red-400 focus:!border-red-500 focus:!ring-red-500/20" if has_error
|
|
63
|
-
base += " bg-gray-50 cursor-not-allowed" if effectively_disabled? || readonly
|
|
64
|
-
base
|
|
60
|
+
ControlClasses.textarea(theme, error: has_error, muted: effectively_disabled? || readonly)
|
|
65
61
|
end
|
|
66
62
|
|
|
67
63
|
# Renders the textarea.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
-# data-turbo-temporary keeps the messages out of the snapshot Turbo shows on back navigation.
|
|
2
|
-
.max-w-7xl.mx-auto.px-4.pt-
|
|
2
|
+
.max-w-7xl.mx-auto.px-4.pt-6.space-y-3{ class: "sm:px-6 lg:px-8", data: { turbo_temporary: true } }
|
|
3
3
|
- messages.each do |type, message|
|
|
4
4
|
= render IronAdmin::Ui::AlertComponent.new(message: message, type: type, role: "alert")
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
module IronAdmin
|
|
4
4
|
module Layout
|
|
5
5
|
# Renders the request's flash messages as dismissible {IronAdmin::Ui::AlertComponent}s.
|
|
6
|
-
#
|
|
6
|
+
# It is the built-in component of the +flash+ slot, which {ShellComponent}
|
|
7
|
+
# renders above the page content; a custom shell can render the slot too.
|
|
7
8
|
#
|
|
8
9
|
# Every message uses +role="alert"+: it arrives already written in a new
|
|
9
10
|
# page, and screen readers do not announce an inserted +role="status"+.
|
|
10
11
|
#
|
|
11
|
-
# @example In a custom shell template
|
|
12
|
-
# = render
|
|
12
|
+
# @example In a custom shell template (renders the +flash+ slot's override, if any)
|
|
13
|
+
# = render helpers.iron_admin_component(:flash, flash: helpers.flash, current_user: @current_user)
|
|
13
14
|
# = content
|
|
14
15
|
class FlashComponent < ViewComponent::Base
|
|
15
16
|
# Flash keys that are shown, with the alert type of each. Other keys and
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
%header.
|
|
2
|
-
%button
|
|
3
|
-
= helpers.heroicon "bars-3", variant: :outline, options: { class: "h-
|
|
4
|
-
|
|
1
|
+
%header.flex.h-14.shrink-0.items-center.gap-3.px-4{ class: "sm:px-6 lg:px-8 #{theme.navbar_bg} #{theme.navbar_border_width} #{theme.navbar_border}" }
|
|
2
|
+
%button.-ml-2.inline-flex.h-9.w-9.shrink-0.items-center.justify-center{ type: "button", class: "lg:hidden #{theme.control_radius} #{theme.btn_ghost} #{theme.focus_ring}", "aria-label": "Open menu", "aria-controls": "cp-sidebar-panel", "aria-expanded": "false", data: { action: "cp-sidebar#toggle", cp_sidebar_target: "toggle" } }
|
|
3
|
+
= helpers.heroicon "bars-3", variant: :outline, options: { class: "h-5 w-5" }
|
|
4
|
+
-# cp-search-shortcut focuses the search box on ⌘K / Ctrl+K and shows that shortcut in the hint.
|
|
5
|
+
= form_with url: helpers.iron_admin.search_path, method: :get, class: "flex-1 max-w-md", data: { controller: "cp-search-shortcut", action: "keydown@window->cp-search-shortcut#focus" }, html: { role: "search" } do
|
|
5
6
|
.relative
|
|
6
|
-
.pointer-events-none.absolute.inset-y-0.left-0.flex.items-center
|
|
7
|
-
= helpers.heroicon "magnifying-glass", variant: :mini, options: { class: "h-4 w-4
|
|
8
|
-
%input
|
|
9
|
-
|
|
7
|
+
.pointer-events-none.absolute.inset-y-0.left-0.flex.items-center.pl-3
|
|
8
|
+
= helpers.heroicon "magnifying-glass", variant: :mini, options: { class: "h-4 w-4 #{theme.icon_muted}" }
|
|
9
|
+
%input{ type: "search", name: "q", value: search_query, "aria-label": "Search across all resources", placeholder: "Search…", class: "peer sm:pr-16 #{helpers.cp_navbar_search_class}", data: { cp_search_shortcut_target: "input" } }
|
|
10
|
+
-# Hidden until the controller connects: without it there is no shortcut to show.
|
|
11
|
+
%kbd{ hidden: true, "aria-hidden": "true", class: "pointer-events-none absolute top-1/2 right-2 hidden h-5 -translate-y-1/2 items-center px-1.5 text-[11px] leading-none font-medium [font-family:inherit] transition-opacity duration-150 peer-focus:opacity-0 sm:inline-flex #{theme.border_width} #{theme.control_radius} #{theme.kbd}", data: { cp_search_shortcut_target: "hint" } } ⌘K
|
|
12
|
+
.ml-auto.flex.shrink-0.items-center.gap-3
|
|
13
|
+
- if theme_switcher
|
|
14
|
+
= render theme_switcher
|
|
10
15
|
- if @current_user
|
|
11
|
-
|
|
16
|
+
-# Hidden on phones and truncated from sm: the 56px bar cannot wrap a long name.
|
|
17
|
+
%span.hidden.max-w-64.truncate.text-sm.font-medium{ class: "sm:block #{theme.navbar_text}" }= @current_user.try(:name) || @current_user.try(:email)
|
|
@@ -2,13 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
module IronAdmin
|
|
4
4
|
module Layout
|
|
5
|
-
# Renders the top navigation bar
|
|
5
|
+
# Renders the top navigation bar: the global search box (focused by ⌘K or
|
|
6
|
+
# Ctrl+K through the +cp-search-shortcut+ Stimulus controller, unless the
|
|
7
|
+
# focused field already handled the shortcut, as Trix does), the theme
|
|
8
|
+
# switcher and the current user's name.
|
|
6
9
|
class NavbarComponent < ViewComponent::Base
|
|
7
10
|
# @param current_user [Object, nil] Current user
|
|
8
11
|
def initialize(current_user: nil)
|
|
9
12
|
@current_user = current_user
|
|
10
13
|
end
|
|
11
14
|
|
|
15
|
+
# @api private
|
|
16
|
+
# @return [IronAdmin::Configuration::Theme] Theme of the current request
|
|
17
|
+
def theme
|
|
18
|
+
IronAdmin.current_theme
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# @api private
|
|
22
|
+
# The +theme_switcher+ slot's component, only when two or more themes are registered.
|
|
23
|
+
# @return [ViewComponent::Base, nil]
|
|
24
|
+
def theme_switcher
|
|
25
|
+
return @theme_switcher if defined?(@theme_switcher)
|
|
26
|
+
|
|
27
|
+
@theme_switcher = build_theme_switcher
|
|
28
|
+
end
|
|
29
|
+
|
|
12
30
|
# @api private
|
|
13
31
|
# The query to keep in the search box. Only on the global search results
|
|
14
32
|
# page: elsewhere +q+ belongs to the index page's own search box.
|
|
@@ -17,6 +35,16 @@ module IronAdmin
|
|
|
17
35
|
query = helpers.params[:q]
|
|
18
36
|
query if query.is_a?(String) && helpers.controller.is_a?(IronAdmin::SearchController)
|
|
19
37
|
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def build_theme_switcher
|
|
42
|
+
themes = IronAdmin.configuration.themes.values
|
|
43
|
+
return if themes.size < 2
|
|
44
|
+
|
|
45
|
+
IronAdmin.configuration.components.build(:theme_switcher, themes: themes, current_theme: IronAdmin.current_theme,
|
|
46
|
+
current_user: @current_user)
|
|
47
|
+
end
|
|
20
48
|
end
|
|
21
49
|
end
|
|
22
50
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
.flex.h-screen.overflow-hidden{ data: { controller: "cp-sidebar", action: "keydown@window->cp-sidebar#closeOnEscape" } }
|
|
2
2
|
-# Skip link for keyboard users: hidden until it receives focus.
|
|
3
|
-
%a.sr-only{ href: "#main-content", class: "focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50 focus:px-4 focus:py-2 focus:
|
|
3
|
+
%a.sr-only{ href: "#main-content", class: "focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50 focus:px-4 focus:py-2 focus:text-sm focus:font-medium #{theme.control_radius} #{theme.skip_link}", data: { cp_sidebar_target: "content" } } Skip to content
|
|
4
4
|
= sidebar
|
|
5
5
|
-# Backdrop shown behind the off-canvas sidebar on small screens.
|
|
6
|
-
.fixed.inset-0.z-30.hidden{ class: "
|
|
6
|
+
.fixed.inset-0.z-30.hidden{ class: "lg:hidden #{theme.overlay_bg}", data: { cp_sidebar_target: "backdrop", action: "click->cp-sidebar#close" } }
|
|
7
7
|
-# The cp-sidebar controller makes the "content" targets inert while the drawer is open.
|
|
8
8
|
.flex-1.flex.flex-col.overflow-hidden{ data: { cp_sidebar_target: "content" } }
|
|
9
9
|
= navbar
|
|
10
|
-
%main#main-content.flex-1.overflow-auto{ class:
|
|
11
|
-
= render
|
|
10
|
+
%main#main-content.flex-1.overflow-auto{ class: theme.main_bg }
|
|
11
|
+
= render flash_messages
|
|
12
12
|
= content
|
|
@@ -5,9 +5,10 @@ module IronAdmin
|
|
|
5
5
|
module Layout
|
|
6
6
|
# Renders the main admin panel shell with sidebar and navbar.
|
|
7
7
|
#
|
|
8
|
-
# The sidebar and
|
|
9
|
-
# plugin), falling back to {SidebarComponent}
|
|
10
|
-
#
|
|
8
|
+
# The sidebar, navbar and flash messages are the ones set in
|
|
9
|
+
# +config.components+ (or a plugin), falling back to {SidebarComponent},
|
|
10
|
+
# {NavbarComponent} and {FlashComponent}. Flash messages render above the
|
|
11
|
+
# page content.
|
|
11
12
|
class ShellComponent < ViewComponent::Base
|
|
12
13
|
renders_one :sidebar, ->(**arguments) { IronAdmin.configuration.components.build(:sidebar, **arguments) }
|
|
13
14
|
renders_one :navbar, ->(**arguments) { IronAdmin.configuration.components.build(:navbar, **arguments) }
|
|
@@ -17,6 +18,18 @@ module IronAdmin
|
|
|
17
18
|
@current_user = current_user
|
|
18
19
|
end
|
|
19
20
|
|
|
21
|
+
# @api private
|
|
22
|
+
# @return [IronAdmin::Configuration::Theme] Theme of the current request
|
|
23
|
+
def theme
|
|
24
|
+
IronAdmin.current_theme
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @api private
|
|
28
|
+
# @return [ViewComponent::Base] The +flash+ slot's component, given the request's flash
|
|
29
|
+
def flash_messages
|
|
30
|
+
IronAdmin.configuration.components.build(:flash, flash: helpers.flash, current_user: @current_user)
|
|
31
|
+
end
|
|
32
|
+
|
|
20
33
|
# @api private
|
|
21
34
|
# Sets up default sidebar and navbar if not provided.
|
|
22
35
|
# @return [void]
|
|
@@ -1,48 +1,44 @@
|
|
|
1
|
-
%nav#cp-sidebar-panel.w-64.flex.flex-col.h-full.overflow-y-auto.fixed.inset-y-0.left-0.z-40.transition-transform.duration-200{ class: "-translate-x-full lg:static lg:translate-x-0 lg:z-auto #{
|
|
2
|
-
.
|
|
3
|
-
|
|
4
|
-
= helpers.heroicon "x-mark", variant: :outline, options: { class: "h-6 w-6" }
|
|
5
|
-
.p-6
|
|
1
|
+
%nav#cp-sidebar-panel.w-64.flex.flex-col.h-full.overflow-y-auto.fixed.inset-y-0.left-0.z-40.transition-transform.duration-200{ class: "-translate-x-full lg:static lg:translate-x-0 lg:z-auto #{theme.sidebar_bg} #{theme.sidebar_border} #{theme.sidebar_title}", data: { cp_sidebar_target: "panel" } }
|
|
2
|
+
-# As high as the navbar, so the brand lines up with it.
|
|
3
|
+
.flex.h-14.shrink-0.items-center.justify-between.gap-2.px-5
|
|
6
4
|
- if logo
|
|
7
5
|
= image_tag logo, class: "h-8"
|
|
8
6
|
- else
|
|
9
|
-
.text-
|
|
7
|
+
.truncate.text-base{ class: "#{theme.heading_weight} #{theme.heading_font}" }= title
|
|
8
|
+
%button.-mr-2.inline-flex.h-8.w-8.shrink-0.items-center.justify-center{ type: "button", class: "lg:hidden #{theme.control_radius} #{theme.btn_ghost} #{theme.focus_ring}", "aria-label": "Close menu", data: { action: "cp-sidebar#close", cp_sidebar_target: "closeButton" } }
|
|
9
|
+
= helpers.heroicon "x-mark", variant: :outline, options: { class: "h-5 w-5" }
|
|
10
10
|
|
|
11
|
-
.flex-1.px-
|
|
12
|
-
= link_to helpers.iron_admin.root_path,
|
|
13
|
-
|
|
14
|
-
= helpers.heroicon "home", variant: :outline, options: { class: "h-5 w-5" }
|
|
11
|
+
.flex-1.pb-6{ class: "px-2.5" }
|
|
12
|
+
= link_to helpers.iron_admin.root_path, **link_options(dashboard_active?) do
|
|
13
|
+
= helpers.heroicon "home", variant: :outline, options: { class: ICON_CLASSES, "stroke-width": IronAdmin::ApplicationHelper::SMALL_ICON_STROKE }
|
|
15
14
|
= I18n.t("iron_admin.navigation.dashboard")
|
|
16
15
|
|
|
17
16
|
- grouped_resources.each do |group, resources|
|
|
18
17
|
.mt-6
|
|
19
|
-
%p.
|
|
20
|
-
|
|
18
|
+
%p.mb-1.text-xs.font-medium{ class: "px-2.5 #{group_label_classes}" }= group
|
|
19
|
+
%div{ class: "space-y-0.5" }
|
|
21
20
|
- resources.sort_by { |r| r.menu_options[:priority] || 999 }.each do |resource|
|
|
22
|
-
= link_to helpers.iron_admin.resources_path(resource.resource_name),
|
|
23
|
-
class: "flex items-center gap-3 px-3 py-2 rounded-lg #{cp_sidebar_link}" do
|
|
21
|
+
= link_to helpers.iron_admin.resources_path(resource.resource_name), **link_options(resource_active?(resource)) do
|
|
24
22
|
- if resource.menu_options[:icon]
|
|
25
|
-
= helpers.heroicon resource.menu_options[:icon], variant: :outline, options: { class: "
|
|
23
|
+
= helpers.heroicon resource.menu_options[:icon], variant: :outline, options: { class: ICON_CLASSES, "stroke-width": IronAdmin::ApplicationHelper::SMALL_ICON_STROKE }
|
|
26
24
|
= resource.label
|
|
27
25
|
|
|
28
26
|
- grouped_tools.each do |group, tools_list|
|
|
29
27
|
.mt-6
|
|
30
|
-
%p.
|
|
31
|
-
|
|
28
|
+
%p.mb-1.text-xs.font-medium{ class: "px-2.5 #{group_label_classes}" }= group
|
|
29
|
+
%div{ class: "space-y-0.5" }
|
|
32
30
|
- tools_list.sort_by { |tool| tool.menu_options[:priority] || 999 }.each do |tool|
|
|
33
|
-
= link_to helpers.iron_admin.tool_path(tool.tool_name),
|
|
34
|
-
class: "flex items-center gap-3 px-3 py-2 rounded-lg #{cp_sidebar_link}" do
|
|
31
|
+
= link_to helpers.iron_admin.tool_path(tool.tool_name), **link_options(tool_active?(tool)) do
|
|
35
32
|
- if tool.menu_options[:icon]
|
|
36
|
-
= helpers.heroicon tool.menu_options[:icon], variant: :outline, options: { class: "
|
|
33
|
+
= helpers.heroicon tool.menu_options[:icon], variant: :outline, options: { class: ICON_CLASSES, "stroke-width": IronAdmin::ApplicationHelper::SMALL_ICON_STROKE }
|
|
37
34
|
= tool.label
|
|
38
35
|
|
|
39
36
|
- grouped_menu_items.each do |group, items|
|
|
40
37
|
.mt-6
|
|
41
|
-
%p.
|
|
42
|
-
|
|
38
|
+
%p.mb-1.text-xs.font-medium{ class: "px-2.5 #{group_label_classes}" }= group
|
|
39
|
+
%div{ class: "space-y-0.5" }
|
|
43
40
|
- items.each do |item|
|
|
44
|
-
= link_to item.path,
|
|
45
|
-
class: "flex items-center gap-3 px-3 py-2 rounded-lg #{cp_sidebar_link}" do
|
|
41
|
+
= link_to item.path, **link_options(menu_item_active?(item)) do
|
|
46
42
|
- if item.icon
|
|
47
|
-
= helpers.heroicon item.icon, variant: :outline, options: { class: "
|
|
43
|
+
= helpers.heroicon item.icon, variant: :outline, options: { class: ICON_CLASSES, "stroke-width": IronAdmin::ApplicationHelper::SMALL_ICON_STROKE }
|
|
48
44
|
= item.label
|