simple-admin 0.1.2.pre.alpha → 0.2.0.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/Gemfile +1 -1
- data/README.md +34 -0
- data/app/assets/javascripts/simple_admin/application.js +3 -1
- data/app/assets/javascripts/simple_admin/components/notification.js +7 -0
- data/app/assets/javascripts/simple_admin/components/tabs.js +7 -0
- data/app/assets/javascripts/simple_admin/components/tags.js +11 -0
- data/app/helpers/simple_admin_helper.rb +0 -4
- data/app/models/simple_admin/entity_field.rb +2 -2
- data/app/models/simple_admin/entity_field_type.rb +2 -4
- data/lib/generators/simple_admin/model_entities_generator.rb +7 -0
- data/lib/simple_admin/engine.rb +3 -2
- data/lib/simple_admin/refinements/boolean.rb +1 -1
- data/lib/simple_admin/resource_controller/actions_builder.rb +1 -1
- data/lib/simple_admin/resource_controller/controller_builder.rb +1 -1
- data/lib/simple_admin/resource_controller/crudify.rb +1 -1
- data/lib/simple_admin/resource_controller/crudify_dynamic_resource.rb +1 -1
- data/lib/simple_admin/resource_controller/dynamic_fields.rb +2 -2
- data/lib/simple_admin/routes.rb +33 -0
- data/lib/simple_admin/version.rb +1 -1
- data/simple-admin.gemspec +4 -3
- metadata +19 -16
- data/app/assets/javascripts/simple_admin/core.js +0 -12
- data/config/routes.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 918b5fdf9d9832094529ef09ba88f69adfe25e2e
|
4
|
+
data.tar.gz: db38dafc747766b9035aa868917aef2436250434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a331210fab23a5350425d379e67cf3eafa18a227aa28377ac9675b55df9754b5fac92c47000768b73595360f193c09d747f7db53a5770fbf8792a6ea2e9b719
|
7
|
+
data.tar.gz: a147d76f702bf61b237a0db5f4944e4f073d20849257cff09459166788205b872965f076c3c9d11263656ce12934b3e7cc41451d429e5e43089e7cc786b6c57f
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# SimpleAdmin
|
2
|
+
A framework for creating admin dashboards in an instant.
|
3
|
+
|
4
|
+
## v0.1.2-alpha - 2018-01-07
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
- [Dmitriy Strukov] Remove user model template in the initialize generator
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- [Dmitriy Strukov] Remove `rails-ujs` and move tabs logic to another file
|
11
|
+
- [Dmitriy Strukov] Number field form template
|
12
|
+
|
13
|
+
## v0.1.1-alpha - 2018-01-02
|
14
|
+
|
15
|
+
### Added
|
16
|
+
- [Dmitriy Strukov] Create Issue template
|
17
|
+
- [Marina Belova] Entity and fields generator. This is useful for large models with many fields quantity.
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
- [Dmitriy Strukov] Use locales instead of hardcode in templates
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
- [Dmitriy Strukov] Pagination styles
|
24
|
+
|
25
|
+
## v0.1.0-alpha - 2017-12-06
|
26
|
+
### Added
|
27
|
+
- [Dmitriy Strukov] Allow to manage a fields for entities
|
28
|
+
|
29
|
+
- [Dmitriy Strukov] Introduced built in resources in admin panel
|
30
|
+
- [Dmitriy Strukov] Introduced `rails g simple_admin:install` generator
|
31
|
+
- [Dmitriy Strukov] Introduced `rails g simple_admin:migration` generator
|
32
|
+
|
33
|
+
- [Dmitriy Strukov] Introduced `SimpleAdmin::ResourceController::ControllerBuilder` runtime controller builder
|
34
|
+
- [Dmitriy Strukov] Introduced `SimpleAdmin::Search` for dynamically searching by selected fields
|
35
|
+
- [Dmitriy Strukov] Introduced `SimpleAdmin::ResourceController::Crudify` as CRUD for standard controller
|
36
|
+
- [Dmitriy Strukov] Introduced `SimpleAdmin::ResourceController::CrudifyDynamicResource` as CRUD for controller with dynamic actions
|
37
|
+
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -57,6 +57,40 @@ After that create next partial:
|
|
57
57
|
</ul>
|
58
58
|
```
|
59
59
|
|
60
|
+
### Devise integration
|
61
|
+
Simple Admin supports devise, you need to add into the Gemfile `gem 'devise'` and run `rails generate simple_admin:install`. This will create view templates for authentication and registration, after that you need to create layout:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
# app/views/layouts/devise.html.erb
|
65
|
+
|
66
|
+
<!DOCTYPE html>
|
67
|
+
<html>
|
68
|
+
<head>
|
69
|
+
<title>Exampleapp</title>
|
70
|
+
<%= csrf_meta_tags %>
|
71
|
+
|
72
|
+
<%= stylesheet_link_tag 'simple_admin/application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
73
|
+
<%= javascript_include_tag 'simple_admin/application', 'data-turbolinks-track': 'reload' %>
|
74
|
+
</head>
|
75
|
+
|
76
|
+
<body>
|
77
|
+
<%= yield %>
|
78
|
+
</body>
|
79
|
+
</html>
|
80
|
+
```
|
81
|
+
|
82
|
+
And add the layout to `application.rb`:
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
module Exampleapp
|
86
|
+
class Application < Rails::Application
|
87
|
+
config.to_prepare do
|
88
|
+
Devise::SessionsController.layout 'devise'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
```
|
93
|
+
|
60
94
|
## Customization
|
61
95
|
You have two different ways to customize admin panel entities and fields, first way it's to use built in generator, it automatically create all fields for form and collection pages (excepting timestamps and id). All you need is run next command:
|
62
96
|
|
@@ -8,8 +8,4 @@ module SimpleAdminHelper
|
|
8
8
|
def resources_pagination_end(per_page, current_page)
|
9
9
|
(per_page * current_page.to_i) + 1
|
10
10
|
end
|
11
|
-
|
12
|
-
def resource_index_path(resource_name, prefix=:admin_system, postfix=:path)
|
13
|
-
public_send("#{prefix}_#{resource_name}_#{postfix}")
|
14
|
-
end
|
15
11
|
end
|
@@ -42,7 +42,7 @@ module SimpleAdmin
|
|
42
42
|
#
|
43
43
|
# @return [ActiveRecord Class]
|
44
44
|
#
|
45
|
-
# @since 0.1.0
|
45
|
+
# @since 0.1.0-alpha
|
46
46
|
def association_klass
|
47
47
|
model_instance = entity.model_klass.new
|
48
48
|
association_name = name.remove('_id')
|
@@ -54,7 +54,7 @@ module SimpleAdmin
|
|
54
54
|
#
|
55
55
|
# @return [String]
|
56
56
|
#
|
57
|
-
# @since 0.1.0
|
57
|
+
# @since 0.1.0-alpha
|
58
58
|
def template_path
|
59
59
|
"#{entity_field_type.template}/#{presentation}"
|
60
60
|
end
|
@@ -17,7 +17,7 @@ module SimpleAdmin
|
|
17
17
|
# SimpleAdmin::EntityField.create_string_field(name: :title, entity: entity, presentation: :collection)
|
18
18
|
# SimpleAdmin::EntityField.create_number_field(name: :id, entity: entity, presentation: :collection)
|
19
19
|
#
|
20
|
-
# @since 0.1.0
|
20
|
+
# @since 0.1.0-alpha
|
21
21
|
def build_helper_methods!
|
22
22
|
pluck(:name).each do |field_type_name|
|
23
23
|
SimpleAdmin::EntityField.define_singleton_method("create_#{field_type_name}_field") do |params|
|
@@ -52,9 +52,7 @@ module SimpleAdmin
|
|
52
52
|
"app/views/#{template}/_collection.*"
|
53
53
|
end
|
54
54
|
|
55
|
-
unless template_exists?(collection_template_path)
|
56
|
-
errors.add(:base, 'Collection template missing')
|
57
|
-
end
|
55
|
+
errors.add(:base, 'Collection template missing') unless template_exists?(collection_template_path)
|
58
56
|
end
|
59
57
|
|
60
58
|
def validate_form_template!
|
@@ -3,6 +3,13 @@ require 'rails/generators/base'
|
|
3
3
|
module SimpleAdmin
|
4
4
|
module Generators
|
5
5
|
class ModelEntitiesGenerator < Rails::Generators::NamedBase
|
6
|
+
# Generate SimpleAdmin::Entity by transmitted model
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# rails generate simple_admin:model_entities Post
|
10
|
+
#
|
11
|
+
# @since 0.1.2-alpha
|
12
|
+
|
6
13
|
source_root File.expand_path('../../templates', __FILE__)
|
7
14
|
|
8
15
|
EXCLUSION_FIELDS = /\bid\b|created_at|updated_at/
|
data/lib/simple_admin/engine.rb
CHANGED
@@ -10,7 +10,7 @@ module SimpleAdmin
|
|
10
10
|
#
|
11
11
|
# ...
|
12
12
|
# end
|
13
|
-
# @since 0.1.0
|
13
|
+
# @since 0.1.0-alpha
|
14
14
|
|
15
15
|
extend ActiveSupport::Concern
|
16
16
|
|
@@ -19,7 +19,7 @@ module SimpleAdmin
|
|
19
19
|
|
20
20
|
# Receives entity and entity fields by model class and field_presentation
|
21
21
|
#
|
22
|
-
# @since 0.1.0
|
22
|
+
# @since 0.1.0-alpha
|
23
23
|
def initialize_fields_entities!
|
24
24
|
@entity = SimpleAdmin::Entity.find_by(model_klass_name: model_klass.to_s)
|
25
25
|
@entity_fields = @entity.entity_fields.where(presentation: field_presentation)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module ActionDispatch::Routing
|
2
|
+
class Mapper
|
3
|
+
# Contain built-in routes
|
4
|
+
#
|
5
|
+
# @example
|
6
|
+
#
|
7
|
+
# # config/routes.rb
|
8
|
+
#
|
9
|
+
# Rails.application.routes.draw do
|
10
|
+
# mount_for_simple_admin
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# @since 0.1.2-alpha
|
14
|
+
|
15
|
+
def mount_for_simple_admin
|
16
|
+
scope module: :simple_admin do
|
17
|
+
namespace :admin do
|
18
|
+
root 'system/entities#index'
|
19
|
+
|
20
|
+
get :search, to: 'search#index'
|
21
|
+
|
22
|
+
SimpleAdmin.mount_entities!(self) if ActiveRecord::Base.connection.table_exists?(:simple_admin_entities)
|
23
|
+
|
24
|
+
namespace :system do
|
25
|
+
resources :entities
|
26
|
+
resources :entity_field_types
|
27
|
+
resources :entity_fields, only: %i[create update destroy]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/simple_admin/version.rb
CHANGED
data/simple-admin.gemspec
CHANGED
@@ -32,7 +32,8 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'actionview'
|
33
33
|
spec.add_development_dependency 'activerecord'
|
34
34
|
|
35
|
-
spec.add_dependency 'bootstrap-sass'
|
36
|
-
spec.add_dependency 'jquery-ui-rails'
|
37
|
-
|
35
|
+
spec.add_dependency 'bootstrap-sass', '~> 3.3.7'
|
36
|
+
spec.add_dependency 'jquery-ui-rails', '~> 6.0.1'
|
37
|
+
|
38
|
+
spec.add_dependency 'kaminari', '~> 1.1.1'
|
38
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.pre.alpha
|
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-01-
|
11
|
+
date: 2018-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,44 +98,44 @@ dependencies:
|
|
98
98
|
name: bootstrap-sass
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 3.3.7
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 3.3.7
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: jquery-ui-rails
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 6.0.1
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 6.0.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: kaminari
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.1.1
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 1.1.1
|
139
139
|
description: simple-admin
|
140
140
|
email:
|
141
141
|
- dmitiry_strukov2011@mail.ru
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- ".rspec"
|
152
152
|
- ".rubocop.yml"
|
153
153
|
- ".travis.yml"
|
154
|
+
- CHANGELOG.md
|
154
155
|
- CODE_OF_CONDUCT.md
|
155
156
|
- CONTRIBUTING.md
|
156
157
|
- Gemfile
|
@@ -160,7 +161,9 @@ files:
|
|
160
161
|
- Rakefile
|
161
162
|
- app/assets/fonts/Simple-Line-Icons.woff
|
162
163
|
- app/assets/javascripts/simple_admin/application.js
|
163
|
-
- app/assets/javascripts/simple_admin/
|
164
|
+
- app/assets/javascripts/simple_admin/components/notification.js
|
165
|
+
- app/assets/javascripts/simple_admin/components/tabs.js
|
166
|
+
- app/assets/javascripts/simple_admin/components/tags.js
|
164
167
|
- app/assets/stylesheets/simple_admin/application.scss
|
165
168
|
- app/assets/stylesheets/simple_admin/global/buttons.css
|
166
169
|
- app/assets/stylesheets/simple_admin/global/errors.css
|
@@ -245,7 +248,6 @@ files:
|
|
245
248
|
- codecov.yml
|
246
249
|
- config/locales/en.yml
|
247
250
|
- config/locales/ru.yml
|
248
|
-
- config/routes.rb
|
249
251
|
- lib/generators/simple_admin/install_generator.rb
|
250
252
|
- lib/generators/simple_admin/migration_generator.rb
|
251
253
|
- lib/generators/simple_admin/model_entities_generator.rb
|
@@ -270,6 +272,7 @@ files:
|
|
270
272
|
- lib/simple_admin/resource_controller/crudify.rb
|
271
273
|
- lib/simple_admin/resource_controller/crudify_dynamic_resource.rb
|
272
274
|
- lib/simple_admin/resource_controller/dynamic_fields.rb
|
275
|
+
- lib/simple_admin/routes.rb
|
273
276
|
- lib/simple_admin/search.rb
|
274
277
|
- lib/simple_admin/version.rb
|
275
278
|
- simple-admin.gemspec
|
data/config/routes.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Rails.application.routes.draw do
|
2
|
-
scope module: :simple_admin do
|
3
|
-
namespace :admin do
|
4
|
-
root 'system/users#index'
|
5
|
-
|
6
|
-
get :search, to: 'search#index'
|
7
|
-
|
8
|
-
if ActiveRecord::Base.connection.table_exists?(:simple_admin_entities)
|
9
|
-
SimpleAdmin.mount_entities!(self)
|
10
|
-
end
|
11
|
-
|
12
|
-
namespace :system do
|
13
|
-
resources :entities
|
14
|
-
resources :entity_field_types
|
15
|
-
resources :entity_fields, only: [:create, :update, :destroy]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|