keystone_ui-preferences 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 132478f987e0dbbf12eeda5ac9c9e9fe14a9ca1ec8b8ce60618b29e272f5db8f
4
- data.tar.gz: eefd3cd44bce3d9aa5f3dab0c3ff4f5ad4a882e15ab9fbd836964e46e631724a
3
+ metadata.gz: 4f636363927260121283af376ea874a464189878bc0a338840fe5c3a228b13dd
4
+ data.tar.gz: c6e10c6b5e2b4442e74aa0448f7cbd68c23e292b5c21dfd7455291847c12e8c1
5
5
  SHA512:
6
- metadata.gz: da15030c2de6a478df7106c48218dfe8bcd2197f592f68ea8147b5b6fa389b5c65b4e30699a1480df86f13ec1d8069a2da2058c38550e8ed539e74ccab8dfe74
7
- data.tar.gz: be3c817d9c47d16df821adeb5cf7fbe2e6cb884ad48e3711e00f2d270619c25368a202d0364593fa15bea9f7eefc2651027a3f80fa225fd4fe4645b6c692d732
6
+ metadata.gz: c1ac4cd559b34527ff83fa954a793b8b9433d2c8caf7a76bfb581b8417ad6f6e9bc1c69c1e91b3aaece6466b5529b8124d6466e050e67022b7aef1ecc97a7ffd
7
+ data.tar.gz: f8d94f6d19ce5788906d4eb8ab48c827bc38f631e5e1f3f2b7325931c2d83671efd6d03e6b610ddcb1dbd641599667a3da11050bc9350f32a4fcaaf70a38654c
data/README.md CHANGED
@@ -129,7 +129,9 @@ SettingsHub.section :navigation_order, area: :user, title: "Tab order",
129
129
 
130
130
  The section lists the groups declared with keystone_ui's `navigation_group`, each with the tabs the person may see, in the order that applies to them. A group with no tab they may see is left out. Each group and tab has an Up and a Down button, and pressing one saves the order with it moved one place, so the page works in a Hotwire Native web view with no script and nothing to drag. At phone width each row's buttons sit under its name.
131
131
 
132
- Saving keeps `"order": [{ "group": "Admin" }, { "group": "Sales", "tabs": ["orders", "quotes"] }]` for that person under the `navigation` key, naming groups by label and tabs by key, and leaves their saved placement as it was. keystone_ui draws the navigation in that order on the next page they open, with anything the order does not name after it in its declared order. Reset removes the saved order, so the navigation goes back to the declared order. An order that is not a list of groups is refused with a message, and nothing is saved.
132
+ A tab declared outside any group with keystone_ui's `navigation_tab` is one row in the list of groups, named by its label, with the same Up and Down buttons as a group. It has no tab rows under it, and no button moves it into a group.
133
+
134
+ Saving keeps `"order": [{ "group": "Admin" }, { "group": "Sales", "tabs": ["orders", "quotes"] }, { "group": "Console" }]` for that person under the `navigation` key, naming groups by label and tabs by key, and a tab declared outside any group by its label alone. It leaves their saved placement as it was. keystone_ui draws the navigation in that order on the next page they open, with anything the order does not name after it in its declared order. Reset removes the saved order, so the navigation goes back to the declared order. An order that is not a list of groups is refused with a message, and nothing is saved.
133
135
 
134
136
  ## What is stored
135
137
 
@@ -16,11 +16,17 @@ module KeystoneUi
16
16
  end
17
17
 
18
18
  def order
19
- @arranged.map { |group, tabs| { "group" => group.label, "tabs" => tabs.map { |tab| tab.key.to_s } } }
19
+ @arranged.map { |group, tabs| entry(group, tabs) }
20
20
  end
21
21
 
22
22
  private
23
23
 
24
+ def entry(group, tabs)
25
+ return { "group" => group.label } if group.standalone?
26
+
27
+ { "group" => group.label, "tabs" => tabs.map { |tab| tab.key.to_s } }
28
+ end
29
+
24
30
  def moved(items, index, step)
25
31
  items.insert(index + step, items.delete_at(index))
26
32
  end
@@ -26,6 +26,7 @@
26
26
  <% end %>
27
27
  <% end %>
28
28
  <% tabs.each_with_index do |tab, tab_index| %>
29
+ <% next if group.standalone? %>
29
30
  <div data-navigation-tab="<%= tab.key %>">
30
31
  <%= ui_grid(cols: { default: 1, sm: 2 }, gap: :sm) do %>
31
32
  <span data-tab-label><%= tab.label %></span>
@@ -2,6 +2,6 @@
2
2
 
3
3
  module KeystoneUi
4
4
  module Preferences
5
- VERSION = "0.5.0"
5
+ VERSION = "0.6.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keystone_ui-preferences
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 0.38.0
18
+ version: 0.41.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 0.38.0
25
+ version: 0.41.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: railties
28
28
  requirement: !ruby/object:Gem::Requirement