thecore_settings 3.0.6 → 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -169
- data/lib/thecore_settings/rails_admin_config.rb +1 -1
- data/lib/thecore_settings/version.rb +1 -1
- metadata +13 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e85781fdd77ea474573136f095acdb972ed5392822db3cac2604f5091df67d9
|
4
|
+
data.tar.gz: df8a2f8c8690e3fbadf57340f37aa1a2f484f55b8979e8eff1b5bdbbc8693b9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '058d0491048eb52f496eb46ee83191d9cf95cf4d799bd1060aed37031baf2fee1e7569f4ac1b83b21176646ce2868a806eb152c7c6e0efb66ab0098862eaac6f'
|
7
|
+
data.tar.gz: cdf9cedf8dd8849eb6f7cd29f98584dd84731487da0250b09bbafa7a6c9774ebeeca89d75baed79c71e178abd46f830aab941a767dae3b23922ea3d61a08a7f1
|
data/README.md
CHANGED
@@ -1,169 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Project forked from:
|
4
|
-
|
5
|
-
https://gitlab.com/rocket-science/rails_admin_settings
|
6
|
-
|
7
|
-
Since it looks in hyatus.
|
8
|
-
|
9
|
-
|
10
|
-
[](http://travis-ci.org/rs-pro/thecore_settings)
|
11
|
-
[](https://badge.fury.io/rb/thecore_settings)
|
12
|
-
[](https://hakiri.io/github/rs-pro/thecore_settings/master)
|
13
|
-
[](https://codeclimate.com/github/rs-pro/thecore_settings/maintainability)
|
14
|
-
[](https://codeclimate.com/github/rs-pro/thecore_settings/test_coverage)
|
15
|
-
|
16
|
-
App settings editable via RailsAdmin with support for ActiveRecord and Mongoid.
|
17
|
-
|
18
|
-
Supports images, files, html with or without sanitization, code with codemirror, etc.
|
19
|
-
|
20
|
-
## Features
|
21
|
-
|
22
|
-
- Lazy loading - loads settings only if they are needed during request
|
23
|
-
- Loads all settings at once and caches them for the duration of request
|
24
|
-
- Supports lots of setting kinds - yaml, html with ckeditor, phone numbers etc
|
25
|
-
- Each setting can be enabled and disabled within rails_admin, if it's disabled it returns default value for kind
|
26
|
-
|
27
|
-
## Installation
|
28
|
-
|
29
|
-
1. Add this line to your application's Gemfile:
|
30
|
-
|
31
|
-
```shell
|
32
|
-
gem 'thecore_settings'
|
33
|
-
```
|
34
|
-
|
35
|
-
2. Then migrate:
|
36
|
-
|
37
|
-
```shell
|
38
|
-
rails db:migrate
|
39
|
-
```
|
40
|
-
|
41
|
-
|
42
|
-
### OPTIONAL Generage migration
|
43
|
-
|
44
|
-
Not needed anymore since migrations from this gem are automatically loaded by main app when needed:
|
45
|
-
|
46
|
-
```shell
|
47
|
-
rails g thecore_settings:migration
|
48
|
-
```
|
49
|
-
|
50
|
-
## Gemfile order matters
|
51
|
-
|
52
|
-
- Put it after rails_admin to get built-in support
|
53
|
-
- Put it after rails_admin_toggleable to get built-in support
|
54
|
-
- Put it after ckeditor/glebtv-ckeditor/rich to get built-in support
|
55
|
-
- Put it after russian_phone to get built-in support
|
56
|
-
- Put it after sanitized to get built-in support
|
57
|
-
- Put it after safe_yaml to get built-in support
|
58
|
-
- Put it after validates_email_format_of to get built-in support
|
59
|
-
- Put it after geocoder to get built-in support
|
60
|
-
- Put it after carrierwave / paperclip to get built-in support
|
61
|
-
- Put it after addressable to get built-in support
|
62
|
-
|
63
|
-
And then execute:
|
64
|
-
|
65
|
-
$ bundle
|
66
|
-
|
67
|
-
Or install it yourself as:
|
68
|
-
|
69
|
-
$ gem install thecore_settings
|
70
|
-
|
71
|
-
## Basic Usage (like RailsSettings)
|
72
|
-
|
73
|
-
Settings.admin_email = 'test@example.com'
|
74
|
-
Settings.admin_email
|
75
|
-
|
76
|
-
|
77
|
-
## Advanced Usage
|
78
|
-
|
79
|
-
Settings.content_block_1(kind: 'html', default: 'test', label: "Test Value")
|
80
|
-
Settings.data(kind: 'yaml')
|
81
|
-
Settings.data = [1, 2, 3]
|
82
|
-
|
83
|
-
Settings.enabled?(:phone, kind: 'phone', default: '906 111-11-11') # also creates setting if it doesn't exist
|
84
|
-
Settings.phone.area
|
85
|
-
Settings.phone.subscriber
|
86
|
-
|
87
|
-
See more here: https://github.com/rs-pro/thecore_settings/blob/master/spec/advanced_usage_spec.rb
|
88
|
-
|
89
|
-
## Namespacing
|
90
|
-
|
91
|
-
Settings can have namespaces (useful for locale, etc)
|
92
|
-
|
93
|
-
Settings.ns('test').s1 = 123
|
94
|
-
Settings.ns('test').s1
|
95
|
-
> "123"
|
96
|
-
Settings.ns('main').s1
|
97
|
-
> ""
|
98
|
-
Settings.s1
|
99
|
-
> ""
|
100
|
-
Settings.ns_default = 'test'
|
101
|
-
Settings.s1
|
102
|
-
> "123"
|
103
|
-
Settings.ns_default = 'main'
|
104
|
-
Settings.ns_fallback = 'test'
|
105
|
-
Settings.s1
|
106
|
-
> "123"
|
107
|
-
|
108
|
-
|
109
|
-
## Value types
|
110
|
-
|
111
|
-
Supported types:
|
112
|
-
|
113
|
-
string (input)
|
114
|
-
text (textarea)
|
115
|
-
boolean (checkbox)
|
116
|
-
color (uses built-in RailsAdmin color picker)
|
117
|
-
html (does NOT sanitize (allows ANY javascript) - for trusted admin, supports Rich, glebtv-ckeditor, ckeditor, but does not require any of them)
|
118
|
-
code (does NOT sanitize (allows ANY javascript) - shows as codemirror, requires glebtv-ckeditor for codemirror)
|
119
|
-
sanitized (requires sanitize gem -- sanitizes HTML before saving to DB [Warning: uses RELAXED config!])
|
120
|
-
integer (stored as string)
|
121
|
-
yaml (requires safe_yaml)
|
122
|
-
phone (requires russian_phone)
|
123
|
-
phones (requires russian_phone - multiple phones)
|
124
|
-
email (requires validates_email_format_of)
|
125
|
-
address (requires geocoder)
|
126
|
-
file (requires paperclip or carrierwave)
|
127
|
-
url (requires addressable)
|
128
|
-
domain (requires addressable)
|
129
|
-
sanitize (uses rails sanitize helper with default settings, shows as html)
|
130
|
-
sanitize_code (uses rails sanitize helper with default settings, shows as codemirror textarea, can provide custom scrubber, defaults to Rails::Html::WhiteListSanitizer)
|
131
|
-
strip_tags (uses strip_tags rails helper)
|
132
|
-
simple_format (uses simple_format rails helper)
|
133
|
-
simple_format_raw (does NOT sanitize (allows ANY javascript) - uses simple_format rails helper with sanitize: false)
|
134
|
-
json
|
135
|
-
|
136
|
-
#### Sanitize settings
|
137
|
-
|
138
|
-
Sanitizer can be changed like this:
|
139
|
-
```
|
140
|
-
RalsAdminSettings.scrubber = Rails::Html::WhiteListSanitizer.new
|
141
|
-
```
|
142
|
-
defaults to Rails::Html::WhiteListSanitizer
|
143
|
-
|
144
|
-
Strings and html support following replacement patterns:
|
145
|
-
|
146
|
-
{{year}} -> current year
|
147
|
-
{{year|2013}} -> 2013 in 2013, 2013-2014 in 2014, etc
|
148
|
-
|
149
|
-
Sanitized types sanitize before storing to DB and not on display for performance.
|
150
|
-
Simple format types are stored in db as-is.
|
151
|
-
|
152
|
-
## Usage with Rails Admin
|
153
|
-
|
154
|
-
Rails admin management for settings is supported out of the box
|
155
|
-
|
156
|
-
It is recommended to disable new/create page (it is not supported by design, settings are defined in ruby code).
|
157
|
-
Disable via cancan:
|
158
|
-
|
159
|
-
```
|
160
|
-
cannot :create, ThecoreSettings::Setting
|
161
|
-
```
|
162
|
-
|
163
|
-
## Contributing
|
164
|
-
|
165
|
-
1. Fork it
|
166
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
167
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
168
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
169
|
-
5. Create new Pull Request
|
1
|
+
This is part of Thecore framework: https://github.com/gabrieletassoni/thecore/tree/release/3
|
@@ -3,7 +3,7 @@ module ThecoreSettings
|
|
3
3
|
def self.included(base)
|
4
4
|
if base.respond_to?(:rails_admin)
|
5
5
|
base.rails_admin do
|
6
|
-
navigation_label I18n.t("admin.settings.label")
|
6
|
+
navigation_label Proc.new {I18n.t("admin.settings.label")}
|
7
7
|
list do
|
8
8
|
if Object.const_defined?('RailsAdminToggleable')
|
9
9
|
field :enabled, :toggle
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
- Gleb Tv
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-02-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: safe_yaml
|
@@ -31,42 +30,42 @@ dependencies:
|
|
31
30
|
requirements:
|
32
31
|
- - "~>"
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0.
|
33
|
+
version: '0.8'
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - "~>"
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0.
|
40
|
+
version: '0.8'
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
42
|
name: sanitize
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
45
44
|
requirements:
|
46
45
|
- - "~>"
|
47
46
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
47
|
+
version: '7.0'
|
49
48
|
type: :runtime
|
50
49
|
prerelease: false
|
51
50
|
version_requirements: !ruby/object:Gem::Requirement
|
52
51
|
requirements:
|
53
52
|
- - "~>"
|
54
53
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
54
|
+
version: '7.0'
|
56
55
|
- !ruby/object:Gem::Dependency
|
57
56
|
name: validates_email_format_of
|
58
57
|
requirement: !ruby/object:Gem::Requirement
|
59
58
|
requirements:
|
60
59
|
- - "~>"
|
61
60
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
61
|
+
version: '1.8'
|
63
62
|
type: :runtime
|
64
63
|
prerelease: false
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
66
65
|
requirements:
|
67
66
|
- - "~>"
|
68
67
|
- !ruby/object:Gem::Version
|
69
|
-
version: '1.
|
68
|
+
version: '1.8'
|
70
69
|
- !ruby/object:Gem::Dependency
|
71
70
|
name: geocoder
|
72
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,28 +100,28 @@ dependencies:
|
|
101
100
|
requirements:
|
102
101
|
- - "~>"
|
103
102
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
103
|
+
version: '5.1'
|
105
104
|
type: :runtime
|
106
105
|
prerelease: false
|
107
106
|
version_requirements: !ruby/object:Gem::Requirement
|
108
107
|
requirements:
|
109
108
|
- - "~>"
|
110
109
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
110
|
+
version: '5.1'
|
112
111
|
- !ruby/object:Gem::Dependency
|
113
112
|
name: shrine
|
114
113
|
requirement: !ruby/object:Gem::Requirement
|
115
114
|
requirements:
|
116
115
|
- - "~>"
|
117
116
|
- !ruby/object:Gem::Version
|
118
|
-
version: '3.
|
117
|
+
version: '3.6'
|
119
118
|
type: :runtime
|
120
119
|
prerelease: false
|
121
120
|
version_requirements: !ruby/object:Gem::Requirement
|
122
121
|
requirements:
|
123
122
|
- - "~>"
|
124
123
|
- !ruby/object:Gem::Version
|
125
|
-
version: '3.
|
124
|
+
version: '3.6'
|
126
125
|
description: ActiveRecord + RailsAdmin App Settings management
|
127
126
|
email:
|
128
127
|
- g.tassoni@bancolini.com
|
@@ -169,7 +168,6 @@ metadata:
|
|
169
168
|
homepage_uri: https://github.com/gabrieletassoni/thecore_settings
|
170
169
|
source_code_uri: https://github.com/gabrieletassoni/thecore_settings
|
171
170
|
changelog_uri: https://github.com/gabrieletassoni/thecore_settings/blob/master/CHANGELOG.md
|
172
|
-
post_install_message:
|
173
171
|
rdoc_options: []
|
174
172
|
require_paths:
|
175
173
|
- lib
|
@@ -184,8 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
182
|
- !ruby/object:Gem::Version
|
185
183
|
version: '0'
|
186
184
|
requirements: []
|
187
|
-
rubygems_version: 3.
|
188
|
-
signing_key:
|
185
|
+
rubygems_version: 3.6.2
|
189
186
|
specification_version: 4
|
190
187
|
summary: Settings Management
|
191
188
|
test_files: []
|