keystone_ui-preferences 0.10.2 → 0.11.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: d49104296c4ab87a70762c5e05c9257d39320610dc7e412f3447b3e626c6935f
4
- data.tar.gz: 9048db5cfc549e83efc5b53a62772411ce4e84ce3dd6adbf9fcbb39f299c6c0e
3
+ metadata.gz: 62a51a75e9af129d3bf99b15c564aacc8df29046f3df3a3c9cb4791c2a700122
4
+ data.tar.gz: 9342e0010caa8eee2bfe03cd0355980afb82fa8cd39db4f14e04948c232dbb0f
5
5
  SHA512:
6
- metadata.gz: f894ce79ae1e17c6f136661125edb9f78532ef7336d5a9df09afe29905929bdc1fe6bae5b0973468461bbf3d824237066e1e03efdbc98543a3942e72b905827a
7
- data.tar.gz: e41c53bd16beed10b80392162093881b3f53cf27d96c7a6f1bce56c97623039aa16a5971e46cc3570bd4e36f94c253207334dc4de6cea2f3fea79b29b09c7ce3
6
+ metadata.gz: eb62b5297d74ae3a88a0601a3267b5e0abf84911dcf7536db280f544187d0b7cd3ca6cde9ea0c3a72d67d4ea2ad3d4101a944ce4d4d5b0f8c5c2e570d3a6f8d8
7
+ data.tar.gz: 43b0c8ea5754ac14a012e31b298a3d98129e3f88d3c4cce4744dffe5937498f37d017902f91ae52c981a4ca98078c2aab459d2e64f29068349c440bde5d2f5c1
data/README.md CHANGED
@@ -148,6 +148,8 @@ SettingsHub.section :navigation_order, area: :user, title: "Tab order",
148
148
 
149
149
  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.
150
150
 
151
+ A tab declared with keystone_ui's `stays_first: true` has no Down button, and the tab after it has no Up button, so no button moves a tab ahead of it.
152
+
151
153
  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.
152
154
 
153
155
  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.
@@ -49,5 +49,5 @@
49
49
  <% end %>
50
50
  <% end %>
51
51
 
52
- <%= render partial: "keystone_ui/preferences/settings/editor_layout", locals: { editor: editor, previews: offers_colours } %>
52
+ <%= render partial: "keystone_ui/preferences/settings/editor_layout", locals: { editor: editor, previews: offers_colours, preview_key: "account" } %>
53
53
  <% end %>
@@ -49,4 +49,4 @@
49
49
  <% end %>
50
50
  <% end %>
51
51
 
52
- <%= render partial: "keystone_ui/preferences/settings/editor_layout", locals: { editor: editor, previews: chooses_colours } %>
52
+ <%= render partial: "keystone_ui/preferences/settings/editor_layout", locals: { editor: editor, previews: chooses_colours, preview_key: "person" } %>
@@ -16,7 +16,7 @@
16
16
  <%= ui_tab_switcher(tabs: %w[Edit Preview]) do %>
17
17
  <div data-editor-panels>
18
18
  <div data-editor-panel data-shown><%= editor %></div>
19
- <div data-editor-panel><%= render partial: "keystone_ui/preferences/settings/theme_preview" %></div>
19
+ <div data-editor-panel><%= render partial: "keystone_ui/preferences/settings/theme_preview", locals: { preview_key: preview_key } %></div>
20
20
  </div>
21
21
  <% end %>
22
22
  </div>
@@ -31,13 +31,13 @@
31
31
  <%= ui_grid(cols: { default: 1, sm: 2 }, gap: :sm) do %>
32
32
  <span data-tab-label><%= tab.label %></span>
33
33
  <%= ui_grid(cols: { default: 2 }, gap: :sm) do %>
34
- <% if tab_index.positive? %>
34
+ <% if tab_index > tabs.count(&:stays_first?) %>
35
35
  <%= form_with(url: submit_url, method: :patch, data: { turbo: false, tab_move: "up" }) do %>
36
36
  <%= hidden_field_tag "order", arrangement.tab_moved(group_index, tab_index, -1).to_json, id: nil %>
37
37
  <%= ui_button(label: "Up", type: :submit, variant: :secondary, size: :sm) %>
38
38
  <% end %>
39
39
  <% end %>
40
- <% if tab_index < tabs.size - 1 %>
40
+ <% if tab_index < tabs.size - 1 && !tab.stays_first? %>
41
41
  <%= form_with(url: submit_url, method: :patch, data: { turbo: false, tab_move: "down" }) do %>
42
42
  <%= hidden_field_tag "order", arrangement.tab_moved(group_index, tab_index, 1).to_json, id: nil %>
43
43
  <%= ui_button(label: "Down", type: :submit, variant: :secondary, size: :sm) %>
@@ -10,8 +10,8 @@
10
10
  <%= ui_button(label: "Delete", variant: :danger, type: :button) %>
11
11
  </div>
12
12
  <div style="display: flex; flex-direction: column; gap: 1rem;">
13
- <%= ui_form_field(attribute: "preview_name", label: "Name", value: "Northwind Traders") %>
14
- <%= ui_form_field(attribute: "preview_region", label: "Region", type: :select, options: [ [ "North", "north" ], [ "South", "south" ] ], value: "north", required: true) %>
13
+ <%= ui_form_field(attribute: "#{preview_key}_preview_name_#{side}", label: "Name", value: "Northwind Traders") %>
14
+ <%= ui_form_field(attribute: "#{preview_key}_preview_region_#{side}", label: "Region", type: :select, options: [ [ "North", "north" ], [ "South", "south" ] ], value: "north", required: true) %>
15
15
  </div>
16
16
  <%= ui_data_table(
17
17
  items: [ { customer: "Northwind Traders", region: "North", total: "$12,400" }, { customer: "Harbor Supply", region: "South", total: "$8,950" }, { customer: "Fern & Co", region: "North", total: "$4,120" } ],
@@ -2,6 +2,6 @@
2
2
 
3
3
  module KeystoneUi
4
4
  module Preferences
5
- VERSION = "0.10.2"
5
+ VERSION = "0.11.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.10.2
4
+ version: 0.11.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.47.0
18
+ version: 0.117.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.47.0
25
+ version: 0.117.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: keystone_ui-looks
28
28
  requirement: !ruby/object:Gem::Requirement