simpleadmin 1.4.0 → 1.5.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 +5 -5
- data/.gitignore +0 -3
- data/.rspec +0 -2
- data/.rubocop.yml +10 -58
- data/.travis.yml +1 -11
- data/Gemfile +3 -17
- data/Gemfile.lock +14 -150
- data/LICENSE.txt +21 -0
- data/README.md +35 -19
- data/Rakefile +2 -4
- data/bin/console +4 -3
- data/lib/simpleadmin.rb +104 -2
- data/lib/simpleadmin/adapters/base.rb +50 -0
- data/lib/simpleadmin/adapters/postgres.rb +132 -0
- data/lib/simpleadmin/config.rb +83 -0
- data/lib/simpleadmin/database_connector.rb +35 -0
- data/lib/simpleadmin/decorators/fields/base.rb +34 -0
- data/lib/simpleadmin/decorators/fields/image.rb +19 -0
- data/lib/simpleadmin/decorators/fields_decorator.rb +44 -0
- data/lib/simpleadmin/version.rb +3 -1
- data/simpleadmin.gemspec +18 -14
- metadata +29 -35
- data/CODE_OF_CONDUCT.md +0 -74
- data/app/controllers/simple_admin/base_controller.rb +0 -15
- data/app/controllers/simple_admin/entities_controller.rb +0 -26
- data/app/controllers/simple_admin/entity_field_type_actions_controller.rb +0 -13
- data/app/controllers/simple_admin/resources_controller.rb +0 -80
- data/app/controllers/simple_admin/versions_controller.rb +0 -9
- data/app/services/entity_field_types/status_field.rb +0 -8
- data/app/services/entity_service.rb +0 -33
- data/app/services/resource_search_service.rb +0 -22
- data/app/services/resource_service.rb +0 -43
- data/lib/rails/application.rb +0 -13
- data/lib/simpleadmin/application.rb +0 -11
- data/lib/simpleadmin/engine.rb +0 -6
- data/lib/simpleadmin/routes.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d1db0e8c51f5b3749fe3a5daad7cf83b26da39e34b082ac257a3bfb24325e53e
|
4
|
+
data.tar.gz: 543ce9889317c0d062584783f376d2bb6393b918f377f7124963017052fa6b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6303403d3bf6dfbba997b5067619a62047e833305d979fdb26142354e6c75666b0aedcf24e1d073be0f74c834483f0dceeb3e34be25e7e0b9907415e4fd614ac
|
7
|
+
data.tar.gz: 2cf5b9948c19256288b2f38e5ebaf573ddbdbbcc46de75b3f3e63bdf511f7a2d6bdf091c54effef5ca45d203ef702b6a48197c40c7b35708dd3449d6b6bf67cd
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,74 +1,26 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- 'spec/fixtures/**/*'
|
4
|
-
- 'bin/*'
|
5
|
-
- 'spec/support'
|
6
|
-
- 'spec/factories'
|
7
|
-
- 'spec/fixtures'
|
8
|
-
- 'spec/support/*'
|
9
|
-
- 'spec/spec_helper.rb'
|
10
|
-
- 'spec/rails_helper.rb'
|
11
|
-
TargetRubyVersion: 2.5.1
|
12
|
-
DisplayCopNames: true
|
13
|
-
|
14
1
|
Style/Encoding:
|
15
2
|
Enabled: false
|
16
3
|
|
17
|
-
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Style/SpaceAroundEqualsInParameterDefault:
|
4
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
21
5
|
EnforcedStyle: no_space
|
22
6
|
|
23
7
|
Style/ParallelAssignment:
|
24
8
|
Enabled: false
|
25
9
|
|
26
|
-
Style/
|
10
|
+
Style/AccessModifierDeclarations:
|
27
11
|
Enabled: false
|
28
12
|
|
29
|
-
|
30
|
-
|
31
|
-
- "**/*_spec.rb"
|
13
|
+
Style/GuardClause:
|
14
|
+
Enabled: false
|
32
15
|
|
33
16
|
Metrics/BlockLength:
|
34
|
-
|
35
|
-
- "**/*_spec.rb"
|
36
|
-
|
37
|
-
Metrics/LineLength:
|
38
|
-
Max: 160
|
39
|
-
|
40
|
-
Metrics/MethodLength:
|
41
|
-
Max: 30
|
17
|
+
Max: 35
|
42
18
|
|
43
19
|
Metrics/AbcSize:
|
44
|
-
Max:
|
45
|
-
|
46
|
-
Metrics/BlockLength:
|
47
|
-
Max: 100
|
48
|
-
|
49
|
-
Metrics/PerceivedComplexity:
|
50
|
-
Max: 20
|
51
|
-
|
52
|
-
Metrics/CyclomaticComplexity:
|
53
|
-
Max: 20
|
54
|
-
|
55
|
-
Metrics/ParameterLists:
|
56
|
-
Max: 10
|
57
|
-
|
58
|
-
Style/ClassAndModuleChildren:
|
59
|
-
Enabled: false
|
60
|
-
|
61
|
-
Layout/IndentationWidth:
|
62
|
-
Enabled: false
|
63
|
-
|
64
|
-
Layout/IndentationConsistency:
|
65
|
-
Enabled: false
|
66
|
-
|
67
|
-
Style/AccessModifierDeclarations:
|
68
|
-
Enabled: false
|
20
|
+
Max: 30
|
69
21
|
|
70
|
-
|
71
|
-
|
22
|
+
Metrics/MethodLength:
|
23
|
+
Max: 15
|
72
24
|
|
73
|
-
|
74
|
-
|
25
|
+
Metrics/LineLength:
|
26
|
+
Max: 120
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,21 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
gem 'pg', '~> 0.18'
|
8
|
-
gem 'rails', '~> 5.0.6'
|
9
|
-
|
10
|
-
group :test do
|
11
|
-
gem 'codecov', require: false
|
12
|
-
|
13
|
-
gem 'database_cleaner'
|
14
|
-
gem 'rspec-rails'
|
15
|
-
gem 'webmock'
|
16
|
-
|
17
|
-
gem 'pry'
|
18
|
-
|
19
|
-
gem 'factory_bot_rails'
|
20
|
-
gem 'faker'
|
21
|
-
end
|
7
|
+
gem 'codecov', require: false, group: :test
|
data/Gemfile.lock
CHANGED
@@ -1,121 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simpleadmin (1.
|
4
|
+
simpleadmin (1.0.0)
|
5
|
+
bcrypt
|
6
|
+
rack-app
|
7
|
+
sequel
|
5
8
|
|
6
9
|
GEM
|
7
10
|
remote: https://rubygems.org/
|
8
11
|
specs:
|
9
|
-
|
10
|
-
actionpack (= 5.0.7.1)
|
11
|
-
nio4r (>= 1.2, < 3.0)
|
12
|
-
websocket-driver (~> 0.6.1)
|
13
|
-
actionmailer (5.0.7.1)
|
14
|
-
actionpack (= 5.0.7.1)
|
15
|
-
actionview (= 5.0.7.1)
|
16
|
-
activejob (= 5.0.7.1)
|
17
|
-
mail (~> 2.5, >= 2.5.4)
|
18
|
-
rails-dom-testing (~> 2.0)
|
19
|
-
actionpack (5.0.7.1)
|
20
|
-
actionview (= 5.0.7.1)
|
21
|
-
activesupport (= 5.0.7.1)
|
22
|
-
rack (~> 2.0)
|
23
|
-
rack-test (~> 0.6.3)
|
24
|
-
rails-dom-testing (~> 2.0)
|
25
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
26
|
-
actionview (5.0.7.1)
|
27
|
-
activesupport (= 5.0.7.1)
|
28
|
-
builder (~> 3.1)
|
29
|
-
erubis (~> 2.7.0)
|
30
|
-
rails-dom-testing (~> 2.0)
|
31
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
32
|
-
activejob (5.0.7.1)
|
33
|
-
activesupport (= 5.0.7.1)
|
34
|
-
globalid (>= 0.3.6)
|
35
|
-
activemodel (5.0.7.1)
|
36
|
-
activesupport (= 5.0.7.1)
|
37
|
-
activerecord (5.0.7.1)
|
38
|
-
activemodel (= 5.0.7.1)
|
39
|
-
activesupport (= 5.0.7.1)
|
40
|
-
arel (~> 7.0)
|
41
|
-
activesupport (5.0.7.1)
|
42
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
43
|
-
i18n (>= 0.7, < 2)
|
44
|
-
minitest (~> 5.1)
|
45
|
-
tzinfo (~> 1.1)
|
46
|
-
addressable (2.6.0)
|
47
|
-
public_suffix (>= 2.0.2, < 4.0)
|
48
|
-
arel (7.1.4)
|
49
|
-
builder (3.2.3)
|
12
|
+
bcrypt (3.1.13)
|
50
13
|
codecov (0.1.14)
|
51
14
|
json
|
52
15
|
simplecov
|
53
16
|
url
|
54
|
-
coderay (1.1.2)
|
55
|
-
concurrent-ruby (1.1.4)
|
56
|
-
crack (0.4.3)
|
57
|
-
safe_yaml (~> 1.0.0)
|
58
|
-
crass (1.0.4)
|
59
|
-
database_cleaner (1.7.0)
|
60
17
|
diff-lcs (1.3)
|
61
18
|
docile (1.3.1)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
factory_bot (~> 4.11.1)
|
67
|
-
railties (>= 3.0.0)
|
68
|
-
faker (1.9.1)
|
69
|
-
i18n (>= 0.7)
|
70
|
-
globalid (0.4.1)
|
71
|
-
activesupport (>= 4.2.0)
|
72
|
-
hashdiff (0.3.8)
|
73
|
-
i18n (1.3.0)
|
74
|
-
concurrent-ruby (~> 1.0)
|
75
|
-
json (2.1.0)
|
76
|
-
loofah (2.2.3)
|
77
|
-
crass (~> 1.0.2)
|
78
|
-
nokogiri (>= 1.5.9)
|
79
|
-
mail (2.7.1)
|
80
|
-
mini_mime (>= 0.1.1)
|
81
|
-
method_source (0.9.2)
|
82
|
-
mini_mime (1.0.1)
|
83
|
-
mini_portile2 (2.4.0)
|
84
|
-
minitest (5.11.3)
|
85
|
-
nio4r (2.3.1)
|
86
|
-
nokogiri (1.9.1)
|
87
|
-
mini_portile2 (~> 2.4.0)
|
88
|
-
pg (0.21.0)
|
89
|
-
pry (0.12.2)
|
90
|
-
coderay (~> 1.1.0)
|
91
|
-
method_source (~> 0.9.0)
|
92
|
-
public_suffix (3.0.3)
|
93
|
-
rack (2.0.6)
|
94
|
-
rack-test (0.6.3)
|
95
|
-
rack (>= 1.0)
|
96
|
-
rails (5.0.7.1)
|
97
|
-
actioncable (= 5.0.7.1)
|
98
|
-
actionmailer (= 5.0.7.1)
|
99
|
-
actionpack (= 5.0.7.1)
|
100
|
-
actionview (= 5.0.7.1)
|
101
|
-
activejob (= 5.0.7.1)
|
102
|
-
activemodel (= 5.0.7.1)
|
103
|
-
activerecord (= 5.0.7.1)
|
104
|
-
activesupport (= 5.0.7.1)
|
105
|
-
bundler (>= 1.3.0)
|
106
|
-
railties (= 5.0.7.1)
|
107
|
-
sprockets-rails (>= 2.0.0)
|
108
|
-
rails-dom-testing (2.0.3)
|
109
|
-
activesupport (>= 4.2.0)
|
110
|
-
nokogiri (>= 1.6)
|
111
|
-
rails-html-sanitizer (1.0.4)
|
112
|
-
loofah (~> 2.2, >= 2.2.2)
|
113
|
-
railties (5.0.7.1)
|
114
|
-
actionpack (= 5.0.7.1)
|
115
|
-
activesupport (= 5.0.7.1)
|
116
|
-
method_source
|
117
|
-
rake (>= 0.8.7)
|
118
|
-
thor (>= 0.18.1, < 2.0)
|
19
|
+
json (2.2.0)
|
20
|
+
rack (2.0.7)
|
21
|
+
rack-app (7.5.2)
|
22
|
+
rack
|
119
23
|
rake (10.5.0)
|
120
24
|
rspec (3.8.0)
|
121
25
|
rspec-core (~> 3.8.0)
|
@@ -123,70 +27,30 @@ GEM
|
|
123
27
|
rspec-mocks (~> 3.8.0)
|
124
28
|
rspec-core (3.8.0)
|
125
29
|
rspec-support (~> 3.8.0)
|
126
|
-
rspec-expectations (3.8.
|
30
|
+
rspec-expectations (3.8.3)
|
127
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
128
32
|
rspec-support (~> 3.8.0)
|
129
33
|
rspec-mocks (3.8.0)
|
130
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
131
35
|
rspec-support (~> 3.8.0)
|
132
|
-
rspec-rails (3.8.2)
|
133
|
-
actionpack (>= 3.0)
|
134
|
-
activesupport (>= 3.0)
|
135
|
-
railties (>= 3.0)
|
136
|
-
rspec-core (~> 3.8.0)
|
137
|
-
rspec-expectations (~> 3.8.0)
|
138
|
-
rspec-mocks (~> 3.8.0)
|
139
|
-
rspec-support (~> 3.8.0)
|
140
36
|
rspec-support (3.8.0)
|
141
|
-
|
37
|
+
sequel (5.22.0)
|
142
38
|
simplecov (0.16.1)
|
143
39
|
docile (~> 1.1)
|
144
40
|
json (>= 1.8, < 3)
|
145
41
|
simplecov-html (~> 0.10.0)
|
146
42
|
simplecov-html (0.10.2)
|
147
|
-
sprockets (3.7.2)
|
148
|
-
concurrent-ruby (~> 1.0)
|
149
|
-
rack (> 1, < 3)
|
150
|
-
sprockets-rails (3.2.1)
|
151
|
-
actionpack (>= 4.0)
|
152
|
-
activesupport (>= 4.0)
|
153
|
-
sprockets (>= 3.0.0)
|
154
|
-
thor (0.20.3)
|
155
|
-
thread_safe (0.3.6)
|
156
|
-
tzinfo (1.2.5)
|
157
|
-
thread_safe (~> 0.1)
|
158
43
|
url (0.3.2)
|
159
|
-
webmock (3.5.1)
|
160
|
-
addressable (>= 2.3.6)
|
161
|
-
crack (>= 0.3.2)
|
162
|
-
hashdiff
|
163
|
-
websocket-driver (0.6.5)
|
164
|
-
websocket-extensions (>= 0.1.0)
|
165
|
-
websocket-extensions (0.1.3)
|
166
44
|
|
167
45
|
PLATFORMS
|
168
46
|
ruby
|
169
47
|
|
170
48
|
DEPENDENCIES
|
171
|
-
|
172
|
-
actionview
|
173
|
-
activerecord
|
174
|
-
bundler (~> 1.15)
|
49
|
+
bundler (~> 1.16)
|
175
50
|
codecov
|
176
|
-
database_cleaner
|
177
|
-
factory_bot_rails
|
178
|
-
faker
|
179
|
-
pg (~> 0.18)
|
180
|
-
pry
|
181
|
-
rails (~> 5.0.6)
|
182
51
|
rake (~> 10.0)
|
183
|
-
rspec
|
184
|
-
rspec-rails
|
52
|
+
rspec
|
185
53
|
simpleadmin!
|
186
|
-
webmock
|
187
|
-
|
188
|
-
RUBY VERSION
|
189
|
-
ruby 2.4.1p111
|
190
54
|
|
191
55
|
BUNDLED WITH
|
192
|
-
1.
|
56
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Dmitriy Strukov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
-
[](http://travis-ci.org/getsimpleadmin/simpleadmin) [](https://codecov.io/github/getsimpleadmin/simpleadmin?branch=master)[](https://rubygems.org/gems/simpleadmin)
|
2
|
+
# [SimpleAdmin](https://getsimpleadmin-staging.herokuapp.com/)
|
2
3
|
|
3
|
-
|
4
|
+
SimpleAdmin provides builder for administrative dashboards, it's fit for Web / Mobile / API. Cloud or your own servers, depends on your choice and requirements.
|
4
5
|
|
5
|
-
|
6
|
+
All common admin dashboard tasks like content create / update / delete operations, charts, invite colleagues.
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
This is small API library to connect your application with SimpleAdmin service.
|
8
|
+
This is API Rack Application to connect your application with SimpleAdmin service.
|
10
9
|
|
11
10
|
[Example Application][demo]
|
12
11
|
|
13
12
|
## Requirements
|
14
13
|
|
15
|
-
- Ruby ~> 2.3
|
16
|
-
- Rails ~> 5.0;
|
14
|
+
- Ruby ~> 2.3
|
17
15
|
|
18
16
|
## Installation
|
19
17
|
|
20
|
-

|
21
19
|
|
22
20
|
Add SimpleAdmin to your application's Gemfile:
|
23
21
|
|
@@ -30,21 +28,15 @@ And then run:
|
|
30
28
|
```ruby
|
31
29
|
bundle install
|
32
30
|
```
|
33
|
-
**NOTE**: If you want to test your local project you'll needing to install [ngrok][ngrok] and run following command:
|
34
|
-
```ruby
|
35
|
-
./ngrok http 3000
|
36
|
-
```
|
37
|
-
|
38
|
-
Copy your Forwadding URL (http://exampleapp.ngrok.io) and use it when you will be creating a project (column url).
|
39
31
|
|
40
32
|
## Configuration
|
41
33
|
|
42
|
-
Add
|
34
|
+
Add the next line to your routes file to mount simpleadmin built-in routes:
|
43
35
|
|
44
36
|
```ruby
|
45
37
|
# config/routes.rb
|
46
38
|
Rails.application.routes.draw do
|
47
|
-
|
39
|
+
mount Simpleadmin::Application, at: 'simpleadmin'
|
48
40
|
end
|
49
41
|
```
|
50
42
|
|
@@ -53,6 +45,31 @@ Create initializer, add your secret key and restart server
|
|
53
45
|
```ruby
|
54
46
|
# config/initializers/simpleadmin.rb
|
55
47
|
ENV['SIMPLE_ADMIN_SECRET_KEY'] = 'SECRET_KEY'
|
48
|
+
|
49
|
+
Simpleadmin::Config.setup do |config|
|
50
|
+
config.database_credentials = {
|
51
|
+
adapter: :postgres,
|
52
|
+
database: 'demo_development'
|
53
|
+
}
|
54
|
+
|
55
|
+
# You can select what tables you want to use in the admin panel
|
56
|
+
config.allowed_tables = ['users', 'orders']
|
57
|
+
|
58
|
+
# Allow all tables
|
59
|
+
# config.allowed_tables = [:all]
|
60
|
+
|
61
|
+
config.on_create = lambda do |model_class, resource_params|
|
62
|
+
model_class.create(resource_params)
|
63
|
+
end
|
64
|
+
|
65
|
+
config.on_update = lambda do |model_class, resource_id, resource_params|
|
66
|
+
model_class.find(resource_id).update(resource_params)
|
67
|
+
end
|
68
|
+
|
69
|
+
config.on_destroy = lambda do |model_class, resource_id|
|
70
|
+
model_class.find(resource_id).destroy
|
71
|
+
end
|
72
|
+
end
|
56
73
|
```
|
57
74
|
|
58
75
|
## Contributing
|
@@ -63,5 +80,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/getsim
|
|
63
80
|
|
64
81
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
65
82
|
|
66
|
-
[demo]: https://getsimpleadmin.com/
|
67
|
-
[ngrok]: https://ngrok.com/
|
83
|
+
[demo]: https://getsimpleadmin-staging.herokuapp.com/demo/admin/customer/resources
|