simple-admin 0.1.0.pre.alpha → 0.1.1.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: 5b81b47e64d398d477e30996174cb5e78d8ca81a
4
- data.tar.gz: d93cbc834166e61d9c4b05538b311f4044f7f467
3
+ metadata.gz: 9f937de7334f69d61e89fdf1405b70a48ae8cda8
4
+ data.tar.gz: 9b9a0474794de4507d45ec27f54fbbf1523d2d68
5
5
  SHA512:
6
- metadata.gz: f9f1a88c2270019052872f04feeb26aadf1f8e6e4dad977a8d92ea156d362bbf5d988d44432a40ee914d2e1817e8a5fe12f86f6e2d10c1f8fb27707d6632116f
7
- data.tar.gz: d06e12db1fc280e4f48b5e276a4f7119a094df1717f1959d0e65bfc3fa63cd885d2f49cef653878918e6f76c9bc3b160779abdefe69acc6647d0e8b1ff553145
6
+ metadata.gz: 4698e81f3ed33ca8a2a146585ed8ff39787f284487f6ce0fce857119ed153dae1c4c041f66c193580eb03f197c3a110d6ec7779268fc8ca8fe29e488a5fed7ae
7
+ data.tar.gz: 0c99c28bb2779024a35915a6e85dffeb3252ca3dfc82359e4f349f1c77e386e82daf8bea6b292d1edd3e44a1d7a500176f1111643ae926f549b95a25ea5b5c4a
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # SimpleAdmin
2
2
 
3
- [![Build Status](https://travis-ci.org/evil-raccoon/simple_admin.svg?branch=master)](https://travis-ci.org/evil-raccoon/simple_admin)
3
+ [![Build Status](https://travis-ci.org/evil-raccoon/simple-admin.svg?branch=master)](https://travis-ci.org/evil-raccoon/simple-admin)
4
4
  [![codecov](https://codecov.io/gh/evil-raccoon/simple_admin/branch/master/graph/badge.svg)](https://codecov.io/gh/evil-raccoon/simple_admin)
5
5
  [![Inline docs](http://inch-ci.org/github/evil-raccoon/simple_admin.svg)](http://inch-ci.org/github/evil-raccoon/simple_admin)
6
6
 
7
- A framework for creating admin dashboards in an instant. Try the demo.
7
+ A framework for creating admin dashboards in an instant.
8
8
  [Try the demo][demo].
9
9
 
10
10
  ## Getting started
@@ -13,7 +13,7 @@ Add SimpleAdmin to your Gemfile and run bundle:
13
13
  ![simple_admin](https://i.imgur.com/s1fGVRq.png)
14
14
 
15
15
  ```ruby
16
- gem 'simple_admin', git: 'https://github.com/evil-raccoon/simple_admin.git'
16
+ gem 'simple-admin'
17
17
  ```
18
18
 
19
19
  The following generators will create rolify initializer and core migrations.
@@ -57,6 +57,14 @@ After that create next partial:
57
57
  </ul>
58
58
  ```
59
59
 
60
+ ## Customization
61
+ 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
+
63
+ ```ruby
64
+ rails generate simple_admin:model_entities Post
65
+ ```
66
+ Next way is to create entity in administrative panel and fields for it, you can do it on the entities page (http://localhost:3000/admin/system/entities).
67
+
60
68
  ## Dependencies
61
69
 
62
70
  We try to minimize the use of third-party libraries, but Simple Admin built with the following open source projects:
@@ -73,7 +73,7 @@ module SimpleAdmin
73
73
  end
74
74
 
75
75
  def core_path
76
- Gem.loaded_specs['simple_admin'].full_gem_path
76
+ Gem.loaded_specs['simple-admin'].full_gem_path
77
77
  end
78
78
  end
79
79
  end
@@ -22,20 +22,20 @@
22
22
 
23
23
 
24
24
  <li class="nav-main-heading">
25
- <span class="sidebar-mini-hide">System</span>
25
+ <span class="sidebar-mini-hide"><%= t('simple_admin.system') %></span>
26
26
  </li>
27
27
 
28
28
  <li>
29
29
  <%= link_to admin_system_entities_path do %>
30
30
  <i class="si si-docs"></i>
31
- <span class="sidebar-mini-hide">Entities</span>
31
+ <span class="sidebar-mini-hide"><%= t('activerecord.models.simple_admin/entity.many') %></span>
32
32
  <% end %>
33
33
  </li>
34
34
 
35
35
  <li>
36
36
  <%= link_to admin_system_entity_field_types_path do %>
37
37
  <i class="si si-drawer"></i>
38
- <span class="sidebar-mini-hide">Field Types</span>
38
+ <span class="sidebar-mini-hide"><%= t('activerecord.models.simple_admin/entity_field_type.many') %></span>
39
39
  <% end %>
40
40
  </li>
41
41
 
@@ -1,5 +1,19 @@
1
1
  en:
2
+ activerecord:
3
+ models:
4
+ simple_admin/entity:
5
+ one: Entity
6
+ many: Entities
7
+ simple_admin/entity_field_type:
8
+ one: Field Type
9
+ many: Field Types
2
10
  simple_admin:
11
+ field_types_match:
12
+ integer: :number
13
+ decimal: :number
14
+ date: :string
15
+ datetime: :string
16
+ system: System
3
17
  form_fields:
4
18
  empty: '* That page empty, because you need to define form fields'
5
19
  create: Create Entity Fields
@@ -0,0 +1,42 @@
1
+ require 'rails/generators/base'
2
+
3
+ module SimpleAdmin
4
+ module Generators
5
+ class ModelEntitiesGenerator < Rails::Generators::NamedBase
6
+ source_root File.expand_path('../../templates', __FILE__)
7
+
8
+ EXCLUSION_FIELDS = /\bid\b|created_at|updated_at/
9
+
10
+ desc 'rails g simple_admin:model_entities Model'
11
+
12
+ def generate
13
+ entity = SimpleAdmin::Entity.find_or_create_by(model_klass_name: name)
14
+
15
+ model_columns.each do |name, type|
16
+ entity_field_type = SimpleAdmin::EntityFieldType.find_by!(name: fetch_field_type(type))
17
+
18
+ entity.entity_fields.create(name: name, entity_field_type_id: entity_field_type.id, presentation: :collection)
19
+ entity.entity_fields.create(name: name, entity_field_type_id: entity_field_type.id, presentation: :form)
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def fetch_field_type(type)
26
+ field_types = I18n.t('simple_admin.field_types_match')
27
+ field_types[type] || type
28
+ end
29
+
30
+ def model_columns
31
+ model_klass.columns.each_with_object({}) do |column, hash|
32
+ next if column.name.match?(EXCLUSION_FIELDS)
33
+ hash[column.name] = column.type
34
+ end
35
+ end
36
+
37
+ def model_klass
38
+ name.constantize
39
+ end
40
+ end
41
+ end
42
+ end
File without changes
@@ -1,3 +1,3 @@
1
1
  module SimpleAdmin
2
- VERSION = '0.1.0-alpha'.freeze
2
+ VERSION = '0.1.1-alpha'.freeze
3
3
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
 
14
14
  spec.summary = 'simple-admin'
15
15
  spec.description = 'simple-admin'
16
- spec.homepage = 'https://evil-raccoon.github.io/'
16
+ spec.homepage = 'https://github.com/evil-raccoon/simple_admin'
17
17
  spec.license = 'MIT'
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
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.0.pre.alpha
4
+ version: 0.1.1.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: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -190,7 +190,6 @@ files:
190
190
  - app/views/kaminari/_page.html.erb
191
191
  - app/views/kaminari/_paginator.html.erb
192
192
  - app/views/kaminari/_prev_page.html.erb
193
- - app/views/layouts/devise.html.erb
194
193
  - app/views/layouts/simple_admin.html.erb
195
194
  - app/views/simple_admin/admin/resource/_form.html.erb
196
195
  - app/views/simple_admin/admin/resource/edit.html.erb
@@ -247,6 +246,7 @@ files:
247
246
  - config/routes.rb
248
247
  - lib/generators/simple_admin/install_generator.rb
249
248
  - lib/generators/simple_admin/migration_generator.rb
249
+ - lib/generators/simple_admin/model_entities_generator.rb
250
250
  - lib/generators/templates/application_controller.rb
251
251
  - lib/generators/templates/initializers/simple_admin.rb.erb
252
252
  - lib/generators/templates/migrations/core_data_migration.rb
@@ -258,7 +258,7 @@ files:
258
258
  - lib/generators/templates/views/devise/registrations/new.html.erb
259
259
  - lib/generators/templates/views/devise/sessions/new.html.erb
260
260
  - lib/generators/templates/views/devise/shared/_footer.html.erb
261
- - lib/simple_admin.rb
261
+ - lib/simple-admin.rb
262
262
  - lib/simple_admin/config.rb
263
263
  - lib/simple_admin/engine.rb
264
264
  - lib/simple_admin/helpers/boolean_helper.rb
@@ -271,7 +271,7 @@ files:
271
271
  - lib/simple_admin/resource_controller/dynamic_fields.rb
272
272
  - lib/simple_admin/search.rb
273
273
  - lib/simple_admin/version.rb
274
- - simple_admin.gemspec
274
+ - simple-admin.gemspec
275
275
  - vendor/assets/fonts/Simple-Line-Icons.eot
276
276
  - vendor/assets/fonts/Simple-Line-Icons.ttf
277
277
  - vendor/assets/fonts/Simple-Line-Icons.woff
@@ -280,7 +280,7 @@ files:
280
280
  - vendor/assets/fonts/fontawesome-webfont.ttf
281
281
  - vendor/assets/fonts/fontawesome-webfont.woff
282
282
  - vendor/assets/fonts/fontawesome-webfont.woff2
283
- homepage: https://evil-raccoon.github.io/
283
+ homepage: https://github.com/evil-raccoon/simple_admin
284
284
  licenses:
285
285
  - MIT
286
286
  metadata: {}
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  version: 1.3.1
301
301
  requirements: []
302
302
  rubyforge_project:
303
- rubygems_version: 2.6.12
303
+ rubygems_version: 2.6.11
304
304
  signing_key:
305
305
  specification_version: 4
306
306
  summary: simple-admin
@@ -1,11 +0,0 @@
1
- <html>
2
- <head>
3
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
4
- <title>Simple Admin</title>
5
- <%= csrf_meta_tags %>
6
- <%= stylesheet_link_tag 'simple_admin/application', media: 'all' %>
7
- </head>
8
- <body>
9
- <%= yield %>
10
- </body>
11
- </html>