simpleadmin 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5475a7e55a4a8672e7524500c27e92399dab2440
4
- data.tar.gz: 168b7ac2be2630a294ca30cd5cf32922ccd554a8
3
+ metadata.gz: d24bb4088260152dd39c1f8646f3c340c3966022
4
+ data.tar.gz: 4e0bb41b01affa610f0c4c118a0c26dcf5df6328
5
5
  SHA512:
6
- metadata.gz: ed8202a0810a0bf7957d4abda2a3cb63b76a5725dca2124ce9f1919eb8eecc31d86b737e4496ef3c7d5fd809c293fbfffdafe88cef5b04bc892309d613478f8e
7
- data.tar.gz: 5b7e63c249a5ed08c29e66af599cbcee9de17e71a8c49eade317f6def70aa964c0856bbb9b90da72a18fe1aa5de25ddc4902c2400c514e846ad333ec03c19f6c
6
+ metadata.gz: 26491122a5263e40004d2905735fdce4746a018f5411461e515da0adcadb7f08868f1bbb0ebfaa312507eb8a2bdba92ece5c7d6629a11a450405015256b0ac47
7
+ data.tar.gz: 78b7143d2132d9f00f7d1d8982c4ff4b9aa118d6bc8bb952149586d008532298c371926b6f2d8dd6384025b774fc1542c516131b61343c917c5b485ecc95141a
data/README.md CHANGED
@@ -1,18 +1,45 @@
1
+ [![Gem Version](https://badge.fury.io/rb/simpleadmin.svg)](https://rubygems.org/gems/simpleadmin)
2
+ [![Gitter](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/simpleadmin-rails/Lobby)
3
+
4
+
1
5
  # SimpleAdmin
2
6
 
3
- API library to connect your application with SimpleAdmin service and create admin dashboards in an instant. [Try the demo][demo]
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
- ## Getting started
13
+ ## Requirements
14
+
15
+ - Ruby ~> 2.3;
16
+ - Rails ~> 5.0;
17
+
18
+ ## Installation
6
19
 
7
20
  ![simple_admin](https://image.ibb.co/mTjOpe/simpleadmin_preview.png)
8
21
 
9
- Add SimpleAdmin to your Gemfile and run bundle:
22
+ Add SimpleAdmin to your application's Gemfile:
10
23
 
11
24
  ```ruby
12
25
  gem 'simpleadmin'
13
26
  ```
14
27
 
15
- After that, you need to mount simple admin built-in routes:
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
- 1. Fork it ( https://github.com/evil-raccoon/simple_admin/fork )
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
- Released under MIT License.
62
+ ## License
42
63
 
43
- Copyright © 2018 SimpleAdmin.
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
- entities_names: ApplicationRecord.descendants.map { |model| model.name }
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
 
@@ -0,0 +1,9 @@
1
+ module SimpleAdmin
2
+ class VersionsController < BaseController
3
+ def show
4
+ render json: {
5
+ version: Simpleadmin::VERSION
6
+ }
7
+ end
8
+ end
9
+ end
@@ -17,7 +17,7 @@ module ActionDispatch::Routing
17
17
  resources :entities, only: [:index, :show]
18
18
  resources :resources
19
19
 
20
- post 'verify_key' => 'credentials#verify_key'
20
+ get 'version', to: 'versions#show'
21
21
  end
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Simpleadmin
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
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.3
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-06 00:00:00.000000000 Z
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