keystone_ui-colors 0.5.0 → 0.6.1

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: 7e19d4ac1360f6f858edb7466444b610d3aa41f27c41c770f9d2b1674e51d04b
4
- data.tar.gz: 53bc07b0653b12cd9b36f9b94908a6aebdb8cc79370618c0ba70f22a27fdf21a
3
+ metadata.gz: 38f16013fcde298d6fcd2f84959388d11b7841ed2a6b11c3849ef61cd06cbb00
4
+ data.tar.gz: ab00d43dc97d34bffc137fbbd3833e9ef0b369e888d059d3fbd9a85349264e17
5
5
  SHA512:
6
- metadata.gz: e9e76f7316025de47b02b16e490c674dbacc7fd2eb43d0122c9a84b1d60c0350bda35a4514993a550ffa28e4b624ef7961cb72aee95bc7aeb62f576e5a3675cb
7
- data.tar.gz: b2f238d93c3fd4384d99e94891ef4afff962dded85eb3809f6fd8ac111eb17c9513e9cda2d61f102da557deef1f9093a1f4d46598c9e3058cbd81d8d9365db79
6
+ metadata.gz: 6eace9b9bdd5bd5bfc6c3688d2e814f96e8b3a270b4d3f7403a87a325d9cc463249f4b760fbb747dc57e99ef426fff461b6041d34520a11cb3ccd928a6288f8f
7
+ data.tar.gz: a92a25c9de14ce01b44938358c1be525fc713a09c123e42850a6573d8c6c85cdc09c6f6eb07c554d615947c9cbaf95743836f41e6caef1890afb15631138faa3
data/README.md CHANGED
@@ -184,8 +184,11 @@ or for the host's default when the account's look is not registered either. The
184
184
  settings page then shows no look selected and still saves. While an account's colours apply, the
185
185
  page still shows the user's own look.
186
186
 
187
- The colours settings page lists every registered look, with the user's current
188
- look chosen, and saves the one they pick. A name the host does not register is
187
+ The colours settings page lists the app's own look first and then every
188
+ registered look, with the user's current look chosen, and saves the one they
189
+ pick. The app's own look is labelled "Classic" unless the app sets
190
+ `app_look_label`, is chosen when no look is saved, and saving it clears the saved
191
+ look, so the page goes back to the account's look or the app's default. A name the host does not register is
189
192
  refused with a message and nothing is stored. With no looks registered the page
190
193
  shows no look choice.
191
194
 
@@ -46,13 +46,16 @@ module KeystoneUi
46
46
  private
47
47
 
48
48
  def own_preference
49
- @own_preference ||= ThemePreference.find_by(owner: @person)
49
+ return @own_preference if defined?(@own_preference)
50
+
51
+ @own_preference = ThemePreference.find_by(owner: @person)
50
52
  end
51
53
 
52
54
  def account_preference
53
55
  return nil unless @account
56
+ return @account_preference if defined?(@account_preference)
54
57
 
55
- @account_preference ||= ThemePreference.find_by(owner: @account)
58
+ @account_preference = ThemePreference.find_by(owner: @account)
56
59
  end
57
60
  end
58
61
  end
@@ -12,7 +12,7 @@ module KeystoneUi
12
12
 
13
13
  def call
14
14
  preference.assign_attributes(chosen_colours)
15
- preference.look = @values[:look] if @values.key?(:look) && @look_allowed
15
+ preference.look = @values[:look].presence if @values.key?(:look) && @look_allowed
16
16
 
17
17
  return Refusal.new(preference.errors.full_messages.first) unless preference.save
18
18
 
@@ -1,7 +1,8 @@
1
1
  <%= ui_section(title: "Look", spacing: :sm) do %>
2
2
  <div style="display: flex; flex-wrap: wrap; gap: 0.5rem;">
3
+ <%= ui_radio_card(name: "look", value: "", label: KeystoneUi::Colors.configuration.app_look_label, checked: preference.look.nil?) %>
3
4
  <% KeystoneUi.configuration.looks.each_key do |look| %>
4
- <%= ui_radio_card(name: "look", value: look, label: look.humanize, checked: (preference.look || KeystoneUi.configuration.default_look) == look) %>
5
+ <%= ui_radio_card(name: "look", value: look, label: look.humanize, checked: preference.look == look) %>
5
6
  <% end %>
6
7
  </div>
7
8
  <% end %>
@@ -3,7 +3,7 @@
3
3
  module KeystoneUi
4
4
  module Colors
5
5
  class Configuration
6
- attr_accessor :current_owner_method, :authentication_method, :default_template, :default_accent, :default_surface, :default_mode, :default_background, :default_text, :account_colors, :current_account_method, :layout, :user_looks, :account_looks
6
+ attr_accessor :current_owner_method, :authentication_method, :default_template, :default_accent, :default_surface, :default_mode, :default_background, :default_text, :account_colors, :current_account_method, :layout, :user_looks, :account_looks, :app_look_label
7
7
 
8
8
  def initialize
9
9
  @current_owner_method = :current_user
@@ -19,6 +19,7 @@ module KeystoneUi
19
19
  @layout = "application"
20
20
  @user_looks = true
21
21
  @account_looks = true
22
+ @app_look_label = "Classic"
22
23
  end
23
24
  end
24
25
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module KeystoneUi
4
4
  module Colors
5
- VERSION = "0.5.0"
5
+ VERSION = "0.6.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keystone_ui-colors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider