keystone_ui-preferences 0.2.0 → 0.3.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c5ad1323692c3d86b07e82ecf8557ef9d85894d4e6136e77bfa4dfb5242ae17
|
|
4
|
+
data.tar.gz: 8e9e97a645d1eff47df36b3cc58b141fa41f6cbc53ca33899147137a5a7d32b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8fd7e871629c061dc439d333ff15a3a54be431583e71d6936f6bb2b58ddf8e42ae6e5070dccca93f756c4e93acc9cd57b91d3f5443b84d1b6ab939c6eba740d4
|
|
7
|
+
data.tar.gz: 6d6255c5097eab889c34469150e92cb925d7286f02c296f36a47bea17fed1c254ce79cad4bcd9da0de4e9474c823948e97f74b3a998973e74c571d82ff2b8abe
|
data/README.md
CHANGED
|
@@ -81,7 +81,15 @@ SettingsHub.section :account_layouts, area: :account, title: "Table layouts",
|
|
|
81
81
|
runs: "KeystoneUi::Preferences::PickAccountLayouts"
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
The section lists each component key the admin or the account has a saved layout for
|
|
84
|
+
The section lists each component key the admin or the account has a saved layout for, by the name the app gives it, or by the key in words when it has none:
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
KeystoneUi::Preferences.configure do |config|
|
|
88
|
+
config.name_component :revenue_projection_months, "Revenue projection – By month"
|
|
89
|
+
end
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Each key has the members-choose switch and, when the admin has a saved layout of their own, a button that makes it the account's layout.
|
|
85
93
|
|
|
86
94
|
## What is stored
|
|
87
95
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<% component_keys.each do |component_key| %>
|
|
5
5
|
<div data-component-key="<%= component_key %>">
|
|
6
6
|
<% account_preference = preferences.find { |preference| preference.component_key == component_key && preference.owned_by?(account) } %>
|
|
7
|
-
<%= ui_section(title: component_key
|
|
7
|
+
<%= ui_section(title: KeystoneUi::Preferences.configuration.component_name(component_key), spacing: :sm) do %>
|
|
8
8
|
<%= form_with(url: submit_url, method: :patch, data: { turbo: false }) do %>
|
|
9
9
|
<%= hidden_field_tag "component_key", component_key, id: nil %>
|
|
10
10
|
<%= hidden_field_tag "members_choose", "0", id: nil %>
|
|
@@ -8,6 +8,15 @@ module KeystoneUi
|
|
|
8
8
|
def initialize
|
|
9
9
|
@current_owner_method = :current_user
|
|
10
10
|
@authentication_method = :authenticate_user!
|
|
11
|
+
@component_names = {}
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def name_component(component_key, name)
|
|
15
|
+
@component_names[component_key.to_s] = name
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def component_name(component_key)
|
|
19
|
+
@component_names.fetch(component_key.to_s) { component_key.to_s.humanize }
|
|
11
20
|
end
|
|
12
21
|
end
|
|
13
22
|
|