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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bf0afcf85c61c6204b30e4c54387fb396229cf7
4
- data.tar.gz: fb1485737c969acd5bf3a4e7dad402cc55db903c
3
+ metadata.gz: 918b5fdf9d9832094529ef09ba88f69adfe25e2e
4
+ data.tar.gz: db38dafc747766b9035aa868917aef2436250434
5
5
  SHA512:
6
- metadata.gz: f62a4ff1b346e034c1e4999909d17965767305a80a0b6e21393082bb82a83925cf60d00e35f28b17625a0f7344ce937875422548e330932251801873c0495eaa
7
- data.tar.gz: f017439734ea3a7989a7dab92b22c2fe84ce14b48bf52e63a1dc9d8d476b5ba429cb0c21bbc197749bc2bce802320e5725dd520ca313c5bf09ce423662fcb1f4
6
+ metadata.gz: 1a331210fab23a5350425d379e67cf3eafa18a227aa28377ac9675b55df9754b5fac92c47000768b73595360f193c09d747f7db53a5770fbf8792a6ea2e9b719
7
+ data.tar.gz: a147d76f702bf61b237a0db5f4944e4f073d20849257cff09459166788205b872965f076c3c9d11263656ce12934b3e7cc41451d429e5e43089e7cc786b6c57f
@@ -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
@@ -6,7 +6,7 @@ ruby '2.4.1'
6
6
 
7
7
  gem 'rails', '~> 5.0.0'
8
8
 
9
- gem 'pg'
9
+ gem 'pg', '~> 0.18'
10
10
  gem 'rdoc', require: false
11
11
 
12
12
  group :development, :test do
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
 
@@ -13,4 +13,6 @@
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
15
  //= require jquery-ui/widgets/tabs
16
- //= require simple_admin/core
16
+ //= require simple_admin/components/notification
17
+ //= require simple_admin/components/tabs
18
+ //= require simple_admin/components/tags
@@ -0,0 +1,7 @@
1
+ $(document).ready(function() {
2
+ var $closeTag = $('button.close');
3
+
4
+ $closeTag.click(function() {
5
+ $(this).parent().remove();
6
+ });
7
+ });
@@ -0,0 +1,7 @@
1
+ $(document).ready(function() {
2
+ var $tabsTag = $('#tabs');
3
+
4
+ if (!!$tabsTag.length) {
5
+ $tabsTag.tabs();
6
+ }
7
+ });
@@ -0,0 +1,11 @@
1
+ $(document).ready(function() {
2
+ var $tagsTag = $('#tags');
3
+ var parameters = {
4
+ width: '100%',
5
+ height: '36px'
6
+ };
7
+
8
+ if (!!$tagsTag.length) {
9
+ $tagsTag.tagsInput(parameters);
10
+ }
11
+ });
@@ -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/
@@ -1,7 +1,8 @@
1
- require 'kaminari'
2
-
3
1
  require 'bootstrap-sass'
4
2
  require 'jquery-ui-rails'
3
+ require 'kaminari'
4
+
5
+ require 'simple_admin/routes'
5
6
 
6
7
  module SimpleAdmin
7
8
  class Engine < Rails::Engine
@@ -2,7 +2,7 @@ module SimpleAdmin
2
2
  module Refinements
3
3
  module Boolean
4
4
  # Module with refinements for Boolean classes
5
- # @since 0.1.0
5
+ # @since 0.1.0-alpha
6
6
 
7
7
  refine TrueClass do
8
8
  # Refinement for TrueClass, add humanize method
@@ -3,7 +3,7 @@ module SimpleAdmin
3
3
  class ActionsBuilder
4
4
  # Build CRUD actions for controller
5
5
  #
6
- # @since 0.1.0
6
+ # @since 0.1.0-alpha
7
7
 
8
8
  def self.initialize_actions!(controller_klass, model_name)
9
9
  controller_klass.class_eval do
@@ -9,7 +9,7 @@ module SimpleAdmin
9
9
  # => controller_builder.controller_klass
10
10
  # => SimpleAdmin::Admin::ArticlesController
11
11
  #
12
- # @since 0.1.0
12
+ # @since 0.1.0-alpha
13
13
 
14
14
  attr_reader :controller_name
15
15
 
@@ -30,7 +30,7 @@ module SimpleAdmin
30
30
  # end
31
31
  # end
32
32
  #
33
- # @since 0.1.0
33
+ # @since 0.1.0-alpha
34
34
 
35
35
  extend ActiveSupport::Concern
36
36
 
@@ -18,7 +18,7 @@ module SimpleAdmin
18
18
  # end
19
19
  # end
20
20
  #
21
- # @since 0.1.0
21
+ # @since 0.1.0-alpha
22
22
 
23
23
  extend ActiveSupport::Concern
24
24
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SimpleAdmin
2
- VERSION = '0.1.2-alpha'.freeze
2
+ VERSION = '0.2.0-alpha'.freeze
3
3
  end
@@ -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
- spec.add_dependency 'kaminari'
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.1.2.pre.alpha
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-07 00:00:00.000000000 Z
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: '0'
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: '0'
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: '0'
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: '0'
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: '0'
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: '0'
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/core.js
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
@@ -1,12 +0,0 @@
1
- $(document).ready(function() {
2
- if (!!$('#tabs').length) {
3
- $('#tabs').tabs();
4
- }
5
-
6
- if (!!$('#tags').length) {
7
- $('#tags').tagsInput({
8
- width: '100%',
9
- height: '36px'
10
- });
11
- }
12
- });
@@ -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