simpleadmin 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/app/controllers/simple_admin/resources_controller.rb +15 -1
- data/lib/rails/application.rb +13 -0
- data/lib/simpleadmin.rb +2 -0
- data/lib/simpleadmin/application.rb +11 -0
- data/lib/simpleadmin/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b711f46a984f06aac16634d1204c8698fa5daa3a
|
4
|
+
data.tar.gz: 6f87c6c89e6b7cd79525d4497414ec8e178932a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46e480e28143e14c3237c41f535318ce31afabe079cdb8203c0e10e46e690f53ea101c17cc9ab8ce85fb13288314abc3df2f1f91d47635d7a5dea9f1162d09df
|
7
|
+
data.tar.gz: e57443cf34ec0b11aa38cd3f7e496363593176f53a53eeb43413e40a030a7b01bb6cee00bed4d509946fb6812cb27c3fcdf446c79b50fcd46158b46934231104
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Build Status](https://secure.travis-ci.org/getsimpleadmin/simpleadmin.svg?branch=master)](http://travis-ci.org/getsimpleadmin/simpleadmin) [![codecov.io](https://codecov.io/github/getsimpleadmin/simpleadmin/coverage.svg?branch=master)](https://codecov.io/github/getsimpleadmin/simpleadmin?branch=master)[![Gem Version](https://badge.fury.io/rb/simpleadmin.svg)](https://rubygems.org/gems/simpleadmin)[![Maintainability](https://api.codeclimate.com/v1/badges/ca0015b11992514879c5/maintainability)](https://codeclimate.com/github/getsimpleadmin/simpleadmin/maintainability)
|
1
|
+
[![Build Status](https://secure.travis-ci.org/getsimpleadmin/simpleadmin-rails.svg?branch=master)](http://travis-ci.org/getsimpleadmin/simpleadmin-rails) [![codecov.io](https://codecov.io/github/getsimpleadmin/simpleadmin-rails/coverage.svg?branch=master)](https://codecov.io/github/getsimpleadmin/simpleadmin-rails?branch=master)[![Gem Version](https://badge.fury.io/rb/simpleadmin.svg)](https://rubygems.org/gems/simpleadmin)[![Maintainability](https://api.codeclimate.com/v1/badges/ca0015b11992514879c5/maintainability)](https://codeclimate.com/github/getsimpleadmin/simpleadmin-rails/maintainability)
|
2
2
|
|
3
3
|
# [SimpleAdmin](http://getsimpleadmin.com)
|
4
4
|
|
@@ -6,7 +6,7 @@ SimpleAdmin is a service for people with no special skills that enables a simple
|
|
6
6
|
|
7
7
|
You do not need to waste your time on development and technical support. The Simple Admin team will help you pay focus on the key thing – your Product.
|
8
8
|
|
9
|
-
This is small API library to connect your application with SimpleAdmin service.
|
9
|
+
This is small API library to connect your application with SimpleAdmin service.
|
10
10
|
|
11
11
|
[Example Application][demo]
|
12
12
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module SimpleAdmin
|
2
2
|
class ResourcesController < BaseController
|
3
|
+
before_action :load_models!
|
4
|
+
|
3
5
|
def index
|
4
6
|
resource_service = ResourceService.new(model_klass, model_fields)
|
5
7
|
|
@@ -51,8 +53,20 @@ module SimpleAdmin
|
|
51
53
|
|
52
54
|
private
|
53
55
|
|
56
|
+
def load_models!
|
57
|
+
Rails.application.load_models!
|
58
|
+
end
|
59
|
+
|
54
60
|
def model_klass
|
55
|
-
params[:model_klass_name].
|
61
|
+
model = params[:model_klass_name].safe_constantize
|
62
|
+
|
63
|
+
if ApplicationRecord.descendants.include?(model)
|
64
|
+
model
|
65
|
+
elsif model.nil?
|
66
|
+
raise ArgumentError
|
67
|
+
else
|
68
|
+
raise SecurityError
|
69
|
+
end
|
56
70
|
end
|
57
71
|
|
58
72
|
def model_fields
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Rails
|
2
|
+
class Application
|
3
|
+
def load_models!
|
4
|
+
load_path = 'app/models'
|
5
|
+
|
6
|
+
matcher = /\A#{Regexp.escape(load_path.to_s)}\/(.*)\.rb\Z/
|
7
|
+
|
8
|
+
Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
|
9
|
+
require_dependency file.sub(matcher, '\1')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/simpleadmin.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.
|
4
|
+
version: 1.4.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: 2019-01-
|
11
|
+
date: 2019-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,7 +121,9 @@ files:
|
|
121
121
|
- app/services/resource_service.rb
|
122
122
|
- bin/console
|
123
123
|
- bin/setup
|
124
|
+
- lib/rails/application.rb
|
124
125
|
- lib/simpleadmin.rb
|
126
|
+
- lib/simpleadmin/application.rb
|
125
127
|
- lib/simpleadmin/engine.rb
|
126
128
|
- lib/simpleadmin/routes.rb
|
127
129
|
- lib/simpleadmin/version.rb
|