activeadmin_settings_cached 2.3.1 → 3.0.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/.github/stale.yml +17 -0
- data/.github/workflows/ci.yml +27 -0
- data/Appraisals +4 -12
- data/CHANGELOG.md +15 -0
- data/Dockerfile +3 -16
- data/Gemfile +4 -1
- data/Makefile +11 -6
- data/README.md +60 -14
- data/activeadmin_settings_cached.gemspec +3 -6
- data/app/views/admin/settings/_index.html.erb +20 -13
- data/config/locales/de.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/docker-compose.yml +7 -2
- data/gemfiles/{rails4.2.gemfile → rails7.2.gemfile} +3 -2
- data/gemfiles/rails8.0.gemfile +14 -0
- data/lib/activeadmin_settings_cached/dsl.rb +17 -9
- data/lib/activeadmin_settings_cached/engine.rb +0 -3
- data/lib/activeadmin_settings_cached/model.rb +64 -67
- data/lib/activeadmin_settings_cached/options.rb +1 -2
- data/lib/activeadmin_settings_cached/version.rb +1 -1
- data/lib/activeadmin_settings_cached.rb +3 -0
- data/spec/model_spec.rb +75 -120
- data/spec/settings_spec.rb +112 -195
- data/spec/spec_helper.rb +3 -26
- data/spec/support/admin.rb +3 -10
- data/spec/support/rails_template.rb +36 -22
- data/tasks/test.rake +4 -6
- metadata +24 -67
- data/.travis.yml +0 -17
- data/gemfiles/rails5.0.gemfile +0 -15
- data/gemfiles/rails5.1.gemfile +0 -15
- data/lib/activeadmin_settings_cached/coercions.rb +0 -58
- data/spec/coercions_spec.rb +0 -86
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee6c14de48fbbb2c5b92865102c9e924b0653fa9e000c8c16cc60a7b44e857e1
|
|
4
|
+
data.tar.gz: b5a1e74381075692da0aec927cf76a8205c3d26c0964f297a6909652da735008
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ead2b850cf382b950cbe026055405f75a55071a86834b1caafeeb17ce9f52549538c987a32a33a13592ee96e6b448b4b2ef65137544f487e47aee71c205d0c5
|
|
7
|
+
data.tar.gz: dd196049e5aafa3611f7636bf3b56ea9e089c7fb1c4b29600f24fd0cef8bf99d25c9623f923b8decf9ca7da2a5da385e8645bf19e4629c7e97ee037037138207
|
data/.github/stale.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
|
2
|
+
daysUntilStale: 60
|
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
|
4
|
+
daysUntilClose: 7
|
|
5
|
+
# Issues with these labels will never be considered stale
|
|
6
|
+
exemptLabels:
|
|
7
|
+
- pinned
|
|
8
|
+
- security
|
|
9
|
+
# Label to use when marking an issue as stale
|
|
10
|
+
staleLabel: wontfix
|
|
11
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
12
|
+
markComment: >
|
|
13
|
+
This issue has been automatically marked as stale because it has not had
|
|
14
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
|
15
|
+
for your contributions.
|
|
16
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
17
|
+
closeComment: false
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
ruby: ['3.2', '3.3', '3.4']
|
|
15
|
+
gemfile: [rails7.2, rails8.0]
|
|
16
|
+
env:
|
|
17
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: ruby/setup-ruby@v1
|
|
21
|
+
with:
|
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
|
23
|
+
bundler-cache: true
|
|
24
|
+
- name: Create test app
|
|
25
|
+
run: bundle exec rake setup
|
|
26
|
+
- name: Run specs
|
|
27
|
+
run: bundle exec rake
|
data/Appraisals
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
appraise '
|
|
4
|
-
gem 'rails', '~>
|
|
3
|
+
appraise 'rails7.2' do
|
|
4
|
+
gem 'rails', '~> 7.2.0'
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
appraise '
|
|
8
|
-
gem 'rails', '~>
|
|
9
|
-
gem 'inherited_resources', git: 'https://github.com/activeadmin/inherited_resources.git'
|
|
10
|
-
gem 'listen'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
appraise 'rails5.1' do
|
|
14
|
-
gem 'rails', '~> 5.1.0'
|
|
15
|
-
gem 'inherited_resources', git: 'https://github.com/activeadmin/inherited_resources.git'
|
|
16
|
-
gem 'listen'
|
|
7
|
+
appraise 'rails8.0' do
|
|
8
|
+
gem 'rails', '~> 8.0.0'
|
|
17
9
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# v3.0.0 2026-10-31
|
|
2
|
+
|
|
3
|
+
## Changed
|
|
4
|
+
|
|
5
|
+
- Support rails-settings-cached v2 (`>= 2.8.2`), drop support for older versions
|
|
6
|
+
- Show editable fields grouped by scope, input depends on field type
|
|
7
|
+
- Values are coerced by rails-settings-cached, `Coercions` is removed
|
|
8
|
+
- Save only changed values
|
|
9
|
+
- Show validation errors in flash
|
|
10
|
+
- Test against Rails 7.2 and 8.0 on GitHub Actions, remove Travis CI
|
|
11
|
+
|
|
12
|
+
## Removed
|
|
13
|
+
|
|
14
|
+
- `starting_with` and `key` options, use `scope` option instead
|
|
15
|
+
|
|
1
16
|
# v2.3.1 2018-05-22
|
|
2
17
|
|
|
3
18
|
## Changed
|
data/Dockerfile
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
FROM ruby:
|
|
2
|
-
|
|
3
|
-
ENV PHANTOMJS_VERSION 1.9.8
|
|
1
|
+
FROM ruby:3.4-slim
|
|
4
2
|
|
|
5
3
|
RUN apt-get update -qq && \
|
|
6
4
|
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
|
|
@@ -8,19 +6,8 @@ RUN apt-get update -qq && \
|
|
|
8
6
|
gcc \
|
|
9
7
|
g++ \
|
|
10
8
|
libsqlite3-dev \
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
libfreetype6 \
|
|
14
|
-
libfontconfig \
|
|
15
|
-
bzip2 && \
|
|
9
|
+
libyaml-dev \
|
|
10
|
+
git-core && \
|
|
16
11
|
apt-get clean
|
|
17
12
|
|
|
18
|
-
RUN \
|
|
19
|
-
wget -q --no-check-certificate -O /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 && \
|
|
20
|
-
mkdir -p /srv/var && \
|
|
21
|
-
tar -xjf /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C /tmp && \
|
|
22
|
-
rm -f /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 && \
|
|
23
|
-
mv /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/ /srv/var/phantomjs && \
|
|
24
|
-
ln -s /srv/var/phantomjs/bin/phantomjs /usr/bin/phantomjs
|
|
25
|
-
|
|
26
13
|
WORKDIR /app
|
data/Gemfile
CHANGED
data/Makefile
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
RUN := run --rm
|
|
1
|
+
RUN := run --rm --service-ports
|
|
2
2
|
DOCKER_COMPOSE_RUN := docker-compose $(RUN)
|
|
3
3
|
|
|
4
4
|
default: test
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
bash:
|
|
7
7
|
${DOCKER_COMPOSE_RUN} app bash
|
|
8
8
|
|
|
9
|
-
rake:
|
|
10
|
-
bundle exec rake ${T}
|
|
11
|
-
|
|
12
9
|
test: appraisals
|
|
13
10
|
bundle exec appraisal rspec ${T}
|
|
14
11
|
|
|
15
12
|
appraisals: setup
|
|
16
13
|
bundle exec appraisal install
|
|
17
14
|
|
|
15
|
+
appraisals-generate:
|
|
16
|
+
bundle exec appraisal generate
|
|
17
|
+
|
|
18
|
+
|
|
18
19
|
setup:
|
|
19
|
-
gem install bundler
|
|
20
|
+
gem install bundler
|
|
20
21
|
bundle check || bundle install -j 2
|
|
22
|
+
bundle exec appraisal rake setup
|
|
23
|
+
|
|
24
|
+
down:
|
|
25
|
+
docker-compose down
|
|
21
26
|
|
|
22
27
|
clean:
|
|
23
28
|
rm -f Gemfile.lock
|
data/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Activeadmin Settings Cached
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/activeadmin_settings_cached)
|
|
4
|
-
[](https://gemnasium.com/github.com/artofhuman/activeadmin_settings_cached)
|
|
6
|
-
[](https://coveralls.io/github/artofhuman/activeadmin_settings_cached?branch=master)
|
|
4
|
+
[](https://github.com/artofhuman/activeadmin_settings_cached/actions/workflows/ci.yml)
|
|
7
5
|
|
|
8
6
|
Provides a nice UI interface for [rails-settings-cached](https://github.com/huacnlee/rails-settings-cached) gem in [Active Admin](http://activeadmin.info/).
|
|
9
7
|
|
|
8
|
+
Version 3 supports rails-settings-cached v2 (`>= 2.8.2`). For rails-settings-cached `< 0.6.7` use version 2.x of this gem.
|
|
9
|
+
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
12
|
Add this line to your application's Gemfile:
|
|
@@ -26,9 +26,9 @@ Create your settings model:
|
|
|
26
26
|
|
|
27
27
|
Create your settings page:
|
|
28
28
|
|
|
29
|
-
# From generators
|
|
30
|
-
$ rails g active_admin:settings Setting
|
|
31
|
-
|
|
29
|
+
# From generators
|
|
30
|
+
$ rails g active_admin:settings Setting
|
|
31
|
+
|
|
32
32
|
# Or manual
|
|
33
33
|
|
|
34
34
|
``` ruby
|
|
@@ -43,15 +43,38 @@ ActiveAdmin.register_page 'Setting' do
|
|
|
43
43
|
end
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
And
|
|
46
|
+
And define your fields in your Setting model:
|
|
47
47
|
|
|
48
48
|
``` ruby
|
|
49
|
-
class
|
|
50
|
-
|
|
49
|
+
class Setting < RailsSettings::Base
|
|
50
|
+
field :app_name, default: 'My app'
|
|
51
|
+
|
|
52
|
+
scope :mail do
|
|
53
|
+
field :admin_emails, type: :array, default: %w[admin@example.com]
|
|
54
|
+
field :notifications_enabled, type: :boolean, default: true
|
|
55
|
+
field :default_locale, default: 'en', option_values: %w[en de ru], help_text: 'Language of emails'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
field :api_key, default: ENV['API_KEY'], readonly: true
|
|
51
59
|
end
|
|
52
60
|
```
|
|
53
61
|
|
|
54
|
-
In your application's admin interface, there will now be a new page with
|
|
62
|
+
In your application's admin interface, there will now be a new page with these settings.
|
|
63
|
+
|
|
64
|
+
Every editable field is shown. Readonly fields are not shown. Fields are grouped by `scope`.
|
|
65
|
+
The input depends on the field `type`:
|
|
66
|
+
|
|
67
|
+
Type | Input
|
|
68
|
+
---------------------------------- | -----
|
|
69
|
+
`:string` | text field
|
|
70
|
+
`:integer`, `:float`, `:big_decimal` | number field
|
|
71
|
+
`:boolean` | checkbox
|
|
72
|
+
`:array` | textarea, one value per line
|
|
73
|
+
`:hash` | textarea with YAML
|
|
74
|
+
|
|
75
|
+
A field with `option_values` is shown as a select. A field with `help_text` shows it as a hint.
|
|
76
|
+
Validation errors from `validates` are shown in the flash message.
|
|
77
|
+
Only changed values are saved, so unchanged fields keep their default value.
|
|
55
78
|
|
|
56
79
|
## active_admin_settings_page DSL
|
|
57
80
|
|
|
@@ -68,14 +91,20 @@ end
|
|
|
68
91
|
Tool | Description
|
|
69
92
|
--------------------- | -----------
|
|
70
93
|
:model_name |String, settings model name override (default: uses name from global config.)
|
|
71
|
-
:
|
|
72
|
-
:key |String, Symbol root key, can be replacement for starting_with, (default: nil)
|
|
94
|
+
:scope |Symbol, Array of Symbols, show only fields from these scopes (default: nil, all fields)
|
|
73
95
|
:template |String, custom template rendering (default: 'admin/settings/index')
|
|
74
96
|
:template_object |object passing to view (default: ActiveadminSettingsCached::Model instance)
|
|
75
97
|
:display |Hash, display settings override (default: {})
|
|
76
98
|
:title |String, title value override (default: I18n.t('settings.menu.label'))
|
|
77
99
|
:after_save |Proc, callback for action after POST request, (default: nil)
|
|
78
|
-
|
|
100
|
+
|
|
101
|
+
#### Settings on different pages
|
|
102
|
+
|
|
103
|
+
```ruby
|
|
104
|
+
ActiveAdmin.register_page 'Mail Settings' do
|
|
105
|
+
active_admin_settings_page(scope: :mail, title: 'Mail Settings')
|
|
106
|
+
end
|
|
107
|
+
```
|
|
79
108
|
|
|
80
109
|
## Localization
|
|
81
110
|
You can localize settings keys in local file
|
|
@@ -85,6 +114,8 @@ en:
|
|
|
85
114
|
settings:
|
|
86
115
|
attributes:
|
|
87
116
|
my_awesome_settings: 'My Awesome Localized Setting'
|
|
117
|
+
scopes:
|
|
118
|
+
mail: 'Mail'
|
|
88
119
|
```
|
|
89
120
|
## Model name
|
|
90
121
|
|
|
@@ -98,7 +129,7 @@ end
|
|
|
98
129
|
|
|
99
130
|
## Display options
|
|
100
131
|
|
|
101
|
-
If you need
|
|
132
|
+
If you need to override the input for a field, eg textarea, url or :timestamp and etc., you can set `display` option in initializer.
|
|
102
133
|
|
|
103
134
|
|
|
104
135
|
``` ruby
|
|
@@ -120,3 +151,18 @@ Available options see [here](https://github.com/justinfrench/formtastic#the-avai
|
|
|
120
151
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
121
152
|
4. Push to the branch (`git push origin my-new-feature`)
|
|
122
153
|
5. Create new Pull Request
|
|
154
|
+
|
|
155
|
+
## How run local example
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
make bash
|
|
159
|
+
make setup
|
|
160
|
+
cd spec/rails/rails-8.0.*/
|
|
161
|
+
BUNDLE_GEMFILE=/app/gemfiles/rails8.0.gemfile bundle exec rails s -b 0.0.0.0
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Upgrading from 2.x
|
|
165
|
+
|
|
166
|
+
- Update rails-settings-cached to v2 and define your settings with `field`.
|
|
167
|
+
- `starting_with` and `key` options are removed. Use rails-settings-cached `scope` and the `scope` option.
|
|
168
|
+
- Values are coerced by rails-settings-cached field types. `display` only changes the input.
|
|
@@ -19,17 +19,14 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
|
20
20
|
s.require_paths = ['lib']
|
|
21
21
|
|
|
22
|
-
s.add_dependency 'activeadmin'
|
|
23
|
-
s.add_dependency 'rails-settings-cached', '
|
|
22
|
+
s.add_dependency 'activeadmin', '>= 1.0', '< 4'
|
|
23
|
+
s.add_dependency 'rails-settings-cached', '~> 2.8', '>= 2.8.2'
|
|
24
24
|
|
|
25
25
|
s.add_development_dependency 'appraisal'
|
|
26
26
|
s.add_development_dependency 'bundler'
|
|
27
27
|
s.add_development_dependency 'capybara'
|
|
28
|
-
s.add_development_dependency '
|
|
29
|
-
s.add_development_dependency 'database_cleaner'
|
|
30
|
-
s.add_development_dependency 'poltergeist'
|
|
28
|
+
s.add_development_dependency 'database_cleaner-active_record'
|
|
31
29
|
s.add_development_dependency 'rake'
|
|
32
30
|
s.add_development_dependency 'rspec-rails'
|
|
33
|
-
s.add_development_dependency 'selenium-webdriver'
|
|
34
31
|
s.add_development_dependency 'sqlite3'
|
|
35
32
|
end
|
|
@@ -7,19 +7,26 @@
|
|
|
7
7
|
<th><%= t('settings.index.value')%></th>
|
|
8
8
|
</tr>
|
|
9
9
|
</thead>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<%
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
<% settings_model.fields_by_scope.each_pair do |scope, fields| %>
|
|
11
|
+
<tbody>
|
|
12
|
+
<% if scope %>
|
|
13
|
+
<tr>
|
|
14
|
+
<th colspan="2"><%= t("settings.scopes.#{scope}", default: scope.to_s.humanize) %></th>
|
|
15
|
+
</tr>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% fields.each do |field| %>
|
|
18
|
+
<% key = field[:key] %>
|
|
19
|
+
<tr class="odd">
|
|
20
|
+
<td><strong><%= f.label key, t("settings.attributes.#{key}", default: key) %></strong></td>
|
|
21
|
+
<td>
|
|
22
|
+
<div class='form'>
|
|
23
|
+
<ol><%= f.input key, settings_model.field_options(key) %></ol>
|
|
24
|
+
</div>
|
|
25
|
+
</td>
|
|
26
|
+
</tr>
|
|
27
|
+
<% end %>
|
|
28
|
+
</tbody>
|
|
29
|
+
<% end %>
|
|
23
30
|
</table>
|
|
24
31
|
<%= f.submit %>
|
|
25
32
|
<% end %>
|
data/config/locales/de.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/ru.yml
CHANGED
data/docker-compose.yml
CHANGED
|
@@ -5,8 +5,13 @@ services:
|
|
|
5
5
|
build: '.'
|
|
6
6
|
command: 'make test'
|
|
7
7
|
volumes:
|
|
8
|
-
-
|
|
9
|
-
- bundler-data:/usr/local/bundle
|
|
8
|
+
- .:/app:cached
|
|
9
|
+
- bundler-data:/usr/local/bundle/
|
|
10
|
+
- bin-data:/usr/local/bin/
|
|
11
|
+
ports:
|
|
12
|
+
- "3000:3000"
|
|
13
|
+
|
|
10
14
|
|
|
11
15
|
volumes:
|
|
12
16
|
bundler-data:
|
|
17
|
+
bin-data:
|
|
@@ -8,8 +8,7 @@ module ActiveadminSettingsCached
|
|
|
8
8
|
#
|
|
9
9
|
# @param [Hash] options
|
|
10
10
|
# @option options [String] :model_name, settings model name override (default: uses name from global config.)
|
|
11
|
-
# @option options [
|
|
12
|
-
# @option options [String] :key, root key can be replacement for starting_with, (default: nil)
|
|
11
|
+
# @option options [Symbol, Array<Symbol>] :scope, show only fields from these rails-settings-cached scopes (default: nil)
|
|
13
12
|
# @option options [String] :template custom, template rendering (default: 'admin/settings/index')
|
|
14
13
|
# @option options [String] :template_object, object to use in templates (default: ActiveadminSettingsCached::Model instance)
|
|
15
14
|
# @option options [String] :display, display settings override (default: nil)
|
|
@@ -19,23 +18,32 @@ module ActiveadminSettingsCached
|
|
|
19
18
|
options.assert_valid_keys(*ActiveadminSettingsCached::Options::VALID_OPTIONS)
|
|
20
19
|
|
|
21
20
|
options = ActiveadminSettingsCached::Options.options_for(options)
|
|
22
|
-
coercion =
|
|
23
|
-
ActiveadminSettingsCached::Coercions.new(options[:template_object].defaults, options[:template_object].display)
|
|
24
21
|
|
|
25
22
|
content title: options[:title] do
|
|
26
23
|
render partial: options[:template], locals: { settings_model: options[:template_object] }
|
|
27
24
|
end
|
|
28
25
|
|
|
29
26
|
page_action :update, method: :post do
|
|
30
|
-
|
|
27
|
+
settings_model = options[:template_object]
|
|
28
|
+
settings_params = params.require(:settings).permit(*settings_model.keys)
|
|
29
|
+
errors = []
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
settings_params.each do |key, value|
|
|
32
|
+
next unless settings_model.changed?(key, value)
|
|
33
|
+
|
|
34
|
+
settings_model.save(key, value)
|
|
35
|
+
rescue ActiveRecord::RecordInvalid => e
|
|
36
|
+
errors.concat(e.record.errors.full_messages)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
if errors.any?
|
|
40
|
+
flash[:error] = t('activeadmin_settings_cached.settings.update.error', details: errors.join(', '))
|
|
41
|
+
else
|
|
42
|
+
flash[:success] = t('activeadmin_settings_cached.settings.update.success')
|
|
34
43
|
end
|
|
35
44
|
|
|
36
|
-
flash[:success] = t('activeadmin_settings_cached.settings.update.success'.freeze)
|
|
37
|
-
Rails.version.to_i >= 5 ? redirect_back(fallback_location: admin_root_path) : redirect_to(:back)
|
|
38
45
|
options[:after_save].call if options[:after_save].respond_to?(:call)
|
|
46
|
+
redirect_back(fallback_location: admin_root_path)
|
|
39
47
|
end
|
|
40
48
|
|
|
41
49
|
instance_eval(&block) if block_given?
|
|
@@ -5,9 +5,6 @@ require 'active_admin'
|
|
|
5
5
|
|
|
6
6
|
module ActiveadminSettingsCached
|
|
7
7
|
class Engine < Rails::Engine
|
|
8
|
-
config.mount_at = '/'
|
|
9
|
-
config.autoload_paths += Dir["#{config.root}/lib"]
|
|
10
|
-
|
|
11
8
|
initializer 'activeadmin_settings_cached' do
|
|
12
9
|
::ActiveAdmin::DSL.send(:include, ::ActiveadminSettingsCached::DSL)
|
|
13
10
|
end
|