ultra_settings 2.8.1 → 2.9.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 +4 -4
- data/CHANGELOG.md +17 -2
- data/README.md +40 -1
- data/VERSION +1 -1
- data/app/AGENTS.md +7 -0
- data/app/_config_description.html.erb +22 -25
- data/app/_config_list.html.erb +2 -14
- data/app/_data_source.html.erb +43 -29
- data/app/application.css +1019 -340
- data/app/application.js +818 -91
- data/app/application_vars.css.erb +136 -91
- data/app/configuration.html.erb +59 -51
- data/app/index.html.erb +164 -20
- data/app/layout.css +81 -16
- data/app/layout.html.erb +67 -5
- data/app/layout_vars.css.erb +29 -5
- data/app/locales/ar.json +71 -0
- data/app/locales/cs.json +71 -0
- data/app/locales/da.json +71 -0
- data/app/locales/de.json +71 -0
- data/app/locales/el.json +71 -0
- data/app/locales/en.json +85 -0
- data/app/locales/es.json +71 -0
- data/app/locales/fa.json +71 -0
- data/app/locales/fr.json +71 -0
- data/app/locales/gd.json +71 -0
- data/app/locales/he.json +71 -0
- data/app/locales/hi.json +71 -0
- data/app/locales/it.json +71 -0
- data/app/locales/ja.json +71 -0
- data/app/locales/ko.json +71 -0
- data/app/locales/lt.json +71 -0
- data/app/locales/nb.json +71 -0
- data/app/locales/nl.json +71 -0
- data/app/locales/pl.json +71 -0
- data/app/locales/pt-br.json +71 -0
- data/app/locales/pt.json +71 -0
- data/app/locales/ru.json +71 -0
- data/app/locales/sv.json +71 -0
- data/app/locales/ta.json +71 -0
- data/app/locales/tr.json +71 -0
- data/app/locales/uk.json +71 -0
- data/app/locales/ur.json +71 -0
- data/app/locales/vi.json +71 -0
- data/app/locales/zh-cn.json +71 -0
- data/app/locales/zh-tw.json +71 -0
- data/lib/ultra_settings/application_view.rb +21 -3
- data/lib/ultra_settings/coerce.rb +0 -6
- data/lib/ultra_settings/config_helper.rb +4 -4
- data/lib/ultra_settings/configuration.rb +5 -4
- data/lib/ultra_settings/configuration_view.rb +114 -92
- data/lib/ultra_settings/mini_i18n.rb +110 -0
- data/lib/ultra_settings/rack_app.rb +51 -1
- data/lib/ultra_settings/version.rb +1 -1
- data/lib/ultra_settings/web_view.rb +33 -2
- data/lib/ultra_settings.rb +56 -22
- data/ultra_settings.gemspec +1 -0
- metadata +33 -3
- data/AGENTS.md +0 -191
- data/app/_select_menu.html.erb +0 -53
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7b197136c21486ad05e4477bba4f7c0b9765dd3e073421ecfc327b3ed16f8bb
|
|
4
|
+
data.tar.gz: af08178f5b3b47ccab7f7b7aaafba64bbf606759774fe8fdf4054d91be72b52e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dde91f729527a598d414a162011b4d296884d9253d1616d7b38d0aa3f419f93666a7852ac7e9422ecd453e3e2629dc376584e1fa4e46955a33b36927d7567028
|
|
7
|
+
data.tar.gz: db199c5cdb6945b13557641dee89d3ee9ae154632a38b3719d6fcd6c0614ad4b7c07a87e24144567c3363515febb7249b08786acfc76fe9dbf2338757573e381
|
data/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
|
-
# Changelog
|
|
1
|
+
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## 2.9.0
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Significant redesign of the web UI with a cleaner, more modern layout.
|
|
12
|
+
- Internationalized the web UI with translations into 29 languages. The locale is detected from the browser's `Accept-Language` header.
|
|
13
|
+
- Added support for inline editing of SuperSettings runtime settings directly from the web UI. Set `UltraSettings.super_settings_api_path` to the path where the SuperSettings API is mounted to enable this feature. Authorization is delegated entirely to the SuperSettings API.
|
|
14
|
+
- Added `config_alias` option to `ConfigHelper.configuration_class` to allow a class that includes `ConfigHelper` to reference the configuration with a custom method name instead of the default `config`.
|
|
15
|
+
- Switched to `autoload` for lazy loading of internal classes to improve load time when only a subset of the gem's features are used.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Static fields are no longer shown as having a runtime settings source in the web UI.
|
|
20
|
+
- Fixed a bug where calling `return nil?` instead of `return nil` could cause an error when a configuration file is not set.
|
|
21
|
+
|
|
7
22
|
## 2.8.1
|
|
8
23
|
|
|
9
24
|
### Added
|
|
10
25
|
|
|
11
26
|
- Improved web UI indication for which data sources on fields have been overridden by data sources with higher precedence.
|
|
12
27
|
- Added rake tasks for auditing configuration data sources.
|
|
13
|
-
- A companion gem `yard-ultra_settings` is now available to provide YARD integration for documenting UltraSettings configuration classes. See the [yard-ultra_settings](https://github.com/bdurand/ultra_settings/yard_plugin) gem for more information.
|
|
28
|
+
- A companion gem `yard-ultra_settings` is now available to provide YARD integration for documenting UltraSettings configuration classes. See the [yard-ultra_settings](https://github.com/bdurand/ultra_settings/tree/main/yard_plugin) gem for more information.
|
|
14
29
|
|
|
15
30
|
## 2.8.0
|
|
16
31
|
|
data/README.md
CHANGED
|
@@ -417,7 +417,7 @@ You can specify the color scheme by setting by providing the `color_scheme` opti
|
|
|
417
417
|
UltraSettings::RackApp.new(color_scheme: :dark)
|
|
418
418
|
```
|
|
419
419
|
|
|
420
|
-
#### Embedding
|
|
420
|
+
#### Embedding Into Application Views
|
|
421
421
|
|
|
422
422
|
If you prefer to embed the settings view directly into your own admin tools or dashboard, you can use the `UltraSettings::ApplicationView` class to render the settings interface within your existing views:
|
|
423
423
|
|
|
@@ -445,6 +445,45 @@ You'll also need to include the CSS for the configuration view on your page.
|
|
|
445
445
|
</head>
|
|
446
446
|
```
|
|
447
447
|
|
|
448
|
+
#### Customizing The Web UI
|
|
449
|
+
|
|
450
|
+
You can specify the color scheme by setting by providing the `color_scheme` option to the `UltraSettings::ApplicationView` constructor. The default color scheme is `:light`. You can also set the scheme to `:dark` or `:system`.
|
|
451
|
+
|
|
452
|
+
```ruby
|
|
453
|
+
UltraSettings::ApplicationView.new(color_scheme: :dark)
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
You can specify the language to render the application in with the `locale` option to the `UltraSettings::ApplicationView` constructor. The default language is English but it can be changed to any language that has a corresponding JSON file in the `app/locales` directory.
|
|
457
|
+
|
|
458
|
+
```ruby
|
|
459
|
+
UltraSettings::ApplicationView.new(locale: "es").render
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
#### Inline Editing With SuperSettings
|
|
463
|
+
|
|
464
|
+
If you are using the [super_settings](https://github.com/bdurand/super_settings) gem for runtime settings, you can enable inline editing of runtime settings directly in the web UI. This adds edit buttons next to runtime settings fields that open a panel for creating or updating settings through the SuperSettings API.
|
|
465
|
+
|
|
466
|
+
To enable editing, set `super_settings_api_path` to the relative URL path where the SuperSettings API is mounted:
|
|
467
|
+
|
|
468
|
+
```ruby
|
|
469
|
+
UltraSettings.super_settings_api_path = "/super_settings"
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
This will automatically set `SuperSettings` as the runtime settings store. The web UI will check the SuperSettings API for edit access on page load by making a HEAD request. If the current user has read-write access (as determined by the SuperSettings authorization layer), edit buttons will appear next to runtime settings fields.
|
|
473
|
+
|
|
474
|
+
All authorization is handled by the SuperSettings API — the same permissions that control the SuperSettings web UI will apply to inline editing in UltraSettings. Configure access control in your `SuperSettings::RackApplication` or Rails controller as usual.
|
|
475
|
+
|
|
476
|
+
> [!IMPORTANT]
|
|
477
|
+
> You will need to have the SuperSettings API mounted and properly locked down with authentication. If the API is not accessible, then the edit buttons will not be shown. Check the browser console for any errors if you expect the buttons to be shown but they are not appearing.
|
|
478
|
+
|
|
479
|
+
##### Embedding with Edit Support
|
|
480
|
+
|
|
481
|
+
When embedding the settings view using `UltraSettings::ApplicationView`, you can pass the `super_settings_api_path` option to enable the inline editing UI:
|
|
482
|
+
|
|
483
|
+
```erb
|
|
484
|
+
<%= UltraSettings::ApplicationView.new(super_settings_api_path: "/super_settings").render %>
|
|
485
|
+
```
|
|
486
|
+
|
|
448
487
|
### Testing With UltraSettings
|
|
449
488
|
|
|
450
489
|
When writing automated tests, you may need to override configuration settings to test different scenarios. UltraSettings provides the `UltraSettings.override!` method to temporarily change settings within a test block. Below are examples of how to override the `TestConfiguration#foo` value in a test.
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.9.0
|
data/app/AGENTS.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Web UI
|
|
2
|
+
|
|
3
|
+
The Web UI is a built-in interface for viewing and editing settings. It is implemented as a Rack application that can be mounted within your existing app or run standalone.
|
|
4
|
+
|
|
5
|
+
The interface is designed so that it can either be used stand alone or embedded within an existing application's layout.
|
|
6
|
+
|
|
7
|
+
All strings diplayed in the UI should referenced using the lightweight translation system and added to all the JSON files in app/locales.
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
<% config_class = configuration.class
|
|
2
2
|
has_config_file = config_class.configuration_file.is_a?(Pathname) && config_class.fields.any?(&:yaml_key) %>
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
<div class="ultra-settings-
|
|
6
|
-
<% if config_class.description %>
|
|
7
|
-
<div class="ultra-settings-description">
|
|
8
|
-
<%= html_escape(config_class.description).gsub("\n", "<br>") %>
|
|
9
|
-
</div>
|
|
10
|
-
<% end %>
|
|
4
|
+
<div class="ultra-settings-config-header">
|
|
5
|
+
<div class="ultra-settings-config-title"><%= html_escape(config_class.name) %></div>
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<code class="ultra-settings-config-file-path">
|
|
19
|
-
<%= html_escape(relative_path(configuration.class.configuration_file)) %>
|
|
20
|
-
</code>
|
|
7
|
+
<% if config_class.description %>
|
|
8
|
+
<div class="ultra-settings-config-desc">
|
|
9
|
+
<%= html_escape(config_class.description).gsub("\n", "<br>") %>
|
|
10
|
+
</div>
|
|
11
|
+
<% end %>
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
<% if has_config_file %>
|
|
14
|
+
<div class="ultra-settings-config-file">
|
|
15
|
+
<% if configuration.class.configuration_file&.exist? %>
|
|
16
|
+
<%= file_icon %>
|
|
17
|
+
<code><%= html_escape(relative_path(configuration.class.configuration_file)) %></code>
|
|
18
|
+
<% else %>
|
|
19
|
+
<span class="ultra-settings-warn">
|
|
20
|
+
<%= warning_icon(13) %>
|
|
21
|
+
<code><%= html_escape(relative_path(configuration.class.configuration_file)) %></code>
|
|
22
|
+
<%= t('config.file_not_found') %>
|
|
23
|
+
</span>
|
|
24
|
+
<% end %>
|
|
25
|
+
</div>
|
|
26
|
+
<% end %>
|
|
27
|
+
</div>
|
data/app/_config_list.html.erb
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<div class="ultra-settings-configuration-summary">
|
|
4
|
-
<a
|
|
5
|
-
href="#<%= html_escape(configuration.class.name) %>"
|
|
6
|
-
class="ultra-settings-configuration-title"
|
|
7
|
-
>
|
|
8
|
-
<%= html_escape(configuration.class.name) %>
|
|
9
|
-
</a>
|
|
10
|
-
|
|
11
|
-
<p><%= html_escape(configuration.class.description) %></p>
|
|
12
|
-
</div>
|
|
13
|
-
<% end %>
|
|
14
|
-
</div>
|
|
1
|
+
<%# This partial is no longer used by the Slate design.
|
|
2
|
+
All configurations are visible at once in the main content area. %>
|
data/app/_data_source.html.erb
CHANGED
|
@@ -1,39 +1,53 @@
|
|
|
1
1
|
<% source_value = configuration.__value_from_source__(field.name, source) %>
|
|
2
|
-
<%
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<% source_label = source_chip_label(source) %>
|
|
3
|
+
<% chip_class = source_chip_class(source) %>
|
|
4
|
+
<% source_name = source_key_name(field, source) %>
|
|
5
|
+
<div class="ultra-settings-source-row<%= ' active' if current_source == source %>">
|
|
6
|
+
<span class="ultra-settings-source-chip <%= chip_class %>"><%= source_label %></span>
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</code>
|
|
13
|
-
<% end %>
|
|
14
|
-
|
|
15
|
-
<%= show_defined_value(source_name, source_value, field.secret?) %>
|
|
16
|
-
</div>
|
|
8
|
+
<% if source_name %>
|
|
9
|
+
<span class="ultra-settings-source-key"><%= html_escape(source_name) %></span>
|
|
10
|
+
<span class="ultra-settings-source-eq">=</span>
|
|
11
|
+
<% end %>
|
|
17
12
|
|
|
18
|
-
<% if
|
|
19
|
-
<span class="ultra-settings-source-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<%
|
|
23
|
-
|
|
13
|
+
<% if source_value.nil? %>
|
|
14
|
+
<span class="ultra-settings-source-val not-set"><%= t('field.not_set') %></span>
|
|
15
|
+
<% elsif field.secret? %>
|
|
16
|
+
<span class="ultra-settings-source-val secret"><%= html_escape(secret_value(source_value)) %></span>
|
|
17
|
+
<% else %>
|
|
18
|
+
<span class="ultra-settings-source-val"><%= html_escape(display_value(source_value)) %></span>
|
|
24
19
|
<% end %>
|
|
25
20
|
|
|
26
21
|
<% if source == :settings %>
|
|
27
|
-
<%
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
<% if defined?(super_settings_api_path) && super_settings_api_path %>
|
|
23
|
+
<button
|
|
24
|
+
type="button"
|
|
25
|
+
class="ultra-settings-edit-link ultra-settings-ss-edit-btn"
|
|
26
|
+
style="display:none"
|
|
27
|
+
title="<%= html_escape(t('config.edit_tooltip').gsub('${name}', field.runtime_setting)) %>"
|
|
28
|
+
data-ss-key="<%= html_escape(field.runtime_setting) %>"
|
|
29
|
+
data-ss-default-type="<%= html_escape(super_settings_value_type(field.type)) %>"
|
|
30
|
+
data-ss-default-description="<%= html_escape(field.description) %>"
|
|
34
31
|
>
|
|
35
|
-
<%= edit_icon %>
|
|
36
|
-
</
|
|
32
|
+
<%= edit_icon(13) %>
|
|
33
|
+
</button>
|
|
34
|
+
<% else %>
|
|
35
|
+
<% edit_url = UltraSettings.runtime_settings_url(name: field.runtime_setting, type: field.type, description: field.description) %>
|
|
36
|
+
<% if edit_url %>
|
|
37
|
+
<a
|
|
38
|
+
href="<%= html_escape(edit_url) %>"
|
|
39
|
+
class="ultra-settings-edit-link"
|
|
40
|
+
title="<%= html_escape(t('config.edit_tooltip').gsub('${name}', field.runtime_setting)) %>"
|
|
41
|
+
>
|
|
42
|
+
<%= edit_icon(13) %>
|
|
43
|
+
</a>
|
|
44
|
+
<% end %>
|
|
37
45
|
<% end %>
|
|
38
46
|
<% end %>
|
|
47
|
+
|
|
48
|
+
<% if current_source == source %>
|
|
49
|
+
<span class="ultra-settings-source-badge ultra-settings-sb-active"><%= t('source.active') %></span>
|
|
50
|
+
<% elsif source_overridden_by(source, current_source) && !source_value.nil? %>
|
|
51
|
+
<span class="ultra-settings-source-badge ultra-settings-sb-overridden"><%= t('source.overridden') %></span>
|
|
52
|
+
<% end %>
|
|
39
53
|
</div>
|