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 +4 -4
- data/README.md +11 -3
- data/app/models/simple_admin/entity_field_type.rb +1 -1
- data/app/views/simple_admin/admin/shared/_aside.html.erb +3 -3
- data/config/locales/en.yml +14 -0
- data/lib/generators/simple_admin/model_entities_generator.rb +42 -0
- data/lib/{simple_admin.rb → simple-admin.rb} +0 -0
- data/lib/simple_admin/version.rb +1 -1
- data/{simple_admin.gemspec → simple-admin.gemspec} +1 -1
- metadata +7 -7
- data/app/views/layouts/devise.html.erb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f937de7334f69d61e89fdf1405b70a48ae8cda8
|
4
|
+
data.tar.gz: 9b9a0474794de4507d45ec27f54fbbf1523d2d68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
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.
|
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 '
|
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:
|
@@ -22,20 +22,20 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
<li class="nav-main-heading">
|
25
|
-
<span class="sidebar-mini-hide"
|
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"
|
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"
|
38
|
+
<span class="sidebar-mini-hide"><%= t('activerecord.models.simple_admin/entity_field_type.many') %></span>
|
39
39
|
<% end %>
|
40
40
|
</li>
|
41
41
|
|
data/config/locales/en.yml
CHANGED
@@ -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
|
data/lib/simple_admin/version.rb
CHANGED
@@ -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
|
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.
|
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:
|
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/
|
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
|
-
-
|
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
|
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.
|
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>
|