active_admin_prism 0.1.2 → 0.1.4

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: 35f7f9fdd5aec6533abb2db1fc8289129bde147d99ae77410af86dae2fc58294
4
+ data.tar.gz: fedf27baf3454219273944d324e2a8fe3ffe4f36b4392415e6cf368517231ac0
5
5
  SHA512:
6
- metadata.gz: 230e4441cbc71b105e1abe0b0e592fa7451c070ab4be8b2d32c5acdce55f9014b3f6c2918915bff637fe568e4299243dd9362c6a303725d977d3010ddf409e59
7
- data.tar.gz: 052d8bfe74e598622c5922e0e1201ccfcf574d35937c1a6af17b71c9da06c8dbcf8311ab6df7edcd97cab957f0c70a9bf7205fdbfcf61ef63b576b230ab3a16c
6
+ metadata.gz: 889376a6a7a2efbd22327d2498f9514b3e2ffbd8fb6aac406d49ca9201e99633490b9c9ec73a4084e25d560d7858ce9d20f2f90ff5e383941efd63f0ed262fb3
7
+ data.tar.gz: 5d6aeef6bd4cc91cba408142d78c9bea49d99b0fe0113fcca8667df419251a4ec5e68237753e6dfe8a1343d95446447dbe9979dc3a14f80a3a2c2bc16da12574
data/CHANGELOG.md CHANGED
@@ -1,5 +1,164 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.4
4
+
5
+ - A Pages nav item registered with no `icon:` now gets one automatically
6
+ (`auto_nav_icons`, on by default) — picked deterministically from a
7
+ generic subset of the built-in icon set based on the item's own label,
8
+ so the same label always gets the same icon rather than shuffling
9
+ between page loads. Mainly matters once the sidebar is collapsed to
10
+ its icon-only rail (`sidebar_collapsible`): an unassigned item used to
11
+ render there as just a bare, indistinguishable dot. `icon:` set
12
+ explicitly always wins; `auto_nav_icons = false` restores the old
13
+ no-icon-at-all behavior.
14
+ - Every non-Filters sidebar section (ActiveAdmin core's own "Search
15
+ status" panel, when `active_filters_bar` is off, or a host's own custom
16
+ `sidebar "Title" do ... end` block) now flattens every link/button
17
+ inside it into a single "Sidebar Actions" Select2 dropdown when
18
+ `collapsible_filters` is on, instead of each rendering its own
19
+ individually collapsed icon button with nowhere near enough room in
20
+ the 72px gutter that assumed just one — wrapping every word onto its
21
+ own line, or spilling out unclipped over the main content, instead of
22
+ collapsing cleanly. This dropdown renders in the title bar, next to
23
+ (and styled identically to) the consolidated "Actions" dropdown below,
24
+ so the two read as one "more stuff lives here" row instead of two
25
+ disconnected mechanisms in different parts of the page. Picking an
26
+ option fires a real click on the underlying (hidden but still
27
+ DOM-attached, so Rails UJS's `data-method`/`data-confirm` keeps
28
+ working) link/button and resets right back to its placeholder — same
29
+ "jump menu" click-and-reset flow as the "Actions" dropdown, rather than
30
+ opening the section's content in a nested panel. The section itself is
31
+ discarded outright either way, never rendered in `#sidebar`. The
32
+ Filters panel itself is untouched by any of this — it always keeps its
33
+ own plain icon button exactly as before, whether or not any other
34
+ sections exist. A page with only Filters (the common case) shows no
35
+ dropdown at all.
36
+ - A title bar with more than `action_items_dropdown_threshold` (default:
37
+ `0`, so this applies from a single extra `action_item` on) `action_item`
38
+ buttons now collapses all of them into a single Select2 "jump menu",
39
+ aligned with the index table's own right edge (not the page's corner,
40
+ which a table's own column-driven width often doesn't reach), instead
41
+ of rendering a multi-row wall of individual buttons — a resource
42
+ registering a dozen+ CSV upload / bulk-action links is a real example
43
+ this was built for. Sits in the same row as the "Sidebar Actions"
44
+ dropdown above when both exist on the same page, with a visible gap
45
+ before the (always excluded, always pinned to the true top-right
46
+ corner) "New Resource" button. Both this and the "Sidebar Actions"
47
+ dropdown above always show Select2's search box, even with just one or
48
+ two options — not gated behind a result-count threshold — so either
49
+ reads unambiguously as Select2 regardless of how many items it
50
+ currently has. Picking an option fires that action immediately (a
51
+ plain link navigates, a `button_to` form submits — whatever it
52
+ actually was, `data-confirm`/`data-method` included) and resets right
53
+ back to its placeholder. Purely client-side: it moves each existing
54
+ action_item element as-is into a hidden holding area and `.click()`s
55
+ the real trigger inside it, so whatever a host's own `action_item`
56
+ block rendered keeps working completely unmodified. Set
57
+ `config.action_items_dropdown = false` to always render every
58
+ action_item inline, matching this gem's behavior before this flag
59
+ existed.
60
+ - The active-filters bar (`config.active_filters_bar`) now toggles the
61
+ Filters panel open/closed on click, same as the funnel icon, instead of
62
+ only ever opening it.
63
+ - Following any Pages nav item — a plain leaf link, or a parent group
64
+ like "School" — while the sidebar is collapsed to its icon-only rail
65
+ (`config.sidebar_collapsible`) now expands it back out first. A
66
+ parent's own submenu is force-hidden by CSS while collapsed regardless
67
+ of its "open" class, so without this, clicking one did nothing visible
68
+ at all.
69
+ - An index table wider than its container (many columns, a narrow
70
+ viewport) now fades in a subtle shadow on whichever edge still has
71
+ more columns to scroll toward, clearing once scrolled all the way to
72
+ that side — a table simply cut off flush at the container's edge
73
+ otherwise gave no indication scrolling was even possible.
74
+
75
+ ## 0.1.3
76
+
77
+ - A hamburger icon button next to the brand, at the top of the Prism
78
+ sidebar (`config.sidebar_collapsible`, default `true`), collapses it to
79
+ a narrow icon-only rail on desktop, expanding back to full width (with
80
+ labels) on another click — state persists across page loads. Purely a
81
+ desktop feature; the existing off-canvas mobile toggle below 900px is
82
+ unaffected either way. Every nav item keeps a native tooltip (its label,
83
+ on hover) so it stays identifiable while collapsed. Set
84
+ `config.sidebar_collapsible = false` to render no toggle at all — the
85
+ sidebar is always full width, matching this gem's behavior before this
86
+ flag existed.
87
+ - Flash messages now render as floating toast cards (icon + message +
88
+ dismiss button + a countdown progress bar), pinned to the top-right
89
+ corner of the viewport and stacking if more than one is active, instead
90
+ of ActiveAdmin's plain inline banner. A type-colored icon
91
+ (`:check_circle`/`:alert_triangle`/`:alert_circle`/`:info`) is selected
92
+ from the flash's key — `:notice`/`:success`, `:alert`/`:warning`,
93
+ `:error`, and anything else, respectively. While `flash_auto_dismiss`
94
+ is on, a bar along the card's bottom edge visually counts down over
95
+ `flash_auto_dismiss_seconds`; hovering the card pauses both that bar
96
+ and the actual removal timer in lockstep (not just the animation), so a
97
+ flash a visitor is mid-read can't vanish out from under them. This
98
+ applies identically to Devise's sign-in/password/etc pages, which
99
+ needed a small layout override of their own — see
100
+ `app/views/layouts/active_admin_logged_out.html.erb` — since those
101
+ route through a completely separate layout ActiveAdmin itself ships
102
+ rather than through this gem's usual Arbre-based override point.
103
+ - The active filters bar is now itself a shortcut to the Filters form —
104
+ clicking anywhere on it opens the (possibly collapsed) Filters panel and
105
+ scrolls it into view, instead of only the separate funnel icon doing
106
+ that.
107
+ - Fixed: the active filters bar fell 12px short of the table's own right
108
+ edge instead of aligning flush with it — `.table_tools`'s `gap` and the
109
+ bar's `margin-left: auto` (used to push it to the row's far end) are on
110
+ the same axis, and a nonzero column-gap there gets double-counted by
111
+ the auto margin's free-space math, leaving exactly one gap's worth of
112
+ space unclaimed after the last item. Switched to `row-gap` (still
113
+ spaces Batch Actions from the bar vertically if they wrap onto separate
114
+ lines on a narrow viewport, without the bug).
115
+ - Fixed: the rail-collapsed sidebar (`config.sidebar_collapsible`) had two
116
+ space issues — a group left open before collapsing kept rendering its
117
+ full submenu (every child's icon *and* label) spilling out past the
118
+ 76px rail instead of collapsing to just the parent's own icon (a
119
+ `.prism-nav-item.open > .prism-nav-submenu` rule was more specific than
120
+ the one meant to hide it); and any menu item with no `icon:` set (see
121
+ [Sidebar navigation: icons & badges] in INTEGRATION.md) rendered as
122
+ either an empty color-highlighted box (if `.active`) or a totally blank
123
+ row once its label was hidden, reading as broken dead space. Menu items
124
+ without an icon now get a small dot instead, once collapsed.
125
+ - Fixed: the mobile off-canvas sidebar toggle (`.prism-sidebar-mobile-toggle`,
126
+ ≤900px viewports) was rendered completely off-screen and unclickable —
127
+ it's a `position: fixed` descendant of `#header.prism-sidebar`, and that
128
+ element's own `transform: translateX(-100%)` (used to slide the closed
129
+ sidebar off-screen) made it the containing block for that fixed
130
+ descendant too, dragging the toggle button off-screen right along with
131
+ the hidden sidebar. The off-canvas slide now animates `left` instead of
132
+ `transform`, which carries no such side effect.
133
+ - The "current scope + active filters" summary (ActiveAdmin core's own
134
+ "Search status" sidebar section, auto-added to every resource) now
135
+ renders as a highlighted pill bar in the same row as the Batch Actions
136
+ button/scope tabs, instead of inside `#sidebar`
137
+ (`config.active_filters_bar`, default `true`) — tinted with the theme's
138
+ primary color so it reads as a clear, eye-catching signal rather than
139
+ another gray panel. It used to get squeezed down to the same 72px icon
140
+ gutter as the Filters form whenever `collapsible_filters` had it
141
+ collapsed, and its content had nowhere to fit in 72px — it overflowed
142
+ out over the table instead of shrinking cleanly. Set
143
+ `config.active_filters_bar = false` to restore ActiveAdmin's stock
144
+ sidebar-based behavior.
145
+ - Fixed: a Select2-enhanced `<select>` in the main form (`config.select2`,
146
+ or any field opted in individually) rendered full-width on its own line
147
+ below its label instead of beside it, like every other field. The BFC
148
+ sizing trick used to fit it into ActiveAdmin core's floated-label layout
149
+ only works when the element's width is `auto` — but Select2 always sets
150
+ an inline `width: 100%` on `.select2-container` itself (prism.js's
151
+ auto-init passes `{ width: "100%" }`, and a host's own manual
152
+ `.select2()` call hits the same code path at its default width), so that
153
+ trick never actually engaged. Matches ActiveAdmin core's own input width
154
+ instead.
155
+ - Fixed: a field row whose label this theme deliberately doesn't float
156
+ (e.g. a boolean checkbox, or `as: :prism_toggle`) could let the *next*
157
+ row's floated label render up alongside it instead of starting on its
158
+ own line below, since the short row's un-cleared float left no height
159
+ for the next label to clear against. Every field row now clears its own
160
+ floats.
161
+
3
162
  ## 0.1.2
4
163
 
5
164
  - 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,10 @@ 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
138
+ config.action_items_dropdown = true # default: true
139
+ config.action_items_dropdown_threshold = 3 # default: 3
140
+ config.auto_nav_icons = true # default: true
136
141
  end
137
142
 
138
143
  ActiveAdminPrism.enable!
@@ -144,6 +149,7 @@ ActiveAdminPrism.enable!
144
149
  | `colorize_action_icons` | `true` | Index-table View/Edit/Delete render as ActiveAdmin's plain text links instead of color-coded icon buttons. |
145
150
  | `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
151
  | `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. |
152
+ | `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
153
  | `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
154
  | `flash_dismissible` | `true` | Flash messages render as ActiveAdmin's original plain `<div>` (no dismiss button). |
149
155
  | `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 +163,10 @@ ActiveAdminPrism.enable!
157
163
  | `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
164
  | `menu_search` | `true` | No search box renders above the sidebar's "Pages" nav — see [Menu search](#menu-search). |
159
165
  | `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). |
166
+ | `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). |
167
+ | `action_items_dropdown` | `true` | Every `action_item` always renders inline in the title bar, however many there are — no "Actions" dropdown consolidation. See [Consolidated action items](#consolidated-action-items). |
168
+ | `action_items_dropdown_threshold` | `3` | How many `action_item`s a title bar can have before `action_items_dropdown` (if on) collapses them into a dropdown. |
169
+ | `auto_nav_icons` | `true` | A Pages nav item with no explicit `icon:` renders with no icon at all (just its label, or a bare dot once collapsed to the icon-only rail) instead of an automatically-picked one — see [Automatic nav icons](#automatic-nav-icons). |
160
170
 
161
171
  **How this crosses the server/client boundary.** `sidebar`,
162
172
  `colorize_action_icons`, and the `login_*` flags are pure server-side
@@ -288,6 +298,38 @@ passes this hash through untouched) accepts: `:dashboard`, `:users`,
288
298
  `:home`, `:list`, `:folder`, `:bell`, `:search`, `:menu`, `:logout`,
289
299
  `:check`, `:x`, `:chevron_down`, `:eye`, `:pencil`, `:trash`, `:filter`.
290
300
 
301
+ ### Automatic nav icons
302
+
303
+ A menu item registered with no `icon:` at all still gets one, picked from
304
+ a generic subset of the icon set above (`:dashboard`, `:users`, `:cart`,
305
+ `:box`, `:receipt`, `:credit_card`, `:message`, `:settings`, `:home`,
306
+ `:list`, `:folder`, `:bell`, `:search`, `:globe`, `:eye`, `:pencil`,
307
+ `:filter`) based on the item's own label — the same label always maps to
308
+ the same icon (it's a deterministic hash, not re-rolled per request), so
309
+ it never visibly changes between page loads. This is mainly about the
310
+ collapsed icon-only rail (see below): without any icon at all, an
311
+ unassigned item renders there as just a bare dot, indistinguishable from
312
+ any other unassigned item. `icon:` set explicitly always wins. Turn it
313
+ off with `config.auto_nav_icons = false` to go back to rendering no icon
314
+ for such an item (this gem's behavior before this flag existed).
315
+
316
+ ### Collapsible sidebar rail
317
+
318
+ A hamburger icon button next to the brand, at the top of the sidebar,
319
+ collapses it to a narrow icon-only rail — labels, the search box, language
320
+ switcher, and section headings all hide, leaving just the icons (each
321
+ still identifiable via a native tooltip on hover). Clicking again expands
322
+ it back to full width. The choice persists across page loads
323
+ (`localStorage`, like the per-group nav expand/collapse state already
324
+ does). Desktop-only: below the 900px mobile breakpoint the sidebar is
325
+ already off-canvas (a full-width drawer toggled by its own separate
326
+ hamburger button, `.prism-sidebar-mobile-toggle`), and collapsing to a
327
+ rail there wouldn't make sense — this toggle has no effect on that
328
+ behavior either way. Turn it off with
329
+ `config.sidebar_collapsible = false` to remove the toggle entirely (the
330
+ sidebar is then always full width, ActiveAdmin's own implicit default
331
+ before this flag existed).
332
+
291
333
  ### Parent groups & submenus (nested navigation)
292
334
 
293
335
  Nested groups (e.g. an "E-Commerce" group containing "Products" and
@@ -605,24 +647,112 @@ jquery-rails/jquery-ujs. Turn off with `config.styled_confirms = false`.
605
647
  The "Filters" panel (ActiveAdmin's `filters_sidebar_section`) starts
606
648
  collapsed to a single filter-icon button; clicking it expands the full form
607
649
  in place (also keyboard-accessible — Enter/Space toggle it, and it exposes
608
- `aria-expanded`). The index table/main content area reflows to reclaim the
609
- freed-up width while collapsed, and gives it back when expanded. No setup
610
- needed, and it only targets that specific panel — any other sidebar section
611
- (dashboard panels, custom `sidebar :title do ... end` blocks) is untouched.
612
- Turn it off with `config.collapsible_filters = false` to always show it
613
- fully expanded, matching ActiveAdmin's own default (and the table/content
614
- area at its normal, non-reflowing width).
650
+ `aria-expanded`). This is always how Filters behaves, whether or not any
651
+ other collapsible sections exist it's never grouped into a dropdown
652
+ with anything else.
653
+
654
+ Every *other* sidebar section dashboard panels, ActiveAdmin's own
655
+ "Search status" panel (when `active_filters_bar` is off), or any custom
656
+ `sidebar "Title" do ... end` block a host registers — gets collapsed too,
657
+ but consolidated into a single "More Actions" Select2 dropdown instead of
658
+ each getting its own individually collapsed icon button: a stack of those
659
+ has nowhere near enough room in the 72px gutter that assumes just one
660
+ (Filters). This dropdown renders in the *title bar*, next to (and
661
+ styled like) the consolidated action items dropdown below — see
662
+ [Consolidated action items](#consolidated-action-items) — not inside
663
+ `#sidebar` itself, so the two read as one "more stuff lives here" row
664
+ instead of two disconnected mechanisms in different parts of the page.
665
+ Picking an option from it opens that section (closing every other
666
+ non-Filters one — one visible at a time, in `#sidebar`, same as ever)
667
+ and reflows the table just like Filters opening does. A section's own
668
+ header still opens/closes it directly too, keeping the dropdown in sync
669
+ either way. A page with no sections besides Filters (the common case)
670
+ shows no dropdown at all — just the one familiar icon button.
671
+
672
+ Pass your own icon via `sidebar "More Actions", icon: :list do ... end`
673
+ (any name from `lib/prism_icons.rb`) — it's only used on a section's own
674
+ header once it's open, since the collapsed dropdown itself doesn't render
675
+ per-section icons; anything else falls back to a generic one (`:filter`
676
+ for the Filters section specifically, `:list` otherwise). The index
677
+ table/main content area reflows to reclaim the freed-up width while
678
+ *every* section is collapsed, giving it back the moment any one of them
679
+ opens. Turn it off with `config.collapsible_filters = false` to always
680
+ show every section fully expanded, matching ActiveAdmin's own default
681
+ (and the table/content area at its normal, non-reflowing width).
615
682
 
616
683
  The reflow relies on the CSS `:has()` selector (broadly supported in
617
- current browsers); without it, the Filters panel still collapses/expands
618
- correctly, it just won't reclaim the extra width.
684
+ current browsers); without it, sections still collapse/expand correctly,
685
+ the reflow just won't reclaim the extra width.
686
+
687
+ ### Consolidated action items
688
+
689
+ A title bar with more than `action_items_dropdown_threshold` (default:
690
+ `3`) `action_item` buttons collapses all of them into a single Select2
691
+ "jump menu", aligned with the index table's own right edge, instead of a
692
+ multi-row wall of individual buttons — a resource registering a dozen+
693
+ CSV upload / bulk-action links is a real example this was built for.
694
+ (The table's own edge, not the page's: a table's column-driven width
695
+ often doesn't reach the page's full content width, so aligning to the
696
+ container instead would leave the dropdown looking stranded out past
697
+ the table it belongs to.) Picking an option fires that action
698
+ immediately (a plain `link_to` navigates, a `button_to` form submits —
699
+ whatever it actually was, including its own `data-confirm`/`data-method`)
700
+ and the dropdown resets right back to its placeholder, ready for the next
701
+ pick — it's a trigger, not a persistent selection. Purely client-side DOM
702
+ restructuring: `prism.js` moves each existing `action_item` element as-is
703
+ (not a clone) into a hidden holding area and `.click()`s the real
704
+ `<a>`/`<button>` inside it on selection, so whatever a host's own
705
+ `action_item` block rendered keeps working completely unmodified. Select2
706
+ itself is always available for this regardless of `config.select2` (that
707
+ flag only controls auto-enhancing a *host's* own selects) — the library
708
+ ships in this gem's JS either way. A page with only a couple of action
709
+ items (a lone "New Resource" button, say) is left untouched, rendering
710
+ inline exactly as ActiveAdmin does by default — the threshold exists so
711
+ this only kicks in for pages that actually need it. Turn it off entirely
712
+ with `config.action_items_dropdown = false`, or raise/lower
713
+ `config.action_items_dropdown_threshold` to change how many buttons it
714
+ takes before consolidation kicks in.
715
+
716
+ ### Active filters bar
717
+
718
+ Once at least one filter or scope is active, a summary ("Scope: All",
719
+ "Bank code contains BCA", etc.) renders as a highlighted pill bar in the
720
+ same row as the Batch Actions button/scope tabs (AA core's own
721
+ `.table_tools`, pushed to the row's far end), instead of inside
722
+ ActiveAdmin's own `#sidebar` as its own panel. Tinted with the theme's
723
+ primary color (a colored left border + tinted background, distinct from
724
+ the plain gray panels elsewhere) so an active filter reads as a clear,
725
+ eye-catching signal rather than blending in as more chrome. It's also
726
+ clickable — clicking anywhere on it opens the Filters panel (expanding it
727
+ if `collapsible_filters` has it collapsed) and scrolls it into view,
728
+ a shortcut to editing the filters currently producing this exact result
729
+ set, rather than only the separate funnel icon doing that. This is also
730
+ the fix for that sidebar summary overflowing out whenever the collapsible
731
+ Filters panel (above) is collapsed to its 72px icon gutter — there's
732
+ nowhere in 72px for a sentence-length filter description to fit. Turn it
733
+ off with `config.active_filters_bar = false` to restore ActiveAdmin's own
734
+ stock sidebar-based rendering (only sensible if `collapsible_filters` is
735
+ also `false`, since otherwise the two flags combined bring the overflow
736
+ back).
619
737
 
620
738
  ### Flash messages
621
739
 
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
740
+ Flash messages render as floating toast cards, pinned to the top-right
741
+ corner of the viewport (stacking if more than one is active) instead of
742
+ ActiveAdmin's plain inline banner — a type-colored icon
743
+ (`:check_circle`/`:alert_triangle`/`:alert_circle`/`:info` depending on
744
+ the flash key: `:notice`/`:success`, `:alert`/`:warning`, `:error`, and
745
+ anything else respectively), the message, a dismiss button, and — while
746
+ `flash_auto_dismiss` is on — a countdown bar along the card's bottom edge
747
+ that visually empties out over `flash_auto_dismiss_seconds`, pausing
748
+ (along with the actual auto-dismiss timer, not just its own animation) as
749
+ long as the pointer is over the card, so a flash a visitor is mid-read
750
+ never vanishes out from under them. Fades/slides out with a smooth,
751
+ configurable transition on dismiss (manual or automatic) either way. This
752
+ applies identically on Devise's sign-in/password/etc pages — see
753
+ [Flash messages markup](#flash-messages-markup) for why that needed its
754
+ own layout override. See [Configuration reference](#configuration-reference)
755
+ for `flash_dismissible`, `flash_auto_dismiss(_seconds)`, and
626
756
  `flash_transition_ms`.
627
757
 
628
758
  ### Sidebar footer ("Powered by Active Admin")
@@ -765,6 +895,8 @@ Ruby view files under `lib/active_admin/views/`.
765
895
  span.prism-sidebar-mobile-toggle <- hamburger, ≤900px viewports only
766
896
  div.prism-sidebar-inner
767
897
  div.prism-sidebar-brand
898
+ span.prism-sidebar-collapse-toggle[role=button][data-prism-toggle-sidebar-collapse] <- only if config.sidebar_collapsible
899
+ svg.prism-sidebar-collapse-icon <- the :menu (hamburger) icon
768
900
  #site_title <- AA's own site_title verb, unchanged
769
901
  div.prism-sidebar-lang <- only if config.language_switcher and #languages is non-empty
770
902
  div.prism-sidebar-search <- only if config.menu_search
@@ -812,8 +944,16 @@ Notes:
812
944
  built-in styling of its own beyond what you see in `_sidebar.scss` — it's
813
945
  just an example class name, feel free to use your own.
814
946
  - 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)).
947
+ toggled by `prism.js`), `body.prism-sidebar-collapsed` (desktop rail
948
+ collapsed, also toggled by `prism.js` and persisted to `localStorage` —
949
+ see [Collapsible sidebar rail](#collapsible-sidebar-rail)),
950
+ `body.prism-sidebar-footer-disabled` (set when `config.sidebar_footer` is
951
+ `false` — see [Configuration reference](#configuration-reference)).
952
+ - Every `a.prism-nav-link` / `span.prism-nav-group-toggle` also carries a
953
+ plain `title="<label>"` attribute (a host's own explicit `:title` via
954
+ `html_options` wins instead) — inert most of the time, but the only way
955
+ left to identify an item by hovering once `.prism-nav-label` itself is
956
+ hidden by the rail-collapsed state above.
817
957
 
818
958
  ### Language switcher markup
819
959
 
@@ -970,46 +1110,145 @@ anything Prism itself renders:
970
1110
  li.select2-results__message <- "No results found" etc.
971
1111
  ```
972
1112
 
973
- ### Filters sidebar panel (`#filters_sidebar_section`)
1113
+ ### Collapsible sidebar sections (`.prism-collapsible-panel`)
974
1114
 
975
- Only this specific `SidebarSection` (AA's built-in id for the Filters
976
- panel) gets the extra icon/collapse markup any other sidebar section
977
- (dashboard panels, a host's own `sidebar :title do ... end`) is untouched:
1115
+ Every `SidebarSection` gets this markup — not just AA's built-in Filters
1116
+ panel; a host's own `sidebar "Title" do ... end` block gets it too:
978
1117
 
979
1118
  ```
980
1119
  #sidebar <- AA's own right-hand content sidebar (not Prism's left nav)
981
- .panel#filters_sidebar_section.prism-collapsible-panel[.open]
1120
+ .panel.prism-collapsible-panel[#filters_sidebar_section][.open]
982
1121
  > h3 <- the icon-only button when collapsed
983
- svg.prism-filter-icon
1122
+ svg.prism-filter-icon <- :filter for Filters, :list (or your own `icon:`) otherwise
984
1123
  span.prism-filter-label <- visually hidden (max-width:0) while collapsed
985
1124
  .panel_contents <- max-height:0 while collapsed, animates open
986
- form.filter_form
1125
+ form.filter_form <- Filters section specifically
987
1126
  .filter_form_field[.select_and_search][.filter_date_range]
988
1127
  ```
989
1128
 
990
1129
  `.prism-collapsible-panel` and the icon/label markup are only added when
991
- `config.collapsible_filters` is `true`; `prism.js` mirrors the panel's
992
- `.open` state onto `body.prism-filters-open`, which is what
993
- `#active_admin_content`/`#sidebar`'s reflow rules key off (`:has()` see
994
- [Collapsible "Filters" sidebar](#collapsible-filters-sidebar)). With the config `false`,
995
- `body.prism-filters-collapsible-disabled` is the backstop class that forces
996
- the panel back to always-expanded.
1130
+ `config.collapsible_filters` is `true`; `prism.js` mirrors the Filters
1131
+ section's `.open` state onto `body.prism-filters-open` specifically (kept
1132
+ for any host CSS already keying off it), but `#active_admin_content`/
1133
+ `#sidebar`'s own reflow rule keys off *any* section's `.open` via `:has()`
1134
+ instead see [Collapsible "Filters" sidebar](#collapsible-filters-sidebar).
1135
+ With the config `false`, `body.prism-filters-collapsible-disabled` is the
1136
+ backstop class that forces every section back to always-expanded.
1137
+
1138
+ With at least one collapsible section besides Filters, `prism.js` also
1139
+ adds `.prism-sidebar-multi-panel` to `#sidebar` — which does nothing but
1140
+ hide each non-Filters section's own collapsed-state `> h3` (above) via
1141
+ CSS
1142
+ (`#sidebar.prism-sidebar-multi-panel .prism-collapsible-panel:not(.open):not(#filters_sidebar_section) > h3`),
1143
+ since its trigger lives elsewhere now (Filters' own `> h3` is never
1144
+ hidden by this rule, regardless) — and inserts the actual dropdown into
1145
+ the *title bar's* shared row instead of into `#sidebar` itself:
1146
+
1147
+ ```
1148
+ #titlebar_right
1149
+ div.action_items
1150
+ span#prism-titlebar-actions-row.prism-titlebar-actions-row
1151
+ span.prism-sidebar-panel-select-wrapper
1152
+ select.prism-sidebar-panel-select <- Select2-enhanced; one <option> per non-Filters section, by title
1153
+ span.prism-action-items-dropdown <- see below; may or may not be present on the same page
1154
+ ```
1155
+
1156
+ Selecting an option opens that section (in `#sidebar`, same as ever) and
1157
+ closes every other non-Filters one — Filters itself is excluded entirely
1158
+ and never appears in this dropdown's options.
1159
+
1160
+ ### Consolidated action items markup (`.prism-action-items-dropdown`)
1161
+
1162
+ Only present once `action_item` count exceeds
1163
+ `config.action_items_dropdown_threshold` (see
1164
+ [Consolidated action items](#consolidated-action-items)); shares
1165
+ `#prism-titlebar-actions-row` above with the "More Actions" dropdown when
1166
+ both exist on the same page (whichever one exists lands in that shared
1167
+ row on its own otherwise):
1168
+
1169
+ ```
1170
+ #titlebar_right
1171
+ div.action_items
1172
+ span#prism-titlebar-actions-row.prism-titlebar-actions-row
1173
+ span.prism-action-items-dropdown
1174
+ select.prism-action-items-select <- Select2-enhanced; one <option> per action_item, by its link/button text
1175
+ div.prism-action-items-holding[hidden]
1176
+ span.action_item <- every original action_item element, moved here as-is, never shown
1177
+ a / form <- whatever a host's own action_item block rendered, untouched
1178
+ ```
1179
+
1180
+ Selecting an option finds the real `<a>`/`<button>`/`<input type=submit>`
1181
+ inside the matching `.action_item` in `.prism-action-items-holding` and
1182
+ `.click()`s it directly, then resets the select back to its placeholder.
1183
+ The whole `#prism-titlebar-actions-row` (not each dropdown individually)
1184
+ is what a separate script in `prism.js` aligns to the index table's own
1185
+ right edge — see [Consolidated action items](#consolidated-action-items)
1186
+ for why.
1187
+
1188
+ ### Active filters bar (`#prism_active_filters_bar`)
1189
+
1190
+ Only present once at least one filter or scope is active
1191
+ (`config.active_filters_bar`, default `true` — see
1192
+ [Active filters bar](#active-filters-bar)); reuses ActiveAdmin core's own
1193
+ `ActiveAdmin::Views::ActiveFiltersSidebarContent` markup/i18n wholesale, so
1194
+ the `h4`/`b`/`ul`/`li` structure below is AA's, not Prism's own:
1195
+
1196
+ ```
1197
+ #main_content
1198
+ .index_content
1199
+ .table_tools <- AA core's own — Batch Actions/scope tabs row
1200
+ .table_tools_actions <- only if any_table_tools? — wraps the controls AA core itself renders here
1201
+ .dropdown_menu <- Batch Actions button
1202
+ .scopes <- scope tabs, if any are defined
1203
+ #prism_active_filters_bar.prism-active-filters-bar <- only if a scope/filter is active; pushed to the row's far end
1204
+ h4 + b.current_scope_name <- only if a scope is active
1205
+ div
1206
+ h4 <- "Current filters:"
1207
+ ul
1208
+ li[class="current_filter_*"] <- one per active filter/scope value
1209
+ span <- filter label + predicate
1210
+ b <- the filter's value
1211
+ ```
997
1212
 
998
1213
  ### Flash messages markup
999
1214
 
1215
+ Rendered twice over — once from `lib/active_admin/views/flash_messages.rb`
1216
+ (Arbre, for every logged-in page) and once, identically, from
1217
+ `app/views/layouts/active_admin_logged_out.html.erb` (plain ERB, for
1218
+ Devise's sign-in/password/etc pages, which route through a completely
1219
+ separate layout ActiveAdmin itself ships rather than through
1220
+ `Pages::Base`/Arbre at all — the Ruby-side override alone never reaches
1221
+ them, which is why this gem ships a full layout override just for this).
1222
+ Both share the same icon-selection logic
1223
+ (`ActiveAdminPrism::Icons.flash_icon_name`, in `lib/prism_icons.rb`) and
1224
+ duration math (`ActiveAdminPrism::Configuration#flash_auto_dismiss_ms`)
1225
+ rather than duplicating either:
1226
+
1000
1227
  ```
1001
- .flashes[data-prism-transition-ms][data-prism-auto-dismiss-ms]
1002
- .flash.flash_notice / .flash_error / .flash_alert [.prism-flash-hide]
1228
+ .flashes[data-prism-transition-ms][data-prism-auto-dismiss-ms] <- position: fixed toast stack, top-right
1229
+ .flash.flash_notice / .flash_success / .flash_alert / .flash_warning / .flash_error / .flash_info [.prism-flash-hide]
1230
+ [style="--prism-flash-duration: <ms>"] <- only if config.flash_auto_dismiss
1231
+ svg.prism-flash-icon <- :check_circle / :alert_triangle / :alert_circle / :info, by type
1003
1232
  span.prism-flash-message
1004
- button.prism-flash-dismiss[data-prism-flash-dismiss] <- only if config.flash_dismissible
1233
+ button.prism-flash-dismiss[data-prism-flash-dismiss] <- only if config.flash_dismissible
1005
1234
  svg.prism-flash-dismiss-icon
1235
+ div.prism-flash-progress <- only if config.flash_auto_dismiss — the countdown bar
1006
1236
  ```
1007
1237
 
1008
1238
  `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
1239
+ classes (from `flash_messages.each { |type, ...| }`); `flash_success`/
1240
+ `flash_warning`/`flash_info` are the same convention extended to a host
1241
+ setting those keys directly (`flash[:warning] = "..."`, etc) Prism
1242
+ colors each of the four icon/progress-bar combinations distinctly, all
1243
+ five type classes included. `.prism-flash-hide` is added by `prism.js`
1244
+ right before removal (opacity/transform transition), timed against the
1245
+ `data-prism-transition-ms` attribute. `.prism-flash-progress`'s width
1246
+ animates via CSS (`@keyframes prism-flash-countdown`, `transform: scaleX`)
1247
+ against the same duration `prism.js` uses for the actual removal timer —
1248
+ hovering a card pauses both in lockstep (`animation-play-state` for the
1249
+ bar, a tracked remaining-time restart for the timer itself) rather than
1250
+ just the visual, so a paused bar can't silently disagree with a flash
1251
+ that's still counting down underneath it. See
1013
1252
  [Flash messages](#flash-messages) / [Configuration reference](#configuration-reference).
1014
1253
 
1015
1254
  ### Confirm dialog (jQuery UI)
data/README.md CHANGED
@@ -12,7 +12,7 @@ theme, troubleshooting). This README is a quick start.
12
12
  ## Live demo
13
13
 
14
14
  A live demo dashboard is running at
15
- **[prism-demo.onrender.com/admin](https://prism-demo.onrender.com/admin)**:
15
+ **[prism-demo.onrender.com/admin](https://prism-demo.onrender.com/admin/login)**:
16
16
 
17
17
  ```
18
18
  Username: admin@example.com
@@ -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,9 @@ 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)
123
+ config.action_items_dropdown = true # many title-bar action_items collapse into an "Actions" dropdown
124
+ config.action_items_dropdown_threshold = 3
121
125
  end
122
126
 
123
127
  ActiveAdminPrism.enable!