keystone_ui-preferences 0.10.1 → 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: 0fefa886f2e66f62352fdefc4e35ccdb094f75bc6239bd400cb49af3dec31c30
4
- data.tar.gz: '09dbb68d7489c63390028910cde735fc98156cc78ce1358425b72009fd9797ec'
3
+ metadata.gz: 62a51a75e9af129d3bf99b15c564aacc8df29046f3df3a3c9cb4791c2a700122
4
+ data.tar.gz: 9342e0010caa8eee2bfe03cd0355980afb82fa8cd39db4f14e04948c232dbb0f
5
5
  SHA512:
6
- metadata.gz: 2da20eb0e968d2a270025971fea98ed3fe80e0474fcedb36142ea212e16075b002bed32a57aaa1a1fdcdc137c7bddb2bd774aa74dbf2a7c4e0c9344d7713b37a
7
- data.tar.gz: 96337f947750d95d8d40a06a5657f5fcc56217e972feca3c5246c16994d6a9e77e61c54c02f6f70c97f81c9b1edb125ae5ea029111c720198c61562dd37eafec
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.
@@ -224,7 +226,7 @@ The gem gives keystone_ui the mode through keystone_ui's theme mode supplier, so
224
226
  <html <%= keystone_theme_attributes %>>
225
227
  ```
226
228
 
227
- A visitor who is not signed in gets `default_mode`. A choice made with keystone_ui's theme toggle is kept in a cookie and wins over the saved mode in that browser. Saving in the appearance section clears that cookie, so the saved mode shows on the next page. The clearing runs in settings_hub's `after_settings_change` hook, which the `ComponentPreferences` concern defines, so an app that defines its own `after_settings_change` calls `super` from it.
229
+ A visitor who is not signed in gets `default_mode`. A choice made with keystone_ui's theme toggle is kept in a cookie and wins over the saved mode in that browser. `keystone_theme_mode` returns the same choice, so a layout that marks its page dark from it follows the toggle too. Saving in the appearance section clears that cookie, so the saved mode shows on the next page. The clearing runs in settings_hub's `after_settings_change` hook, which the `ComponentPreferences` concern defines, so an app that defines its own `after_settings_change` calls `super` from it.
228
230
 
229
231
  ## Look
230
232
 
@@ -34,7 +34,7 @@ module KeystoneUi
34
34
  end
35
35
 
36
36
  def keystone_theme_mode
37
- keystone_appearance_choice.mode
37
+ KeystoneUi::ThemeChoice.new(cookies[KeystoneUi::ThemeChoice::COOKIE], supplied: keystone_appearance_choice.mode).mode
38
38
  end
39
39
 
40
40
  def keystone_look
@@ -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.1"
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.1
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