active_admin_prism 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34c64b9f9a4624ab0c6b5bcebd46bd4c65b220e86fa6b8095d26ee35acdb4af2
4
- data.tar.gz: 72e3885c4e3f91874b6e6f99b629c3480eb4b1098de4044f12e3c6d50b95bf66
3
+ metadata.gz: 72cc73689e83be856fdc1e2e321df486dc8cb6033bcca1380aae1d7aed8a15b0
4
+ data.tar.gz: 999e31015012d3dcb58de142de2fe050754fba7903612f259f8ab92709388c05
5
5
  SHA512:
6
- metadata.gz: 230e4441cbc71b105e1abe0b0e592fa7451c070ab4be8b2d32c5acdce55f9014b3f6c2918915bff637fe568e4299243dd9362c6a303725d977d3010ddf409e59
7
- data.tar.gz: 052d8bfe74e598622c5922e0e1201ccfcf574d35937c1a6af17b71c9da06c8dbcf8311ab6df7edcd97cab957f0c70a9bf7205fdbfcf61ef63b576b230ab3a16c
6
+ metadata.gz: f94ead774c60a6c285fa59c624c0f472cd7eb31c2a21d970a7609a74bb3f948d86754d32050d416c7fdfc2fb9fdaa915c3071f998a7832dacb02027ecc606052
7
+ data.tar.gz: b71bbf23aceebcf5febdc7690b4b27064d4d1b9dfe050254e931b15060398a35b55ea0a228220386098fd061e57633ab7e1d00ec3bc5af350db520bfdbb2f23f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,92 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.3
4
+
5
+ - A hamburger icon button next to the brand, at the top of the Prism
6
+ sidebar (`config.sidebar_collapsible`, default `true`), collapses it to
7
+ a narrow icon-only rail on desktop, expanding back to full width (with
8
+ labels) on another click — state persists across page loads. Purely a
9
+ desktop feature; the existing off-canvas mobile toggle below 900px is
10
+ unaffected either way. Every nav item keeps a native tooltip (its label,
11
+ on hover) so it stays identifiable while collapsed. Set
12
+ `config.sidebar_collapsible = false` to render no toggle at all — the
13
+ sidebar is always full width, matching this gem's behavior before this
14
+ flag existed.
15
+ - Flash messages now render as floating toast cards (icon + message +
16
+ dismiss button + a countdown progress bar), pinned to the top-right
17
+ corner of the viewport and stacking if more than one is active, instead
18
+ of ActiveAdmin's plain inline banner. A type-colored icon
19
+ (`:check_circle`/`:alert_triangle`/`:alert_circle`/`:info`) is selected
20
+ from the flash's key — `:notice`/`:success`, `:alert`/`:warning`,
21
+ `:error`, and anything else, respectively. While `flash_auto_dismiss`
22
+ is on, a bar along the card's bottom edge visually counts down over
23
+ `flash_auto_dismiss_seconds`; hovering the card pauses both that bar
24
+ and the actual removal timer in lockstep (not just the animation), so a
25
+ flash a visitor is mid-read can't vanish out from under them. This
26
+ applies identically to Devise's sign-in/password/etc pages, which
27
+ needed a small layout override of their own — see
28
+ `app/views/layouts/active_admin_logged_out.html.erb` — since those
29
+ route through a completely separate layout ActiveAdmin itself ships
30
+ rather than through this gem's usual Arbre-based override point.
31
+ - The active filters bar is now itself a shortcut to the Filters form —
32
+ clicking anywhere on it opens the (possibly collapsed) Filters panel and
33
+ scrolls it into view, instead of only the separate funnel icon doing
34
+ that.
35
+ - Fixed: the active filters bar fell 12px short of the table's own right
36
+ edge instead of aligning flush with it — `.table_tools`'s `gap` and the
37
+ bar's `margin-left: auto` (used to push it to the row's far end) are on
38
+ the same axis, and a nonzero column-gap there gets double-counted by
39
+ the auto margin's free-space math, leaving exactly one gap's worth of
40
+ space unclaimed after the last item. Switched to `row-gap` (still
41
+ spaces Batch Actions from the bar vertically if they wrap onto separate
42
+ lines on a narrow viewport, without the bug).
43
+ - Fixed: the rail-collapsed sidebar (`config.sidebar_collapsible`) had two
44
+ space issues — a group left open before collapsing kept rendering its
45
+ full submenu (every child's icon *and* label) spilling out past the
46
+ 76px rail instead of collapsing to just the parent's own icon (a
47
+ `.prism-nav-item.open > .prism-nav-submenu` rule was more specific than
48
+ the one meant to hide it); and any menu item with no `icon:` set (see
49
+ [Sidebar navigation: icons & badges] in INTEGRATION.md) rendered as
50
+ either an empty color-highlighted box (if `.active`) or a totally blank
51
+ row once its label was hidden, reading as broken dead space. Menu items
52
+ without an icon now get a small dot instead, once collapsed.
53
+ - Fixed: the mobile off-canvas sidebar toggle (`.prism-sidebar-mobile-toggle`,
54
+ ≤900px viewports) was rendered completely off-screen and unclickable —
55
+ it's a `position: fixed` descendant of `#header.prism-sidebar`, and that
56
+ element's own `transform: translateX(-100%)` (used to slide the closed
57
+ sidebar off-screen) made it the containing block for that fixed
58
+ descendant too, dragging the toggle button off-screen right along with
59
+ the hidden sidebar. The off-canvas slide now animates `left` instead of
60
+ `transform`, which carries no such side effect.
61
+ - The "current scope + active filters" summary (ActiveAdmin core's own
62
+ "Search status" sidebar section, auto-added to every resource) now
63
+ renders as a highlighted pill bar in the same row as the Batch Actions
64
+ button/scope tabs, instead of inside `#sidebar`
65
+ (`config.active_filters_bar`, default `true`) — tinted with the theme's
66
+ primary color so it reads as a clear, eye-catching signal rather than
67
+ another gray panel. It used to get squeezed down to the same 72px icon
68
+ gutter as the Filters form whenever `collapsible_filters` had it
69
+ collapsed, and its content had nowhere to fit in 72px — it overflowed
70
+ out over the table instead of shrinking cleanly. Set
71
+ `config.active_filters_bar = false` to restore ActiveAdmin's stock
72
+ sidebar-based behavior.
73
+ - Fixed: a Select2-enhanced `<select>` in the main form (`config.select2`,
74
+ or any field opted in individually) rendered full-width on its own line
75
+ below its label instead of beside it, like every other field. The BFC
76
+ sizing trick used to fit it into ActiveAdmin core's floated-label layout
77
+ only works when the element's width is `auto` — but Select2 always sets
78
+ an inline `width: 100%` on `.select2-container` itself (prism.js's
79
+ auto-init passes `{ width: "100%" }`, and a host's own manual
80
+ `.select2()` call hits the same code path at its default width), so that
81
+ trick never actually engaged. Matches ActiveAdmin core's own input width
82
+ instead.
83
+ - Fixed: a field row whose label this theme deliberately doesn't float
84
+ (e.g. a boolean checkbox, or `as: :prism_toggle`) could let the *next*
85
+ row's floated label render up alongside it instead of starting on its
86
+ own line below, since the short row's un-cleared float left no height
87
+ for the next label to clear against. Every field row now clears its own
88
+ floats.
89
+
3
90
  ## 0.1.2
4
91
 
5
92
  - Adds [Select2](https://select2.org) support (`config.select2`, default
data/INTEGRATION.md CHANGED
@@ -116,6 +116,7 @@ ActiveAdminPrism.configure do |config|
116
116
  config.colorize_action_icons = true # default: true
117
117
  config.styled_confirms = true # default: true
118
118
  config.collapsible_filters = true # default: true
119
+ config.active_filters_bar = true # default: true
119
120
  config.sidebar_footer = true # default: true
120
121
  config.flash_dismissible = true # default: true
121
122
  config.flash_auto_dismiss = true # default: true
@@ -133,6 +134,7 @@ ActiveAdminPrism.configure do |config|
133
134
  ]
134
135
  config.menu_search = true # default: true
135
136
  config.select2 = false # default: false (opt-in — see below)
137
+ config.sidebar_collapsible = true # default: true
136
138
  end
137
139
 
138
140
  ActiveAdminPrism.enable!
@@ -144,6 +146,7 @@ ActiveAdminPrism.enable!
144
146
  | `colorize_action_icons` | `true` | Index-table View/Edit/Delete render as ActiveAdmin's plain text links instead of color-coded icon buttons. |
145
147
  | `styled_confirms` | `true` | Row-level `data-confirm` links (View/Edit/Delete, or anything else using Rails UJS's `data-confirm`) fall back to the browser's native `confirm()`. Batch Actions confirms are unaffected either way — they always use ActiveAdmin's own dialog. |
146
148
  | `collapsible_filters` | `true` | The "Filters" sidebar panel always renders fully expanded (ActiveAdmin's own default) instead of collapsing to a single icon button that expands on click. |
149
+ | `active_filters_bar` | `true` | The current scope/active-filters summary renders inside `#sidebar` as its own panel (ActiveAdmin's own default) instead of as a highlighted bar beside Batch Actions — see [Active filters bar](#active-filters-bar). |
147
150
  | `sidebar_footer` | `true` | "Powered by Active Admin" (or your own `config.footer`) stays in ActiveAdmin's original page-level `#footer` instead of moving into the sidebar. |
148
151
  | `flash_dismissible` | `true` | Flash messages render as ActiveAdmin's original plain `<div>` (no dismiss button). |
149
152
  | `flash_auto_dismiss` | `true` | Flash messages stay on screen until the next page load (ActiveAdmin's default) instead of disappearing on their own. |
@@ -157,6 +160,7 @@ ActiveAdminPrism.enable!
157
160
  | `languages` | 3 entries (English/Español/Français) | The list the dropdown renders; an empty array (`[]`) has the same effect as `language_switcher = false`. |
158
161
  | `menu_search` | `true` | No search box renders above the sidebar's "Pages" nav — see [Menu search](#menu-search). |
159
162
  | `select2` | `false` | **Opposite polarity from every other flag above — opt-in, not opt-out.** `false` (the default) leaves every `<select>` exactly as ActiveAdmin renders it. `true` auto-enhances *every* plain `<select>` (filters, form inputs, association pickers — no per-field setup) into a searchable Select2 widget — see [Select2](#select2). |
163
+ | `sidebar_collapsible` | `true` | No hamburger toggle button renders next to the brand — the sidebar is always full width, with no way to collapse it to an icon-only rail. Desktop-only either way; the mobile off-canvas toggle is unaffected — see [Collapsible sidebar rail](#collapsible-sidebar-rail). |
160
164
 
161
165
  **How this crosses the server/client boundary.** `sidebar`,
162
166
  `colorize_action_icons`, and the `login_*` flags are pure server-side
@@ -288,6 +292,23 @@ passes this hash through untouched) accepts: `:dashboard`, `:users`,
288
292
  `:home`, `:list`, `:folder`, `:bell`, `:search`, `:menu`, `:logout`,
289
293
  `:check`, `:x`, `:chevron_down`, `:eye`, `:pencil`, `:trash`, `:filter`.
290
294
 
295
+ ### Collapsible sidebar rail
296
+
297
+ A hamburger icon button next to the brand, at the top of the sidebar,
298
+ collapses it to a narrow icon-only rail — labels, the search box, language
299
+ switcher, and section headings all hide, leaving just the icons (each
300
+ still identifiable via a native tooltip on hover). Clicking again expands
301
+ it back to full width. The choice persists across page loads
302
+ (`localStorage`, like the per-group nav expand/collapse state already
303
+ does). Desktop-only: below the 900px mobile breakpoint the sidebar is
304
+ already off-canvas (a full-width drawer toggled by its own separate
305
+ hamburger button, `.prism-sidebar-mobile-toggle`), and collapsing to a
306
+ rail there wouldn't make sense — this toggle has no effect on that
307
+ behavior either way. Turn it off with
308
+ `config.sidebar_collapsible = false` to remove the toggle entirely (the
309
+ sidebar is then always full width, ActiveAdmin's own implicit default
310
+ before this flag existed).
311
+
291
312
  ### Parent groups & submenus (nested navigation)
292
313
 
293
314
  Nested groups (e.g. an "E-Commerce" group containing "Products" and
@@ -617,12 +638,46 @@ The reflow relies on the CSS `:has()` selector (broadly supported in
617
638
  current browsers); without it, the Filters panel still collapses/expands
618
639
  correctly, it just won't reclaim the extra width.
619
640
 
641
+ ### Active filters bar
642
+
643
+ Once at least one filter or scope is active, a summary ("Scope: All",
644
+ "Bank code contains BCA", etc.) renders as a highlighted pill bar in the
645
+ same row as the Batch Actions button/scope tabs (AA core's own
646
+ `.table_tools`, pushed to the row's far end), instead of inside
647
+ ActiveAdmin's own `#sidebar` as its own panel. Tinted with the theme's
648
+ primary color (a colored left border + tinted background, distinct from
649
+ the plain gray panels elsewhere) so an active filter reads as a clear,
650
+ eye-catching signal rather than blending in as more chrome. It's also
651
+ clickable — clicking anywhere on it opens the Filters panel (expanding it
652
+ if `collapsible_filters` has it collapsed) and scrolls it into view,
653
+ a shortcut to editing the filters currently producing this exact result
654
+ set, rather than only the separate funnel icon doing that. This is also
655
+ the fix for that sidebar summary overflowing out whenever the collapsible
656
+ Filters panel (above) is collapsed to its 72px icon gutter — there's
657
+ nowhere in 72px for a sentence-length filter description to fit. Turn it
658
+ off with `config.active_filters_bar = false` to restore ActiveAdmin's own
659
+ stock sidebar-based rendering (only sensible if `collapsible_filters` is
660
+ also `false`, since otherwise the two flags combined bring the overflow
661
+ back).
662
+
620
663
  ### Flash messages
621
664
 
622
- Flash messages get a dismiss button, auto-hide after a configurable delay,
623
- and fade/slide out with a smooth, configurable transition see
624
- [Configuration reference](#configuration-reference) for
625
- `flash_dismissible`, `flash_auto_dismiss(_seconds)`, and
665
+ Flash messages render as floating toast cards, pinned to the top-right
666
+ corner of the viewport (stacking if more than one is active) instead of
667
+ ActiveAdmin's plain inline banner — a type-colored icon
668
+ (`:check_circle`/`:alert_triangle`/`:alert_circle`/`:info` depending on
669
+ the flash key: `:notice`/`:success`, `:alert`/`:warning`, `:error`, and
670
+ anything else respectively), the message, a dismiss button, and — while
671
+ `flash_auto_dismiss` is on — a countdown bar along the card's bottom edge
672
+ that visually empties out over `flash_auto_dismiss_seconds`, pausing
673
+ (along with the actual auto-dismiss timer, not just its own animation) as
674
+ long as the pointer is over the card, so a flash a visitor is mid-read
675
+ never vanishes out from under them. Fades/slides out with a smooth,
676
+ configurable transition on dismiss (manual or automatic) either way. This
677
+ applies identically on Devise's sign-in/password/etc pages — see
678
+ [Flash messages markup](#flash-messages-markup) for why that needed its
679
+ own layout override. See [Configuration reference](#configuration-reference)
680
+ for `flash_dismissible`, `flash_auto_dismiss(_seconds)`, and
626
681
  `flash_transition_ms`.
627
682
 
628
683
  ### Sidebar footer ("Powered by Active Admin")
@@ -765,6 +820,8 @@ Ruby view files under `lib/active_admin/views/`.
765
820
  span.prism-sidebar-mobile-toggle <- hamburger, ≤900px viewports only
766
821
  div.prism-sidebar-inner
767
822
  div.prism-sidebar-brand
823
+ span.prism-sidebar-collapse-toggle[role=button][data-prism-toggle-sidebar-collapse] <- only if config.sidebar_collapsible
824
+ svg.prism-sidebar-collapse-icon <- the :menu (hamburger) icon
768
825
  #site_title <- AA's own site_title verb, unchanged
769
826
  div.prism-sidebar-lang <- only if config.language_switcher and #languages is non-empty
770
827
  div.prism-sidebar-search <- only if config.menu_search
@@ -812,8 +869,16 @@ Notes:
812
869
  built-in styling of its own beyond what you see in `_sidebar.scss` — it's
813
870
  just an example class name, feel free to use your own.
814
871
  - Body-level state: `body.prism-sidebar-open` (mobile off-canvas open,
815
- toggled by `prism.js`), `body.prism-sidebar-footer-disabled` (set when
816
- `config.sidebar_footer` is `false` — see [Configuration reference](#configuration-reference)).
872
+ toggled by `prism.js`), `body.prism-sidebar-collapsed` (desktop rail
873
+ collapsed, also toggled by `prism.js` and persisted to `localStorage` —
874
+ see [Collapsible sidebar rail](#collapsible-sidebar-rail)),
875
+ `body.prism-sidebar-footer-disabled` (set when `config.sidebar_footer` is
876
+ `false` — see [Configuration reference](#configuration-reference)).
877
+ - Every `a.prism-nav-link` / `span.prism-nav-group-toggle` also carries a
878
+ plain `title="<label>"` attribute (a host's own explicit `:title` via
879
+ `html_options` wins instead) — inert most of the time, but the only way
880
+ left to identify an item by hovering once `.prism-nav-label` itself is
881
+ hidden by the rail-collapsed state above.
817
882
 
818
883
  ### Language switcher markup
819
884
 
@@ -995,21 +1060,70 @@ panel) gets the extra icon/collapse markup — any other sidebar section
995
1060
  `body.prism-filters-collapsible-disabled` is the backstop class that forces
996
1061
  the panel back to always-expanded.
997
1062
 
1063
+ ### Active filters bar (`#prism_active_filters_bar`)
1064
+
1065
+ Only present once at least one filter or scope is active
1066
+ (`config.active_filters_bar`, default `true` — see
1067
+ [Active filters bar](#active-filters-bar)); reuses ActiveAdmin core's own
1068
+ `ActiveAdmin::Views::ActiveFiltersSidebarContent` markup/i18n wholesale, so
1069
+ the `h4`/`b`/`ul`/`li` structure below is AA's, not Prism's own:
1070
+
1071
+ ```
1072
+ #main_content
1073
+ .index_content
1074
+ .table_tools <- AA core's own — Batch Actions/scope tabs row
1075
+ .table_tools_actions <- only if any_table_tools? — wraps the controls AA core itself renders here
1076
+ .dropdown_menu <- Batch Actions button
1077
+ .scopes <- scope tabs, if any are defined
1078
+ #prism_active_filters_bar.prism-active-filters-bar <- only if a scope/filter is active; pushed to the row's far end
1079
+ h4 + b.current_scope_name <- only if a scope is active
1080
+ div
1081
+ h4 <- "Current filters:"
1082
+ ul
1083
+ li[class="current_filter_*"] <- one per active filter/scope value
1084
+ span <- filter label + predicate
1085
+ b <- the filter's value
1086
+ ```
1087
+
998
1088
  ### Flash messages markup
999
1089
 
1090
+ Rendered twice over — once from `lib/active_admin/views/flash_messages.rb`
1091
+ (Arbre, for every logged-in page) and once, identically, from
1092
+ `app/views/layouts/active_admin_logged_out.html.erb` (plain ERB, for
1093
+ Devise's sign-in/password/etc pages, which route through a completely
1094
+ separate layout ActiveAdmin itself ships rather than through
1095
+ `Pages::Base`/Arbre at all — the Ruby-side override alone never reaches
1096
+ them, which is why this gem ships a full layout override just for this).
1097
+ Both share the same icon-selection logic
1098
+ (`ActiveAdminPrism::Icons.flash_icon_name`, in `lib/prism_icons.rb`) and
1099
+ duration math (`ActiveAdminPrism::Configuration#flash_auto_dismiss_ms`)
1100
+ rather than duplicating either:
1101
+
1000
1102
  ```
1001
- .flashes[data-prism-transition-ms][data-prism-auto-dismiss-ms]
1002
- .flash.flash_notice / .flash_error / .flash_alert [.prism-flash-hide]
1103
+ .flashes[data-prism-transition-ms][data-prism-auto-dismiss-ms] <- position: fixed toast stack, top-right
1104
+ .flash.flash_notice / .flash_success / .flash_alert / .flash_warning / .flash_error / .flash_info [.prism-flash-hide]
1105
+ [style="--prism-flash-duration: <ms>"] <- only if config.flash_auto_dismiss
1106
+ svg.prism-flash-icon <- :check_circle / :alert_triangle / :alert_circle / :info, by type
1003
1107
  span.prism-flash-message
1004
- button.prism-flash-dismiss[data-prism-flash-dismiss] <- only if config.flash_dismissible
1108
+ button.prism-flash-dismiss[data-prism-flash-dismiss] <- only if config.flash_dismissible
1005
1109
  svg.prism-flash-dismiss-icon
1110
+ div.prism-flash-progress <- only if config.flash_auto_dismiss — the countdown bar
1006
1111
  ```
1007
1112
 
1008
1113
  `flash_notice`/`flash_error`/`flash_alert` are ActiveAdmin's own type
1009
- classes (from `flash_messages.each { |type, ...| }`); Prism just colors
1010
- each one distinctly. `.prism-flash-hide` is added by `prism.js` right
1011
- before removal (opacity/transform transition), timed against the
1012
- `data-prism-transition-ms` attribute see
1114
+ classes (from `flash_messages.each { |type, ...| }`); `flash_success`/
1115
+ `flash_warning`/`flash_info` are the same convention extended to a host
1116
+ setting those keys directly (`flash[:warning] = "..."`, etc) Prism
1117
+ colors each of the four icon/progress-bar combinations distinctly, all
1118
+ five type classes included. `.prism-flash-hide` is added by `prism.js`
1119
+ right before removal (opacity/transform transition), timed against the
1120
+ `data-prism-transition-ms` attribute. `.prism-flash-progress`'s width
1121
+ animates via CSS (`@keyframes prism-flash-countdown`, `transform: scaleX`)
1122
+ against the same duration `prism.js` uses for the actual removal timer —
1123
+ hovering a card pauses both in lockstep (`animation-play-state` for the
1124
+ bar, a tracked remaining-time restart for the timer itself) rather than
1125
+ just the visual, so a paused bar can't silently disagree with a flash
1126
+ that's still counting down underneath it. See
1013
1127
  [Flash messages](#flash-messages) / [Configuration reference](#configuration-reference).
1014
1128
 
1015
1129
  ### Confirm dialog (jQuery UI)
data/README.md CHANGED
@@ -101,6 +101,7 @@ ActiveAdminPrism.configure do |config|
101
101
  config.colorize_action_icons = true # color-coded View/Edit/Delete icons
102
102
  config.styled_confirms = true # route data-confirm through the styled dialog
103
103
  config.collapsible_filters = true # "Filters" panel collapses to an icon until clicked
104
+ config.active_filters_bar = true # current scope/filters summary renders above the table
104
105
  config.sidebar_footer = true # "Powered by Active Admin" moves into the sidebar
105
106
  config.flash_dismissible = true # dismiss (x) button on flash messages
106
107
  config.flash_auto_dismiss = true # auto-hide flash messages
@@ -118,6 +119,7 @@ ActiveAdminPrism.configure do |config|
118
119
  ]
119
120
  config.menu_search = true # search box that filters the sidebar's Pages nav
120
121
  config.select2 = false # default: false — auto-enhance every <select> into Select2
122
+ config.sidebar_collapsible = true # sidebar collapses to an icon-only rail (desktop only)
121
123
  end
122
124
 
123
125
  ActiveAdminPrism.enable!