rails_admin_settings 1.1.0.pre.1 → 1.1.2
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/.gitignore +0 -0
- data/.rspec +0 -0
- data/.ruby-gemset +0 -0
- data/.ruby-version +0 -0
- data/.travis.yml +0 -0
- data/CHANGELOG.md +19 -0
- data/Gemfile +0 -0
- data/Gemfile.lock +103 -119
- data/LICENSE.txt +0 -0
- data/README.md +4 -11
- data/Rakefile +0 -0
- data/app/models/rails_admin_settings/setting.rb +8 -0
- data/app/views/rails_admin/main/_setting_value.html.haml +22 -2
- data/config/locales/en.yml +0 -0
- data/config/locales/ru.yml +0 -0
- data/gemfiles/mongoid-3.1.gemfile +0 -0
- data/gemfiles/mongoid-4.0.gemfile +0 -0
- data/lib/generators/rails_admin_settings/migration_generator.rb +0 -0
- data/lib/generators/rails_admin_settings/templates/migration.rb +0 -0
- data/lib/rails_admin_settings/dumper.rb +0 -0
- data/lib/rails_admin_settings/engine.rb +0 -0
- data/lib/rails_admin_settings/fallback.rb +0 -0
- data/lib/rails_admin_settings/hex_color_validator.rb +0 -0
- data/lib/rails_admin_settings/kinds.rb +3 -1
- data/lib/rails_admin_settings/mongoid.rb +0 -0
- data/lib/rails_admin_settings/namespaced.rb +0 -0
- data/lib/rails_admin_settings/processing.rb +9 -2
- data/lib/rails_admin_settings/rails_admin_config.rb +2 -0
- data/lib/rails_admin_settings/require_helpers.rb +0 -0
- data/lib/rails_admin_settings/settings.rb +0 -0
- data/lib/rails_admin_settings/storage/carrierwave.rb +0 -0
- data/lib/rails_admin_settings/tasks.rb +0 -0
- data/lib/rails_admin_settings/uploads.rb +1 -1
- data/lib/rails_admin_settings/validation.rb +0 -0
- data/lib/rails_admin_settings/version.rb +1 -2
- data/lib/rails_admin_settings.rb +0 -0
- data/rails_admin_settings.gemspec +0 -0
- data/spec/advanced_usage_spec.rb +0 -0
- data/spec/carrierwave_spec.rb +0 -0
- data/spec/database_trickery_spec.rb +0 -0
- data/spec/defaults_spec.rb +8 -0
- data/spec/enabling_spec.rb +0 -0
- data/spec/factories/setting.rb +0 -0
- data/spec/label_spec.rb +0 -0
- data/spec/migration_spec.rb +0 -0
- data/spec/model_spec.rb +0 -0
- data/spec/namespaced_spec.rb +0 -0
- data/spec/paperclip_spec.rb +0 -0
- data/spec/settings_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/support/database_cleaner.rb +0 -0
- data/spec/support/defaults.yml +10 -2
- data/spec/support/defaults_w_file.yml +0 -0
- data/spec/support/mongoid.rb +0 -0
- data/spec/support/mongoid.yml +0 -0
- data/spec/types_spec.rb +10 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb8a82776828edcae4754e00c8a2d7784277f2a9
|
|
4
|
+
data.tar.gz: c791f863ecd37dd5b5acaf08f03f1f6033d03d5e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a934c7c8621a822943165858158ba2fd0587e599aabe4833cd103082307f208edfb7aff16c10cac9a9443bca7386b34415a719c6af57740ead90a176d0f6e92f
|
|
7
|
+
data.tar.gz: 8478ac74537fa997bd0a2d34f46bd766a4e044eabdfba2ff1be3d4af8f4e2ec2808b009bee3daa55c95da07831f475bf40081c86486031e9f294e9c8627ceaa2
|
data/.gitignore
CHANGED
|
File without changes
|
data/.rspec
CHANGED
|
File without changes
|
data/.ruby-gemset
CHANGED
|
File without changes
|
data/.ruby-version
CHANGED
|
File without changes
|
data/.travis.yml
CHANGED
|
File without changes
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 1.1.2
|
|
2
|
+
|
|
3
|
+
- Add namespace tabs in rails_admin
|
|
4
|
+
- Add code type with codemirror (requires glebtv-ckeditor)
|
|
5
|
+
- Fixed Paperclip installation checking #6. Thx @tanelj
|
|
6
|
+
- Add boolean data type #2. Thx @teonimesic
|
|
7
|
+
|
|
8
|
+
## 1.1.0
|
|
9
|
+
|
|
10
|
+
- Fix file type
|
|
11
|
+
|
|
12
|
+
## 1.0.0
|
|
13
|
+
|
|
14
|
+
- Support ActiveRecord
|
|
15
|
+
|
|
1
16
|
## 1.0.0.pre.1
|
|
2
17
|
|
|
3
18
|
Disable auto migrate. To migrate from 0.8 run:
|
|
@@ -17,6 +32,10 @@ RailsAdminSettings.migrate!
|
|
|
17
32
|
- Added ActiveRecord support
|
|
18
33
|
- [!!!] Type renamed to Kind to avoid messing with AR STI column
|
|
19
34
|
|
|
35
|
+
Rename it in all invocations, then run migrate DB with:
|
|
36
|
+
|
|
37
|
+
RailsAdminSettings.migrate!
|
|
38
|
+
|
|
20
39
|
## 0.6.0
|
|
21
40
|
|
|
22
41
|
- Added namespaced settings
|
data/Gemfile
CHANGED
|
File without changes
|
data/Gemfile.lock
CHANGED
|
@@ -1,50 +1,41 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rails_admin_settings (1.1.
|
|
4
|
+
rails_admin_settings (1.1.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
actionmailer (
|
|
10
|
-
actionpack (=
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
actionview (= 4.2.4)
|
|
17
|
-
activesupport (= 4.2.4)
|
|
18
|
-
rack (~> 1.6)
|
|
19
|
-
rack-test (~> 0.6.2)
|
|
20
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
21
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
22
|
-
actionview (4.2.4)
|
|
23
|
-
activesupport (= 4.2.4)
|
|
24
|
-
builder (~> 3.1)
|
|
9
|
+
actionmailer (3.2.22)
|
|
10
|
+
actionpack (= 3.2.22)
|
|
11
|
+
mail (~> 2.5.4)
|
|
12
|
+
actionpack (3.2.22)
|
|
13
|
+
activemodel (= 3.2.22)
|
|
14
|
+
activesupport (= 3.2.22)
|
|
15
|
+
builder (~> 3.0.0)
|
|
25
16
|
erubis (~> 2.7.0)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
activemodel (
|
|
32
|
-
activesupport (=
|
|
33
|
-
builder (~> 3.
|
|
34
|
-
activerecord (
|
|
35
|
-
activemodel (=
|
|
36
|
-
activesupport (=
|
|
37
|
-
arel (~>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
builder (3.
|
|
17
|
+
journey (~> 1.0.4)
|
|
18
|
+
rack (~> 1.4.5)
|
|
19
|
+
rack-cache (~> 1.2)
|
|
20
|
+
rack-test (~> 0.6.1)
|
|
21
|
+
sprockets (~> 2.2.1)
|
|
22
|
+
activemodel (3.2.22)
|
|
23
|
+
activesupport (= 3.2.22)
|
|
24
|
+
builder (~> 3.0.0)
|
|
25
|
+
activerecord (3.2.22)
|
|
26
|
+
activemodel (= 3.2.22)
|
|
27
|
+
activesupport (= 3.2.22)
|
|
28
|
+
arel (~> 3.0.2)
|
|
29
|
+
tzinfo (~> 0.3.29)
|
|
30
|
+
activeresource (3.2.22)
|
|
31
|
+
activemodel (= 3.2.22)
|
|
32
|
+
activesupport (= 3.2.22)
|
|
33
|
+
activesupport (3.2.22)
|
|
34
|
+
i18n (~> 0.6, >= 0.6.4)
|
|
35
|
+
multi_json (~> 1.0)
|
|
36
|
+
addressable (2.4.0)
|
|
37
|
+
arel (3.0.3)
|
|
38
|
+
builder (3.0.4)
|
|
48
39
|
carrierwave (0.10.0)
|
|
49
40
|
activemodel (>= 3.2.0)
|
|
50
41
|
activesupport (>= 3.2.0)
|
|
@@ -52,129 +43,122 @@ GEM
|
|
|
52
43
|
mime-types (>= 1.16)
|
|
53
44
|
climate_control (0.0.3)
|
|
54
45
|
activesupport (>= 3.0)
|
|
55
|
-
cocaine (0.5.
|
|
46
|
+
cocaine (0.5.8)
|
|
56
47
|
climate_control (>= 0.0.3, < 1.0)
|
|
57
48
|
coderay (1.1.0)
|
|
58
|
-
connection_pool (2.2.0)
|
|
59
49
|
crass (1.0.2)
|
|
60
|
-
database_cleaner (1.5.
|
|
50
|
+
database_cleaner (1.5.1)
|
|
61
51
|
diff-lcs (1.2.5)
|
|
62
52
|
docile (1.1.5)
|
|
63
53
|
erubis (2.7.0)
|
|
64
54
|
factory_girl (4.5.0)
|
|
65
55
|
activesupport (>= 3.0.0)
|
|
66
|
-
geocoder (1.2.
|
|
56
|
+
geocoder (1.2.12)
|
|
67
57
|
glebtv-carrierwave-mongoid (0.8.0)
|
|
68
58
|
carrierwave (>= 0.8.0, < 0.11.0)
|
|
69
59
|
mongoid (>= 3.0, < 5.0)
|
|
70
|
-
glebtv-mongoid-paperclip (0.
|
|
71
|
-
mongoid (>= 3.0, <
|
|
72
|
-
paperclip (
|
|
73
|
-
|
|
74
|
-
activesupport (>= 4.1.0)
|
|
60
|
+
glebtv-mongoid-paperclip (0.4.0)
|
|
61
|
+
mongoid (>= 3.0, < 6.0)
|
|
62
|
+
paperclip (~> 4.3.1)
|
|
63
|
+
hike (1.2.3)
|
|
75
64
|
i18n (0.7.0)
|
|
65
|
+
journey (1.0.4)
|
|
76
66
|
json (1.8.3)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
mime-types (>= 1.16, < 3)
|
|
67
|
+
mail (2.5.4)
|
|
68
|
+
mime-types (~> 1.16)
|
|
69
|
+
treetop (~> 1.4.8)
|
|
81
70
|
method_source (0.8.2)
|
|
82
|
-
mime-types (
|
|
71
|
+
mime-types (1.25.1)
|
|
83
72
|
mimemagic (0.3.0)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
mongoid (~> 4.0.0)
|
|
73
|
+
mini_portile2 (2.0.0)
|
|
74
|
+
mongoid (3.1.7)
|
|
75
|
+
activemodel (~> 3.2)
|
|
76
|
+
moped (~> 1.4)
|
|
77
|
+
origin (~> 1.0)
|
|
78
|
+
tzinfo (~> 0.3.29)
|
|
79
|
+
mongoid-rspec (1.13.0)
|
|
80
|
+
mongoid (~> 3.1)
|
|
93
81
|
rake
|
|
94
82
|
rspec (~> 3.1)
|
|
95
|
-
moped (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
mini_portile (~> 0.6.0)
|
|
101
|
-
nokogumbo (1.4.1)
|
|
83
|
+
moped (1.5.3)
|
|
84
|
+
multi_json (1.11.2)
|
|
85
|
+
nokogiri (1.6.7)
|
|
86
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
87
|
+
nokogumbo (1.4.6)
|
|
102
88
|
nokogiri
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
paperclip (4.3.1)
|
|
89
|
+
origin (1.1.0)
|
|
90
|
+
paperclip (4.3.2)
|
|
106
91
|
activemodel (>= 3.2.0)
|
|
107
92
|
activesupport (>= 3.2.0)
|
|
108
93
|
cocaine (~> 0.5.5)
|
|
109
94
|
mime-types
|
|
110
95
|
mimemagic (= 0.3.0)
|
|
111
|
-
|
|
96
|
+
polyglot (0.3.5)
|
|
97
|
+
pry (0.10.3)
|
|
112
98
|
coderay (~> 1.1.0)
|
|
113
99
|
method_source (~> 0.8.1)
|
|
114
100
|
slop (~> 3.4)
|
|
115
|
-
rack (1.
|
|
101
|
+
rack (1.4.7)
|
|
102
|
+
rack-cache (1.5.1)
|
|
103
|
+
rack (>= 0.4)
|
|
104
|
+
rack-ssl (1.3.4)
|
|
105
|
+
rack
|
|
116
106
|
rack-test (0.6.3)
|
|
117
107
|
rack (>= 1.0)
|
|
118
|
-
rails (
|
|
119
|
-
actionmailer (=
|
|
120
|
-
actionpack (=
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
activesupport (>= 4.2.0.alpha)
|
|
131
|
-
rails-dom-testing (1.0.7)
|
|
132
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
|
133
|
-
nokogiri (~> 1.6.0)
|
|
134
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
|
135
|
-
rails-html-sanitizer (1.0.2)
|
|
136
|
-
loofah (~> 2.0)
|
|
137
|
-
railties (4.2.4)
|
|
138
|
-
actionpack (= 4.2.4)
|
|
139
|
-
activesupport (= 4.2.4)
|
|
108
|
+
rails (3.2.22)
|
|
109
|
+
actionmailer (= 3.2.22)
|
|
110
|
+
actionpack (= 3.2.22)
|
|
111
|
+
activerecord (= 3.2.22)
|
|
112
|
+
activeresource (= 3.2.22)
|
|
113
|
+
activesupport (= 3.2.22)
|
|
114
|
+
bundler (~> 1.0)
|
|
115
|
+
railties (= 3.2.22)
|
|
116
|
+
railties (3.2.22)
|
|
117
|
+
actionpack (= 3.2.22)
|
|
118
|
+
activesupport (= 3.2.22)
|
|
119
|
+
rack-ssl (~> 1.3.2)
|
|
140
120
|
rake (>= 0.8.7)
|
|
141
|
-
|
|
121
|
+
rdoc (~> 3.4)
|
|
122
|
+
thor (>= 0.14.6, < 2.0)
|
|
142
123
|
rake (10.4.2)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
rspec-
|
|
147
|
-
|
|
148
|
-
rspec-
|
|
149
|
-
rspec-
|
|
124
|
+
rdoc (3.12.2)
|
|
125
|
+
json (~> 1.4)
|
|
126
|
+
rspec (3.4.0)
|
|
127
|
+
rspec-core (~> 3.4.0)
|
|
128
|
+
rspec-expectations (~> 3.4.0)
|
|
129
|
+
rspec-mocks (~> 3.4.0)
|
|
130
|
+
rspec-core (3.4.1)
|
|
131
|
+
rspec-support (~> 3.4.0)
|
|
132
|
+
rspec-expectations (3.4.0)
|
|
150
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
151
|
-
rspec-support (~> 3.
|
|
152
|
-
rspec-mocks (3.
|
|
134
|
+
rspec-support (~> 3.4.0)
|
|
135
|
+
rspec-mocks (3.4.0)
|
|
153
136
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
154
|
-
rspec-support (~> 3.
|
|
155
|
-
rspec-support (3.
|
|
137
|
+
rspec-support (~> 3.4.0)
|
|
138
|
+
rspec-support (3.4.1)
|
|
156
139
|
russian_phone (0.5.3)
|
|
157
140
|
safe_yaml (1.0.4)
|
|
158
|
-
sanitize (4.0.
|
|
141
|
+
sanitize (4.0.1)
|
|
159
142
|
crass (~> 1.0.2)
|
|
160
143
|
nokogiri (>= 1.4.4)
|
|
161
|
-
nokogumbo (
|
|
162
|
-
simplecov (0.
|
|
144
|
+
nokogumbo (~> 1.4.1)
|
|
145
|
+
simplecov (0.11.1)
|
|
163
146
|
docile (~> 1.1.0)
|
|
164
147
|
json (~> 1.8)
|
|
165
148
|
simplecov-html (~> 0.10.0)
|
|
166
149
|
simplecov-html (0.10.0)
|
|
167
150
|
slop (3.6.0)
|
|
168
|
-
sprockets (
|
|
151
|
+
sprockets (2.2.3)
|
|
152
|
+
hike (~> 1.2)
|
|
153
|
+
multi_json (~> 1.0)
|
|
169
154
|
rack (~> 1.0)
|
|
170
|
-
|
|
171
|
-
actionpack (>= 3.0)
|
|
172
|
-
activesupport (>= 3.0)
|
|
173
|
-
sprockets (>= 2.8, < 4.0)
|
|
155
|
+
tilt (~> 1.1, != 1.3.0)
|
|
174
156
|
thor (0.19.1)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
157
|
+
tilt (1.4.1)
|
|
158
|
+
treetop (1.4.15)
|
|
159
|
+
polyglot
|
|
160
|
+
polyglot (>= 0.3.1)
|
|
161
|
+
tzinfo (0.3.46)
|
|
178
162
|
validates_email_format_of (1.6.3)
|
|
179
163
|
i18n
|
|
180
164
|
|
data/LICENSE.txt
CHANGED
|
File without changes
|
data/README.md
CHANGED
|
@@ -3,17 +3,9 @@
|
|
|
3
3
|
[](http://travis-ci.org/rs-pro/rails_admin_settings)
|
|
4
4
|
[](https://gemnasium.com/rs-pro/rails_admin_settings)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
App settings editable via RailsAdmin with support for ActiveRecord and Mongoid.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Type renamed to Kind to avoid messing with AR STI column
|
|
11
|
-
|
|
12
|
-
Rename it in all invocations, then run migrate DB with:
|
|
13
|
-
|
|
14
|
-
RailsAdminSettings.migrate!
|
|
15
|
-
|
|
16
|
-
Also, active record is now supported in addition to mongoid.
|
|
8
|
+
Supports images, files, html with or without sanitization, code with codemirror, etc.
|
|
17
9
|
|
|
18
10
|
## Features
|
|
19
11
|
|
|
@@ -68,7 +60,7 @@ Or install it yourself as:
|
|
|
68
60
|
Settings.content_block_1(kind: 'html', default: 'test')
|
|
69
61
|
Settings.data(kind: 'yaml')
|
|
70
62
|
Settings.data = [1, 2, 3]
|
|
71
|
-
|
|
63
|
+
|
|
72
64
|
Settings.enabled?(:phone, kind: 'phone', default: '906 111-11-11') # also creates setting if it doesn't exist
|
|
73
65
|
Settings.phone.area
|
|
74
66
|
Settings.phone.subscriber
|
|
@@ -101,6 +93,7 @@ Supported types:
|
|
|
101
93
|
|
|
102
94
|
string (input)
|
|
103
95
|
text (textarea)
|
|
96
|
+
boolean (checkbox)
|
|
104
97
|
color (uses built-in RailsAdmin color picker)
|
|
105
98
|
html (supports Rich, glebtv-ckeditor, ckeditor, but does not require any of them)
|
|
106
99
|
sanitized (requires sanitize -- sanitizes HTML before saving to DB [Warning: uses RELAXED config!])
|
data/Rakefile
CHANGED
|
File without changes
|
|
@@ -59,6 +59,14 @@ module RailsAdminSettings
|
|
|
59
59
|
v
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
# t = {_all: 'Все'}
|
|
63
|
+
::RailsAdminSettings::Setting.pluck(:ns).uniq.each do |c|
|
|
64
|
+
s = "ns_#{c.gsub('-', '_')}".to_sym
|
|
65
|
+
scope s, -> { where(ns: c) }
|
|
66
|
+
# t[s] = c
|
|
67
|
+
end
|
|
68
|
+
# I18n.backend.store_translations(:ru, {admin: {scopes: {'rails_admin_settings/setting': t}}})
|
|
69
|
+
|
|
62
70
|
if Object.const_defined?('RailsAdmin')
|
|
63
71
|
include RailsAdminSettings::RailsAdminConfig
|
|
64
72
|
else
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
- if ['string', 'integer', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
|
|
2
2
|
= form.text_field :raw, :value => field.value
|
|
3
|
+
- if @object.type == 'boolean'
|
|
4
|
+
= form.check_box :raw, {:value => field.value}, 'true', 'false'
|
|
3
5
|
- if @object.type == 'color'
|
|
4
6
|
= form.text_field :raw, :value => field.value, 'data-color' => true, style: "background-color: ##{field.value}"
|
|
5
7
|
- elsif %w(text yaml phones).include?( @object.type )
|
|
6
8
|
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
|
7
|
-
- elsif @object.type == '
|
|
9
|
+
- elsif @object.type == 'code'
|
|
10
|
+
:ruby
|
|
11
|
+
#binding.pry
|
|
12
|
+
js_data = {
|
|
13
|
+
csspath: asset_path('ckeditor/plugins/codemirror/css/codemirror.min.css'),
|
|
14
|
+
jspath: asset_path('ckeditor/plugins/codemirror/js/codemirror.min.js'),
|
|
15
|
+
options: {
|
|
16
|
+
mode: 'htmlmixed',
|
|
17
|
+
theme: 'monokai',
|
|
18
|
+
lineNumbers: true
|
|
19
|
+
},
|
|
20
|
+
locations: {
|
|
21
|
+
mode: asset_path('ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js'),
|
|
22
|
+
theme: asset_path('ckeditor/plugins/codemirror/theme/monokai.css')
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
= form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: 'codemirror', options: js_data.to_json }).reverse_merge({ value: field.form_value })
|
|
27
|
+
- elsif @object.type == 'html' || @object.type == 'sanitized'
|
|
8
28
|
- if form.respond_to?(:cktext_area)
|
|
9
29
|
= javascript_include_tag "ckeditor/init"
|
|
10
30
|
= form.cktext_area :raw, :value => field.value, :rows => 10, :cols => 80
|
|
@@ -19,4 +39,4 @@
|
|
|
19
39
|
- else
|
|
20
40
|
.alert.alert-error
|
|
21
41
|
= t('admin.settings.no_ckeditor_detected')
|
|
22
|
-
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
|
42
|
+
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
data/config/locales/en.yml
CHANGED
|
File without changes
|
data/config/locales/ru.yml
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -10,7 +10,7 @@ module RailsAdminSettings
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def text_kind?
|
|
13
|
-
(RailsAdminSettings.kinds - ['phone', 'phones', 'integer', 'yaml']).include? kind
|
|
13
|
+
(RailsAdminSettings.kinds - ['phone', 'phones', 'integer', 'yaml', 'boolean']).include? kind
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def upload_kind?
|
|
@@ -18,7 +18,7 @@ module RailsAdminSettings
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def html_kind?
|
|
21
|
-
['html', 'sanitized'].include? kind
|
|
21
|
+
['html', 'code', 'sanitized'].include? kind
|
|
22
22
|
end
|
|
23
23
|
alias_method :text_type?, :text_kind?
|
|
24
24
|
alias_method :upload_type?, :upload_kind?
|
|
@@ -72,6 +72,9 @@ module RailsAdminSettings
|
|
|
72
72
|
elsif integer_kind?
|
|
73
73
|
0
|
|
74
74
|
elsif yaml_kind?
|
|
75
|
+
elsif boolean_kind?
|
|
76
|
+
false
|
|
77
|
+
elsif yaml_type?
|
|
75
78
|
nil
|
|
76
79
|
elsif phone_kind?
|
|
77
80
|
require_russian_phone do
|
|
@@ -87,6 +90,8 @@ module RailsAdminSettings
|
|
|
87
90
|
def default_serializable_value
|
|
88
91
|
if phones_kind?
|
|
89
92
|
''
|
|
93
|
+
elsif boolean_type?
|
|
94
|
+
'false'
|
|
90
95
|
else
|
|
91
96
|
default_value
|
|
92
97
|
end
|
|
@@ -131,6 +136,8 @@ module RailsAdminSettings
|
|
|
131
136
|
raw.to_i
|
|
132
137
|
elsif yaml_kind?
|
|
133
138
|
load_yaml
|
|
139
|
+
elsif boolean_kind?
|
|
140
|
+
raw == 'true'
|
|
134
141
|
elsif phone_kind?
|
|
135
142
|
load_phone
|
|
136
143
|
elsif phones_kind?
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -25,7 +25,7 @@ module RailsAdminSettings
|
|
|
25
25
|
|
|
26
26
|
Settings.file_uploads_supported = true
|
|
27
27
|
Settings.file_uploads_engine = :paperclip
|
|
28
|
-
elsif RailsAdminSettings.active_record? && defined?(
|
|
28
|
+
elsif RailsAdminSettings.active_record? && defined?(Paperclip)
|
|
29
29
|
if defined?(Rails)
|
|
30
30
|
base.has_attached_file(:file)
|
|
31
31
|
else
|
|
File without changes
|
data/lib/rails_admin_settings.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/spec/advanced_usage_spec.rb
CHANGED
|
File without changes
|
data/spec/carrierwave_spec.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/spec/defaults_spec.rb
CHANGED
|
@@ -46,11 +46,19 @@ describe 'Settings loading defaults' do
|
|
|
46
46
|
it 'works with custom default namespace' do
|
|
47
47
|
Settings.ns_default = 'other'
|
|
48
48
|
Settings.ns_fallback = 'other'
|
|
49
|
+
|
|
49
50
|
expect(Settings.ns(:main).phone).to eq '906 1111111'
|
|
50
51
|
expect(Settings.ns(:other).footer).to eq 'zzz'
|
|
51
52
|
expect(Settings.ns(:main).footer).to eq 'test <b></b>'
|
|
52
53
|
expect(Settings.footer).to eq 'zzz'
|
|
53
54
|
|
|
55
|
+
Settings.ns(:main).phone.should eq '906 1111111'
|
|
56
|
+
Settings.ns(:main).true_setting.should be true
|
|
57
|
+
Settings.ns(:main).false_setting.should be false
|
|
58
|
+
Settings.ns(:other).footer.should eq 'zzz'
|
|
59
|
+
Settings.ns(:main).footer.should eq 'test <b></b>'
|
|
60
|
+
Settings.footer.should eq 'zzz'
|
|
61
|
+
|
|
54
62
|
expect(Settings.ns(:etc, fallback: :main).phone).to eq '906 1111111'
|
|
55
63
|
expect(Settings.ns(:etc, fallback: :main).footer).to eq 'test <b></b>'
|
|
56
64
|
expect(Settings.ns(:other, fallback: :main).footer).to eq 'zzz'
|
data/spec/enabling_spec.rb
CHANGED
|
File without changes
|
data/spec/factories/setting.rb
CHANGED
|
File without changes
|
data/spec/label_spec.rb
CHANGED
|
File without changes
|
data/spec/migration_spec.rb
CHANGED
|
File without changes
|
data/spec/model_spec.rb
CHANGED
|
File without changes
|
data/spec/namespaced_spec.rb
CHANGED
|
File without changes
|
data/spec/paperclip_spec.rb
CHANGED
|
File without changes
|
data/spec/settings_spec.rb
CHANGED
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/spec/support/defaults.yml
CHANGED
|
@@ -6,10 +6,18 @@ main:
|
|
|
6
6
|
phone:
|
|
7
7
|
kind: 'phone'
|
|
8
8
|
value: '906 1111111'
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
true_setting:
|
|
11
|
+
kind: 'boolean'
|
|
12
|
+
value: true
|
|
13
|
+
|
|
14
|
+
false_setting:
|
|
15
|
+
kind: 'boolean'
|
|
16
|
+
value: false
|
|
17
|
+
|
|
10
18
|
disabled:
|
|
11
19
|
enabled: false
|
|
12
|
-
|
|
20
|
+
|
|
13
21
|
other:
|
|
14
22
|
footer:
|
|
15
23
|
value: 'zzz'
|
|
File without changes
|
data/spec/support/mongoid.rb
CHANGED
|
File without changes
|
data/spec/support/mongoid.yml
CHANGED
|
File without changes
|
data/spec/types_spec.rb
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
5
|
describe 'Settings kind' do
|
|
6
|
+
it 'boolean' do
|
|
7
|
+
Settings.get(:testbool, kind: 'boolean').value.should be false
|
|
8
|
+
Settings.get(:testbool, default: true, kind: 'boolean').value.should be false
|
|
9
|
+
Settings.get(:testbool2, default: true, kind: 'boolean').value.should be true
|
|
10
|
+
Settings.testbool2.should be true
|
|
11
|
+
Settings.set(:testbool3, true, kind: 'boolean')
|
|
12
|
+
Settings.testbool3.should be true
|
|
13
|
+
end
|
|
14
|
+
|
|
6
15
|
it 'html' do
|
|
7
16
|
expect(Settings.get(:email, kind: 'html', default: 'test@example.com').to_s).to eq 'test@example.com'
|
|
8
17
|
end
|
|
@@ -76,4 +85,4 @@ describe 'Settings kind' do
|
|
|
76
85
|
Settings.col = 'zzzzzz'
|
|
77
86
|
}.to raise_error
|
|
78
87
|
end
|
|
79
|
-
end
|
|
88
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_admin_settings
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gleb Tv
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-12-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mongoid
|
|
@@ -347,12 +347,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
347
347
|
version: '0'
|
|
348
348
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
349
349
|
requirements:
|
|
350
|
-
- - "
|
|
350
|
+
- - ">="
|
|
351
351
|
- !ruby/object:Gem::Version
|
|
352
|
-
version:
|
|
352
|
+
version: '0'
|
|
353
353
|
requirements: []
|
|
354
354
|
rubyforge_project:
|
|
355
|
-
rubygems_version: 2.4.5
|
|
355
|
+
rubygems_version: 2.4.5.1
|
|
356
356
|
signing_key:
|
|
357
357
|
specification_version: 4
|
|
358
358
|
summary: ''
|