simpleadmin 1.0.3 → 1.1.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/README.md +35 -13
- data/app/controllers/simple_admin/entities_controller.rb +10 -1
- data/app/controllers/simple_admin/resources_controller.rb +2 -2
- data/app/controllers/simple_admin/versions_controller.rb +9 -0
- data/lib/simpleadmin/routes.rb +1 -1
- data/lib/simpleadmin/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d24bb4088260152dd39c1f8646f3c340c3966022
|
4
|
+
data.tar.gz: 4e0bb41b01affa610f0c4c118a0c26dcf5df6328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26491122a5263e40004d2905735fdce4746a018f5411461e515da0adcadb7f08868f1bbb0ebfaa312507eb8a2bdba92ece5c7d6629a11a450405015256b0ac47
|
7
|
+
data.tar.gz: 78b7143d2132d9f00f7d1d8982c4ff4b9aa118d6bc8bb952149586d008532298c371926b6f2d8dd6384025b774fc1542c516131b61343c917c5b485ecc95141a
|
data/README.md
CHANGED
@@ -1,18 +1,45 @@
|
|
1
|
+
[](https://rubygems.org/gems/simpleadmin)
|
2
|
+
[](https://gitter.im/simpleadmin-rails/Lobby)
|
3
|
+
|
4
|
+
|
1
5
|
# SimpleAdmin
|
2
6
|
|
3
|
-
|
7
|
+
SimpleAdmin allows you to create a personalized administrative panel for your business and edit it without special knowledge in programming and works with any stack, because you are not tied to a specific programming language.
|
8
|
+
|
9
|
+
This is small API library to connect your application with SimpleAdmin service.
|
10
|
+
|
11
|
+
[Example Application][demo]
|
4
12
|
|
5
|
-
##
|
13
|
+
## Requirements
|
14
|
+
|
15
|
+
- Ruby ~> 2.3;
|
16
|
+
- Rails ~> 5.0;
|
17
|
+
|
18
|
+
## Installation
|
6
19
|
|
7
20
|

|
8
21
|
|
9
|
-
Add SimpleAdmin to your Gemfile
|
22
|
+
Add SimpleAdmin to your application's Gemfile:
|
10
23
|
|
11
24
|
```ruby
|
12
25
|
gem 'simpleadmin'
|
13
26
|
```
|
14
27
|
|
15
|
-
|
28
|
+
And then run:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
bundle install
|
32
|
+
```
|
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
|
+
|
40
|
+
## Configuration
|
41
|
+
|
42
|
+
Add method `mount_simpleadmin` to your routes file to mount simpleadmin built-in routes:
|
16
43
|
|
17
44
|
```ruby
|
18
45
|
# config/routes.rb
|
@@ -30,16 +57,11 @@ ENV['SIMPLE_ADMIN_SECRET_KEY'] = 'SECRET_KEY'
|
|
30
57
|
|
31
58
|
## Contributing
|
32
59
|
|
33
|
-
|
34
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
-
5. Create a new Pull Request
|
38
|
-
|
39
|
-
## Copyright
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/getsimpleadmin/simpleadmin.
|
40
61
|
|
41
|
-
|
62
|
+
## License
|
42
63
|
|
43
|
-
|
64
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
44
65
|
|
45
66
|
[demo]: https://getsimpleadmin.com/en/demo/admin/resources?model_klass_name=Post
|
67
|
+
[ngrok]: https://ngrok.com/
|
@@ -3,8 +3,17 @@ module SimpleAdmin
|
|
3
3
|
before_action :load_models
|
4
4
|
|
5
5
|
def index
|
6
|
+
models = []
|
7
|
+
|
8
|
+
ApplicationRecord.descendants.each do |model|
|
9
|
+
models << {
|
10
|
+
name: model.name,
|
11
|
+
columns: model.columns.map { |column| { name: column.name, type: column.sql_type.parameterize.underscore } }
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
6
15
|
render json: {
|
7
|
-
|
16
|
+
models: models
|
8
17
|
}
|
9
18
|
end
|
10
19
|
|
@@ -2,7 +2,7 @@ module SimpleAdmin
|
|
2
2
|
class ResourcesController < BaseController
|
3
3
|
def index
|
4
4
|
model_klass = params[:model_klass_name].constantize
|
5
|
-
model_fields = params[:model_fields]
|
5
|
+
model_fields = params[:model_fields].map { |field_attributes| field_attributes[:field_name] }
|
6
6
|
|
7
7
|
per_page = params[:per_page].to_i
|
8
8
|
page = params[:page].to_i if params[:page].present?
|
@@ -45,7 +45,7 @@ module SimpleAdmin
|
|
45
45
|
|
46
46
|
def show
|
47
47
|
model_klass = params[:model_klass_name].constantize
|
48
|
-
model_fields = params[:model_fields]
|
48
|
+
model_fields = params[:model_fields].map { |model_field| model_field['field_name'] }
|
49
49
|
|
50
50
|
resource = model_klass.find(params[:id]).attributes.slice(*model_fields)
|
51
51
|
|
data/lib/simpleadmin/routes.rb
CHANGED
data/lib/simpleadmin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simpleadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Strukov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- app/controllers/simple_admin/base_controller.rb
|
112
112
|
- app/controllers/simple_admin/entities_controller.rb
|
113
113
|
- app/controllers/simple_admin/resources_controller.rb
|
114
|
+
- app/controllers/simple_admin/versions_controller.rb
|
114
115
|
- bin/console
|
115
116
|
- bin/setup
|
116
117
|
- lib/simpleadmin.rb
|