activeadmin_settings_cached 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +11 -0
- data/Gemfile +5 -1
- data/README.md +35 -8
- data/Rakefile +6 -1
- data/activeadmin_settings_cached.gemspec +9 -1
- data/app/views/admin/settings/_index.html.erb +4 -4
- data/lib/activeadmin_settings_cached.rb +1 -19
- data/lib/activeadmin_settings_cached/coercions.rb +60 -0
- data/lib/activeadmin_settings_cached/dsl.rb +37 -0
- data/lib/activeadmin_settings_cached/engine.rb +5 -5
- data/lib/activeadmin_settings_cached/model.rb +101 -0
- data/lib/activeadmin_settings_cached/options.rb +21 -0
- data/lib/activeadmin_settings_cached/version.rb +1 -1
- data/lib/generators/active_admin/settings/USAGE +8 -0
- data/lib/generators/active_admin/settings/settings_generator.rb +11 -0
- data/lib/generators/active_admin/settings/templates/settings.rb +5 -0
- data/spec/coercions_spec.rb +42 -0
- data/spec/model_spec.rb +15 -0
- data/spec/settings_spec.rb +179 -0
- data/spec/spec_helper.rb +65 -0
- data/spec/support/admin.rb +26 -0
- data/spec/support/rails_template.rb +20 -0
- data/tasks/test.rake +22 -0
- metadata +125 -10
- data/app/admin/settings.rb +0 -13
- data/app/controllers/activeadmin_settings_cached/settings_controller.rb +0 -22
- data/app/helpers/settings_helper.rb +0 -20
- data/config/routes.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9f431cda46f273c027277f759dd4072f57a74c8
|
4
|
+
data.tar.gz: 532fbe14c373077e49bb431db5702836429e7d9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f3d082e1f588e1f86207b1efe3dd4f0971fcef11862418fc41adc61bb1a71991fd1b6bf07af6f1f06da491a6c5b300fcda417149406f08fd410cc66123cdf5b
|
7
|
+
data.tar.gz: a9911d042145d5f126ee0faf578650615a971e5ac9bdead4cab311e84bcd7dbe50a54e9da9bfe68cb3c82289d2f47a96420333882c6b467293663d2956a31746
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
3
|
+
group :test do
|
4
|
+
#gem 'turbolinks'
|
5
|
+
gem 'activeadmin', github: 'activeadmin/activeadmin', branch: 'ab1d8d1a4a1af748ae7009d9d725193d780d0059'
|
6
|
+
end
|
7
|
+
|
4
8
|
gemspec
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Activeadmin Settings Cached
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/activeadmin_settings_cached.svg)](http://badge.fury.io/rb/activeadmin_settings_cached)
|
4
|
+
[![Build Status](https://travis-ci.org/artofhuman/activeadmin_settings_cached.svg?branch=master)](https://travis-ci.org/artofhuman/activeadmin_settings_cached)
|
4
5
|
|
5
6
|
Provides a nice UI interface for [rails-settings-cached](https://github.com/huacnlee/rails-settings-cached) gem in [Active Admin](http://activeadmin.info/).
|
6
7
|
|
@@ -21,12 +22,9 @@ Create your settings model:
|
|
21
22
|
$ rails g settings Settings
|
22
23
|
$ bundle exec rake db:migrate
|
23
24
|
|
24
|
-
|
25
|
+
Create your settings page:
|
25
26
|
|
26
|
-
|
27
|
-
ActiveAdmin.routes(self)
|
28
|
-
mount ActiveadminSettingsCached::Engine => '/admin'
|
29
|
-
```
|
27
|
+
$ rails g active_admin:settings Settings
|
30
28
|
|
31
29
|
And configure your default values in your Settings model:
|
32
30
|
|
@@ -38,6 +36,28 @@ end
|
|
38
36
|
|
39
37
|
In your application's admin interface, there will now be a new page with this setting
|
40
38
|
|
39
|
+
## active_admin_settings_page DSL
|
40
|
+
|
41
|
+
#### Basic usage
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
ActiveAdmin.register_page 'Settings' do
|
45
|
+
menu label: 'Settings', priority: 99
|
46
|
+
active_admin_settings_page options
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
#### Options
|
51
|
+
Tool | Description
|
52
|
+
--------------------- | -----------
|
53
|
+
:model_name |String, settings model name override (default: uses name from global config.)
|
54
|
+
:starting_with |String, each key must starting with, (default: nil)
|
55
|
+
:template |String, custom template rendering (default: 'admin/settings/index')
|
56
|
+
:template_object |object passing to view (default: ActiveadminSettingsCached::Model instance)
|
57
|
+
:display |Hash, display settings override (default: {})
|
58
|
+
:title |String, title value override (default: I18n.t('settings.menu.label'))
|
59
|
+
|
60
|
+
|
41
61
|
## Localization
|
42
62
|
You can localize settings keys in local file
|
43
63
|
|
@@ -45,8 +65,7 @@ You can localize settings keys in local file
|
|
45
65
|
en:
|
46
66
|
settings:
|
47
67
|
attributes:
|
48
|
-
my_awesome_settings:
|
49
|
-
name: 'My Awesome Lolaized Setting'
|
68
|
+
my_awesome_settings: 'My Awesome Lolaized Setting'
|
50
69
|
```
|
51
70
|
## Model name
|
52
71
|
|
@@ -65,7 +84,7 @@ If you need define display options for settings fields, eg textarea, url or :tim
|
|
65
84
|
|
66
85
|
``` ruby
|
67
86
|
ActiveadminSettingsCached.configure do |config|
|
68
|
-
|
87
|
+
config.display = {
|
69
88
|
my_awesome_setting_name: :text,
|
70
89
|
my_awesome_setting_name_2: :timestamp,
|
71
90
|
my_awesome_setting_name_3: :select
|
@@ -74,3 +93,11 @@ end
|
|
74
93
|
```
|
75
94
|
|
76
95
|
Available options see [here](https://github.com/justinfrench/formtastic#the-available-inputs)
|
96
|
+
|
97
|
+
## Contributing
|
98
|
+
|
99
|
+
1. Fork it
|
100
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
101
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
102
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
103
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -19,8 +19,16 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
s.add_dependency 'activeadmin'
|
22
|
-
s.add_dependency 'rails-settings-cached'
|
22
|
+
s.add_dependency 'rails-settings-cached', '>= 0.5.3'
|
23
23
|
|
24
24
|
s.add_development_dependency "bundler"
|
25
25
|
s.add_development_dependency "rake"
|
26
|
+
s.add_development_dependency "coveralls"
|
27
|
+
|
28
|
+
s.add_development_dependency "database_cleaner"
|
29
|
+
s.add_development_dependency "sqlite3"
|
30
|
+
s.add_development_dependency "rspec-rails"
|
31
|
+
s.add_development_dependency "capybara"
|
32
|
+
s.add_development_dependency "selenium-webdriver"
|
33
|
+
s.add_development_dependency "poltergeist"
|
26
34
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div>
|
2
|
-
<%= semantic_form_for :settings, :method => :
|
2
|
+
<%= semantic_form_for :settings, :method => :post, url: {action: :update} do |f| %>
|
3
3
|
<table id="settings" class="index_table index">
|
4
4
|
<thead>
|
5
5
|
<tr>
|
@@ -8,12 +8,12 @@
|
|
8
8
|
</tr>
|
9
9
|
</thead>
|
10
10
|
<tbody>
|
11
|
-
<%
|
11
|
+
<% settings_model.settings.each_pair do |name, _| %>
|
12
12
|
<tr class="odd">
|
13
|
-
<td><strong><%= f.label t("settings.attributes.#{name}
|
13
|
+
<td><strong><%= f.label t("settings.attributes.#{name}", default: name) %></strong></td>
|
14
14
|
<td>
|
15
15
|
<div class='form'>
|
16
|
-
<ol><%= f.input name,
|
16
|
+
<ol><%= f.input name, settings_model.field_options(name) %></ol>
|
17
17
|
</div>
|
18
18
|
</td>
|
19
19
|
</tr>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'activeadmin_settings_cached/engine'
|
2
2
|
|
3
3
|
module ActiveadminSettingsCached
|
4
4
|
class Configuration
|
@@ -21,23 +21,5 @@ module ActiveadminSettingsCached
|
|
21
21
|
def configure
|
22
22
|
yield config
|
23
23
|
end
|
24
|
-
|
25
|
-
def settings
|
26
|
-
defaults.merge! config.model_name.public_send(meth)
|
27
|
-
end
|
28
|
-
|
29
|
-
def defaults
|
30
|
-
config.model_name.defaults
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def meth
|
36
|
-
if Rails.version >= '4.1.0'
|
37
|
-
:get_all
|
38
|
-
else
|
39
|
-
:all
|
40
|
-
end
|
41
|
-
end
|
42
24
|
end
|
43
25
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module ActiveadminSettingsCached
|
2
|
+
class Coercions
|
3
|
+
SIMPLE_COERCIONS = {
|
4
|
+
float: :to_f,
|
5
|
+
integer: :to_i,
|
6
|
+
symbol: :to_sym
|
7
|
+
}
|
8
|
+
attr_reader :defaults, :display
|
9
|
+
|
10
|
+
def initialize(defaults, display)
|
11
|
+
@defaults = defaults
|
12
|
+
@display = display
|
13
|
+
|
14
|
+
init_methods
|
15
|
+
end
|
16
|
+
|
17
|
+
def cast_params(params)
|
18
|
+
coerced_params = params.map do |name, value|
|
19
|
+
[name, cast_value(name, value)]
|
20
|
+
end
|
21
|
+
|
22
|
+
return coerced_params unless block_given?
|
23
|
+
|
24
|
+
coerced_params.each do |name, value|
|
25
|
+
yield(name, value.call)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def coerce(m, &block)
|
32
|
+
define_singleton_method :"string_to_#{m.to_s}", &block
|
33
|
+
end
|
34
|
+
|
35
|
+
def init_methods
|
36
|
+
coerce :boolean do |value|
|
37
|
+
value && %w(true 1 yes y t).include?(value)
|
38
|
+
end
|
39
|
+
|
40
|
+
SIMPLE_COERCIONS.each do |k, v|
|
41
|
+
coerce(k) { |value| String(value).send(v) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def cast_value(name, value)
|
46
|
+
case defaults[name]
|
47
|
+
when TrueClass, FalseClass
|
48
|
+
display[name].to_s == 'boolean' ? -> { string_to_boolean(value) } : -> { value }
|
49
|
+
when Integer
|
50
|
+
-> { string_to_integer(value) }
|
51
|
+
when Float
|
52
|
+
-> { string_to_float(value) }
|
53
|
+
when Symbol
|
54
|
+
-> { string_to_symbol(value) }
|
55
|
+
else
|
56
|
+
-> { value }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module ActiveadminSettingsCached
|
2
|
+
module DSL
|
3
|
+
# Declares settings function
|
4
|
+
#
|
5
|
+
# Options:
|
6
|
+
# +model_name+:: settings model name override (default: uses name from global config.)
|
7
|
+
# +starting_with+:: each key must starting with, (default: nil)
|
8
|
+
# +template+:: custom template rendering (default: 'admin/settings/index')
|
9
|
+
# +template_object+:: object to use in templates (default: ActiveadminSettingsCached::Model instance)
|
10
|
+
# +display+:: display settings override (default: nil)
|
11
|
+
# +title+:: title value override (default: I18n.t('settings.menu.label'))
|
12
|
+
#
|
13
|
+
def active_admin_settings_page(options = {}, &block)
|
14
|
+
options.assert_valid_keys(*Options::VALID_OPTIONS)
|
15
|
+
|
16
|
+
options = Options.options_for(options)
|
17
|
+
coercion = Coercions.new(options[:template_object].defaults, options[:template_object].display)
|
18
|
+
|
19
|
+
content title: options[:title] do
|
20
|
+
render partial: options[:template], locals: { settings_model: options[:template_object] }
|
21
|
+
end
|
22
|
+
|
23
|
+
page_action :update, method: :post do
|
24
|
+
settings_params = params.require(:settings).permit(options[:template_object].defaults.keys)
|
25
|
+
|
26
|
+
coercion.cast_params(settings_params) do |name, value|
|
27
|
+
options[:template_object][name] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
flash[:success] = t('activeadmin_settings_cached.settings.update.success'.freeze)
|
31
|
+
redirect_to :back
|
32
|
+
end
|
33
|
+
|
34
|
+
instance_eval(&block) if block_given?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'rails-settings-cached'
|
2
|
+
require 'active_admin'
|
2
3
|
|
3
4
|
module ActiveadminSettingsCached
|
4
5
|
class Engine < Rails::Engine
|
5
|
-
|
6
|
+
config.mount_at = '/'
|
7
|
+
config.autoload_paths += Dir["#{config.root}/lib"]
|
6
8
|
|
7
|
-
initializer 'activeadmin_settings_cached
|
8
|
-
ActiveAdmin.
|
9
|
-
app.load_paths << File.expand_path("../../../app/admin", __FILE__)
|
10
|
-
end
|
9
|
+
initializer 'activeadmin_settings_cached' do
|
10
|
+
ActiveAdmin::DSL.send(:include, ActiveadminSettingsCached::DSL)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
module ActiveadminSettingsCached
|
2
|
+
class Model
|
3
|
+
include ActiveModel::Model
|
4
|
+
|
5
|
+
attr_reader :attributes
|
6
|
+
|
7
|
+
def initialize(args = {})
|
8
|
+
@attributes = {}
|
9
|
+
args[:model_name] = args[:model_name].constantize if args[:model_name].is_a? String
|
10
|
+
args[:display] = default_attributes[:display].merge!(args[:display]) if args[:display]
|
11
|
+
assign_attributes(merge_attributes(args))
|
12
|
+
end
|
13
|
+
|
14
|
+
def field_options(settings_name)
|
15
|
+
default_value = defaults[settings_name]
|
16
|
+
value = settings[settings_name]
|
17
|
+
|
18
|
+
input_opts = if default_value.is_a?(Array)
|
19
|
+
{
|
20
|
+
collection: default_value,
|
21
|
+
selected: value,
|
22
|
+
}
|
23
|
+
elsif (default_value.is_a?(TrueClass) || default_value.is_a?(FalseClass)) &&
|
24
|
+
display[settings_name].to_s == 'boolean'
|
25
|
+
{
|
26
|
+
input_html: { checked: value }, label: '', checked_value: 'true', unchecked_value: 'false'
|
27
|
+
}
|
28
|
+
else
|
29
|
+
{
|
30
|
+
input_html: { value: value, placeholder: default_value },
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
{ as: display[settings_name], label: false }
|
35
|
+
.merge!(input_opts)
|
36
|
+
end
|
37
|
+
|
38
|
+
def settings
|
39
|
+
data = load_settings
|
40
|
+
ActiveSupport::OrderedHash[data.to_a.sort { |a, b| a.first <=> b.first }] if data
|
41
|
+
end
|
42
|
+
|
43
|
+
def defaults
|
44
|
+
settings_model.defaults
|
45
|
+
end
|
46
|
+
|
47
|
+
def display
|
48
|
+
attributes[:display]
|
49
|
+
end
|
50
|
+
|
51
|
+
def [](param)
|
52
|
+
settings_model[param]
|
53
|
+
end
|
54
|
+
|
55
|
+
def []=(param, value)
|
56
|
+
settings_model[param] = value
|
57
|
+
end
|
58
|
+
|
59
|
+
def persisted?
|
60
|
+
false
|
61
|
+
end
|
62
|
+
|
63
|
+
alias_method :to_hash, :attributes
|
64
|
+
|
65
|
+
protected
|
66
|
+
|
67
|
+
def load_settings
|
68
|
+
settings_model.public_send(meth, attributes[:starting_with])
|
69
|
+
end
|
70
|
+
|
71
|
+
def assign_attributes(args = {})
|
72
|
+
@attributes.merge!(args)
|
73
|
+
end
|
74
|
+
|
75
|
+
def default_attributes
|
76
|
+
{
|
77
|
+
starting_with: nil,
|
78
|
+
model_name: ActiveadminSettingsCached.config.model_name,
|
79
|
+
display: ActiveadminSettingsCached.config.display
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
def merge_attributes(args)
|
84
|
+
default_attributes.each_with_object({}) do |(k, v), h|
|
85
|
+
h[k] = args[k] || v
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def settings_model
|
90
|
+
attributes[:model_name]
|
91
|
+
end
|
92
|
+
|
93
|
+
def meth
|
94
|
+
if Rails.version >= '4.1.0'
|
95
|
+
:get_all
|
96
|
+
else
|
97
|
+
:all
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ActiveadminSettingsCached
|
2
|
+
module Options
|
3
|
+
VALID_OPTIONS = [
|
4
|
+
:model_name,
|
5
|
+
:starting_with,
|
6
|
+
:template,
|
7
|
+
:template_object,
|
8
|
+
:display,
|
9
|
+
:title
|
10
|
+
].freeze
|
11
|
+
|
12
|
+
def self.options_for(options = {})
|
13
|
+
options[:template_object] = ActiveadminSettingsCached::Model.new(options) unless options[:template_object]
|
14
|
+
|
15
|
+
{
|
16
|
+
template: 'admin/settings/index',
|
17
|
+
title: I18n.t('settings.menu.label')
|
18
|
+
}.deep_merge(options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ActiveadminSettingsCached
|
2
|
+
module Generators
|
3
|
+
class SettingsGenerator < Rails::Generators::NamedBase
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def generate_config_file
|
7
|
+
template 'settings.rb', "app/admin/#{file_path.tr('/', '_')}.rb"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe ActiveadminSettingsCached::Coercions do
|
4
|
+
let(:display) { Hash['base.first_setting' => 'string', 'base.second_setting' => 'boolean',
|
5
|
+
'base.third_setting' => 'number', 'base.four_setting' => 'number',
|
6
|
+
'second.first_setting' => 'boolean', 'second.second_setting' => 'string'].with_indifferent_access }
|
7
|
+
let(:defaults) { Hash['base.first_setting' => 'AAA', 'base.second_setting' => true, 'base.third_setting' => 5,
|
8
|
+
'base.four_setting' => 5.5, 'base.five_setting' => :aaa, 'second.first_setting' => false,
|
9
|
+
'second.second_setting' => 'BBB'].with_indifferent_access }
|
10
|
+
let(:right_params) { ActionController::Parameters.new(Hash['base.first_setting' => 'BBB', 'base.second_setting' => 'false', 'base.third_setting' => '155',
|
11
|
+
'base.four_setting' => '55.5', 'base.five_setting' => 'bbb', 'second.first_setting' => 'true',
|
12
|
+
'second.second_setting' => 'AAA']) }
|
13
|
+
let(:wrong_params) { ActionController::Parameters.new(Hash['base.second_setting' => 'hjgj', 'base.third_setting' => 'fhfh',
|
14
|
+
'base.four_setting' => 'gjfhg', 'second.first_setting' => 'ggf']) }
|
15
|
+
let(:no_params) { ActionController::Parameters.new(Hash[]) }
|
16
|
+
|
17
|
+
before do
|
18
|
+
@coercions = ActiveadminSettingsCached::Coercions.new(defaults, display)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'when good params' do
|
22
|
+
expect { |b|
|
23
|
+
@coercions.cast_params right_params, &b
|
24
|
+
}.to yield_successive_args(['base.first_setting', 'BBB'], ['base.second_setting', false],
|
25
|
+
['base.third_setting', 155], ['base.four_setting', 55.5],
|
26
|
+
['base.five_setting', :bbb], ['second.first_setting', true],
|
27
|
+
['second.second_setting', 'AAA'])
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'when wrong params' do
|
31
|
+
expect { |b|
|
32
|
+
@coercions.cast_params wrong_params, &b
|
33
|
+
}.to yield_successive_args(['base.second_setting', false], ['base.third_setting', 0],
|
34
|
+
['base.four_setting', 0.0], ['second.first_setting', false])
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'when no params' do
|
38
|
+
expect { |b|
|
39
|
+
@coercions.cast_params no_params, &b
|
40
|
+
}.not_to yield_control
|
41
|
+
end
|
42
|
+
end
|
data/spec/model_spec.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe ActiveadminSettingsCached::Model do
|
4
|
+
include ActiveModel::Lint::Tests
|
5
|
+
|
6
|
+
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
|
7
|
+
example m.gsub('_',' ') do
|
8
|
+
send m
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def model
|
13
|
+
subject
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'settings', type: :feature, js: true do
|
4
|
+
before do
|
5
|
+
Setting.defaults['base.first_setting'] = 'AAA'
|
6
|
+
Setting.defaults['base.second_setting'] = true
|
7
|
+
Setting.defaults['base.third_setting'] = 5
|
8
|
+
Setting.defaults['base.four_setting'] = 5.50
|
9
|
+
Setting.defaults['base.five_setting'] = :aaa
|
10
|
+
Setting.defaults['second.first_setting'] = false
|
11
|
+
Setting.defaults['second.second_setting'] = 'BBB'
|
12
|
+
Setting['base.first_setting'] = 'AAA'
|
13
|
+
Setting['base.second_setting'] = true
|
14
|
+
Setting['second.first_setting'] = false
|
15
|
+
Setting['second.second_setting'] = 'BBB'
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'global config' do
|
19
|
+
before do
|
20
|
+
ActiveadminSettingsCached.configure do |config|
|
21
|
+
config.display = {'base.first_setting' => 'string', 'base.second_setting' => 'boolean',
|
22
|
+
'base.third_setting' => 'number', 'base.four_setting' => 'number',
|
23
|
+
'second.first_setting' => 'boolean', 'second.second_setting' => 'string'}
|
24
|
+
end
|
25
|
+
add_setting_resource
|
26
|
+
add_second_setting_resource
|
27
|
+
add_all_setting_resource
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'all setting index' do
|
31
|
+
it 'when list' do
|
32
|
+
visit '/admin/settings'
|
33
|
+
check_base_setting
|
34
|
+
check_second_setting
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'when save' do
|
38
|
+
visit '/admin/settings'
|
39
|
+
check_base_setting
|
40
|
+
check_second_setting
|
41
|
+
fill_base_setting
|
42
|
+
fill_second_setting
|
43
|
+
submit
|
44
|
+
fill_base_setting_check
|
45
|
+
fill_second_setting_check
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'with custom template_object' do
|
51
|
+
context 'when right object' do
|
52
|
+
before do
|
53
|
+
template_object = ActiveadminSettingsCached::Model.new(display: {'base.first_setting' => 'string', 'base.second_setting' => 'boolean',
|
54
|
+
'base.third_setting' => 'number', 'base.four_setting' => 'number',
|
55
|
+
'second.first_setting' => 'boolean', 'second.second_setting' => 'string'})
|
56
|
+
add_all_setting_resource(template_object: template_object)
|
57
|
+
end
|
58
|
+
|
59
|
+
it do
|
60
|
+
visit '/admin/base_settings'
|
61
|
+
check_base_setting
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when wrong object' do
|
66
|
+
before do
|
67
|
+
template_object = nil
|
68
|
+
add_all_setting_resource(template_object: template_object)
|
69
|
+
end
|
70
|
+
|
71
|
+
it do
|
72
|
+
visit '/admin/base_settings'
|
73
|
+
check_base_setting
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'per page' do
|
79
|
+
before do
|
80
|
+
ActiveadminSettingsCached.configure do |config|
|
81
|
+
config.display = {}
|
82
|
+
end
|
83
|
+
add_setting_resource(display: {'base.first_setting' => 'string', 'base.second_setting' => 'boolean',
|
84
|
+
'base.third_setting' => 'number', 'base.four_setting' => 'number'})
|
85
|
+
add_second_setting_resource(display: {'second.first_setting' => 'boolean', 'second.second_setting' => 'string'})
|
86
|
+
add_all_setting_resource(display: {'base.first_setting' => 'string', 'base.second_setting' => 'boolean',
|
87
|
+
'base.third_setting' => 'number', 'base.four_setting' => 'number',
|
88
|
+
'second.first_setting' => 'boolean', 'second.second_setting' => 'string'})
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'setting index' do
|
92
|
+
it 'when list' do
|
93
|
+
visit '/admin/base_settings'
|
94
|
+
check_base_setting
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'when save' do
|
98
|
+
visit '/admin/base_settings'
|
99
|
+
check_base_setting
|
100
|
+
fill_base_setting
|
101
|
+
submit
|
102
|
+
fill_base_setting_check
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'second setting index' do
|
107
|
+
it 'when list' do
|
108
|
+
visit '/admin/second_settings'
|
109
|
+
check_second_setting
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'when save' do
|
113
|
+
visit '/admin/second_settings'
|
114
|
+
check_second_setting
|
115
|
+
fill_second_setting
|
116
|
+
submit
|
117
|
+
fill_second_setting_check
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'all setting index' do
|
122
|
+
it 'when list' do
|
123
|
+
visit '/admin/settings'
|
124
|
+
check_base_setting
|
125
|
+
check_second_setting
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'when save' do
|
129
|
+
visit '/admin/settings'
|
130
|
+
check_base_setting
|
131
|
+
check_second_setting
|
132
|
+
fill_base_setting
|
133
|
+
fill_second_setting
|
134
|
+
submit
|
135
|
+
fill_base_setting_check
|
136
|
+
fill_second_setting_check
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def check_base_setting
|
142
|
+
expect(page).to have_selector("input[value='#{Setting['base.first_setting']}']")
|
143
|
+
end
|
144
|
+
|
145
|
+
def check_second_setting
|
146
|
+
expect(page).to have_selector("input[value='#{Setting['second.second_setting']}']")
|
147
|
+
end
|
148
|
+
|
149
|
+
def fill_base_setting
|
150
|
+
fill_in('settings_base.first_setting', with: 'BBB')
|
151
|
+
uncheck('settings_base.second_setting')
|
152
|
+
fill_in('settings_base.third_setting', with: 100)
|
153
|
+
fill_in('settings_base.four_setting', with: 150.55)
|
154
|
+
fill_in('settings_base.five_setting', with: 'bbb')
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
def fill_second_setting
|
159
|
+
fill_in('settings_second.second_setting', with: 'AAA')
|
160
|
+
check('settings_second.first_setting')
|
161
|
+
end
|
162
|
+
|
163
|
+
def fill_base_setting_check
|
164
|
+
expect(Setting['base.first_setting']).to eq 'BBB'
|
165
|
+
expect(Setting['base.second_setting']).to eq false
|
166
|
+
expect(Setting['base.third_setting']).to eq 100
|
167
|
+
expect(Setting['base.four_setting']).to eq 150.55
|
168
|
+
expect(Setting['base.five_setting']).to eq :bbb
|
169
|
+
end
|
170
|
+
|
171
|
+
def fill_second_setting_check
|
172
|
+
expect(Setting['second.second_setting']).to eq 'AAA'
|
173
|
+
expect(Setting['second.first_setting']).to eq true
|
174
|
+
end
|
175
|
+
|
176
|
+
def submit
|
177
|
+
click_on('Save Settings')
|
178
|
+
end
|
179
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'database_cleaner'
|
2
|
+
|
3
|
+
require 'coveralls'
|
4
|
+
Coveralls.wear!
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
+
$LOAD_PATH << File.expand_path('../support', __FILE__)
|
8
|
+
|
9
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
|
10
|
+
require 'bundler'
|
11
|
+
Bundler.setup
|
12
|
+
|
13
|
+
ENV['RAILS_ENV'] = 'test'
|
14
|
+
# Ensure the Active Admin load path is happy
|
15
|
+
require 'rails'
|
16
|
+
ENV['RAILS'] = Rails.version
|
17
|
+
ENV['RAILS_ROOT'] = File.expand_path("../rails/rails-#{ENV['RAILS']}", __FILE__)
|
18
|
+
# Create the test app if it doesn't exists
|
19
|
+
unless File.exists?(ENV['RAILS_ROOT'])
|
20
|
+
system 'rake setup'
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'active_model'
|
24
|
+
# require ActiveRecord to ensure that Ransack loads correctly
|
25
|
+
require 'active_record'
|
26
|
+
require 'active_admin'
|
27
|
+
ActiveAdmin.application.load_paths = [ENV['RAILS_ROOT'] + '/app/admin']
|
28
|
+
require ENV['RAILS_ROOT'] + '/config/environment.rb'
|
29
|
+
# Disabling authentication in specs so that we don't have to worry about
|
30
|
+
# it allover the place
|
31
|
+
ActiveAdmin.application.authentication_method = false
|
32
|
+
ActiveAdmin.application.current_user_method = false
|
33
|
+
|
34
|
+
require 'rspec/rails'
|
35
|
+
require 'support/admin'
|
36
|
+
require 'capybara/rails'
|
37
|
+
require 'capybara/rspec'
|
38
|
+
|
39
|
+
unless ENV['CAPYBARA_FIREFOX']
|
40
|
+
require 'capybara/poltergeist'
|
41
|
+
|
42
|
+
Capybara.register_driver :poltergeist do |app|
|
43
|
+
Capybara::Poltergeist::Driver.new(app, {
|
44
|
+
js_errors: true,
|
45
|
+
timeout: 80,
|
46
|
+
debug: true,
|
47
|
+
:phantomjs_options => ['--debug=no', '--load-images=no']
|
48
|
+
|
49
|
+
})
|
50
|
+
end
|
51
|
+
|
52
|
+
Capybara.javascript_driver = :poltergeist
|
53
|
+
end
|
54
|
+
|
55
|
+
RSpec.configure do |config|
|
56
|
+
DatabaseCleaner.strategy = :truncation
|
57
|
+
|
58
|
+
config.before(:each) do
|
59
|
+
DatabaseCleaner.start
|
60
|
+
end
|
61
|
+
|
62
|
+
config.after(:each) do
|
63
|
+
DatabaseCleaner.clean
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
def add_setting_resource(options = {}, &block)
|
2
|
+
options.merge!({model_name: 'Setting', starting_with: 'base.', title: 'Base Settings'})
|
3
|
+
ActiveAdmin.register_page options[:title] do
|
4
|
+
menu label: options[:title], priority: 99, parent: 'settings'
|
5
|
+
active_admin_settings_page(options, &block)
|
6
|
+
end
|
7
|
+
Rails.application.reload_routes!
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_second_setting_resource(options = {}, &block)
|
11
|
+
options.merge!({model_name: 'Setting', starting_with: 'second.', title: 'Second Settings'})
|
12
|
+
ActiveAdmin.register_page options[:title] do
|
13
|
+
menu label: options[:title], priority: 99, parent: 'settings'
|
14
|
+
active_admin_settings_page(options, &block)
|
15
|
+
end
|
16
|
+
Rails.application.reload_routes!
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_all_setting_resource(options = {}, &block)
|
20
|
+
options.merge!({model_name: 'Setting', title: 'Settings'})
|
21
|
+
ActiveAdmin.register_page options[:title] do
|
22
|
+
menu label: options[:title], priority: 99, id: 'settings'
|
23
|
+
active_admin_settings_page(options, &block)
|
24
|
+
end
|
25
|
+
Rails.application.reload_routes!
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Rails template to build the sample app for specs
|
2
|
+
|
3
|
+
generate :settings, 'Setting'
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
|
+
|
7
|
+
generate :'active_admin:install --skip-users'
|
8
|
+
generate :'formtastic:install'
|
9
|
+
|
10
|
+
# Configure Setup
|
11
|
+
inject_into_file 'config/initializers/active_admin.rb', <<-RUBY, before: "ActiveAdmin.setup do |config|"
|
12
|
+
ActiveadminSettingsCached.configure do |config|
|
13
|
+
config.model_name = 'Setting'
|
14
|
+
end
|
15
|
+
RUBY
|
16
|
+
|
17
|
+
route "root :to => 'admin/dashboard#index'"
|
18
|
+
|
19
|
+
rake 'db:migrate'
|
20
|
+
rake 'db:test:prepare'
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
desc 'Creates a test rails app for the specs to run against'
|
2
|
+
task :setup do
|
3
|
+
require 'rails/version'
|
4
|
+
if File.exists? dir = "spec/rails/rails-#{Rails::VERSION::STRING}"
|
5
|
+
puts "test app #{dir} already exists; skipping"
|
6
|
+
else
|
7
|
+
system 'mkdir -p spec/rails'
|
8
|
+
|
9
|
+
args = %w[
|
10
|
+
-m\ spec/support/rails_template.rb
|
11
|
+
--skip-gemfile
|
12
|
+
--skip-bundle
|
13
|
+
--skip-git
|
14
|
+
--skip-keeps
|
15
|
+
--skip-turbolinks
|
16
|
+
--skip-test-unit
|
17
|
+
--skip-spring
|
18
|
+
]
|
19
|
+
|
20
|
+
system "bundle exec rails new #{dir} #{args.join ' '}"
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_settings_cached
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Semyon Pupkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.5.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.5.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,104 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: database_cleaner
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sqlite3
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: capybara
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: selenium-webdriver
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: poltergeist
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
69
167
|
description: UI interface for rails-settings-cached in active admin
|
70
168
|
email:
|
71
169
|
- semen.pupkov@gmail.com
|
@@ -74,21 +172,32 @@ extensions: []
|
|
74
172
|
extra_rdoc_files: []
|
75
173
|
files:
|
76
174
|
- ".gitignore"
|
175
|
+
- ".travis.yml"
|
77
176
|
- Gemfile
|
78
177
|
- LICENSE.txt
|
79
178
|
- README.md
|
80
179
|
- Rakefile
|
81
180
|
- activeadmin_settings_cached.gemspec
|
82
|
-
- app/admin/settings.rb
|
83
|
-
- app/controllers/activeadmin_settings_cached/settings_controller.rb
|
84
|
-
- app/helpers/settings_helper.rb
|
85
181
|
- app/views/admin/settings/_index.html.erb
|
86
182
|
- config/locales/en.yml
|
87
183
|
- config/locales/ru.yml
|
88
|
-
- config/routes.rb
|
89
184
|
- lib/activeadmin_settings_cached.rb
|
185
|
+
- lib/activeadmin_settings_cached/coercions.rb
|
186
|
+
- lib/activeadmin_settings_cached/dsl.rb
|
90
187
|
- lib/activeadmin_settings_cached/engine.rb
|
188
|
+
- lib/activeadmin_settings_cached/model.rb
|
189
|
+
- lib/activeadmin_settings_cached/options.rb
|
91
190
|
- lib/activeadmin_settings_cached/version.rb
|
191
|
+
- lib/generators/active_admin/settings/USAGE
|
192
|
+
- lib/generators/active_admin/settings/settings_generator.rb
|
193
|
+
- lib/generators/active_admin/settings/templates/settings.rb
|
194
|
+
- spec/coercions_spec.rb
|
195
|
+
- spec/model_spec.rb
|
196
|
+
- spec/settings_spec.rb
|
197
|
+
- spec/spec_helper.rb
|
198
|
+
- spec/support/admin.rb
|
199
|
+
- spec/support/rails_template.rb
|
200
|
+
- tasks/test.rake
|
92
201
|
homepage: https://github.com/artofhuman/activeadmin_settings_cached
|
93
202
|
licenses:
|
94
203
|
- MIT
|
@@ -109,8 +218,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
218
|
version: '0'
|
110
219
|
requirements: []
|
111
220
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.4.
|
221
|
+
rubygems_version: 2.4.5
|
113
222
|
signing_key:
|
114
223
|
specification_version: 4
|
115
224
|
summary: UI interface for rails-settings-cached in active admin
|
116
|
-
test_files:
|
225
|
+
test_files:
|
226
|
+
- spec/coercions_spec.rb
|
227
|
+
- spec/model_spec.rb
|
228
|
+
- spec/settings_spec.rb
|
229
|
+
- spec/spec_helper.rb
|
230
|
+
- spec/support/admin.rb
|
231
|
+
- spec/support/rails_template.rb
|
data/app/admin/settings.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module ActiveadminSettingsCached
|
2
|
-
class SettingsController < ApplicationController
|
3
|
-
def update
|
4
|
-
settings_params.each_pair do |name, value|
|
5
|
-
settings_model[name] = value
|
6
|
-
end
|
7
|
-
|
8
|
-
flash[:success] = t('.success'.freeze)
|
9
|
-
redirect_to :back
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def settings_params
|
15
|
-
params.require(:settings).permit(settings_model.defaults.keys)
|
16
|
-
end
|
17
|
-
|
18
|
-
def settings_model
|
19
|
-
ActiveadminSettingsCached.config.model_name
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module SettingsHelper
|
2
|
-
def settings_field_options(settings_name)
|
3
|
-
default_value = ActiveadminSettingsCached.defaults[settings_name]
|
4
|
-
value = ActiveadminSettingsCached.settings[settings_name]
|
5
|
-
|
6
|
-
input_opts = if default_value.is_a?(Array)
|
7
|
-
{
|
8
|
-
collection: default_value,
|
9
|
-
selected: value,
|
10
|
-
}
|
11
|
-
else
|
12
|
-
{
|
13
|
-
input_html: {value: value, placeholder: default_value},
|
14
|
-
}
|
15
|
-
end
|
16
|
-
|
17
|
-
{as: ActiveadminSettingsCached.config.display[settings_name], label: false}
|
18
|
-
.merge!(input_opts)
|
19
|
-
end
|
20
|
-
end
|
data/config/routes.rb
DELETED