godmin 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/README.md +25 -27
- data/app/assets/javascripts/godmin/select-boxes.js +1 -1
- data/lib/godmin/version.rb +1 -1
- metadata +29 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3748a315501cf2ed0ac05f1e4bfcea404241ec79
|
4
|
+
data.tar.gz: 2c9cace7e611248c393951139f64fa904a06c377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ca7b0ba247d456197ec65c328707ef3e2b911a4ec2c941fdb8572ae573b048a92f8ab914fb403fc9f8cd86ff89d4fd63ca1786cb446d4d0f4b989f2c90426c7
|
7
|
+
data.tar.gz: f2b11cefd01552ad963b10f8aa00053564a3e852443ca62764b259a21a2f250c4fac512fd9666bc9056dad77669c7f85585ec72f2417db5b0a5952e093ddccf5
|
data/.hound.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 0.10.1 - 2015-02-13
|
4
|
+
Bug fixes
|
5
|
+
- Fixes multi-select selectize issue (https://github.com/varvet/godmin/issues/71)
|
6
|
+
|
3
7
|
### 0.10.0 - 2015-02-11
|
4
8
|
Features
|
5
9
|
- Shows the number of items in each scope in the scope tab (https://github.com/varvet/godmin/issues/16)
|
data/README.md
CHANGED
@@ -20,7 +20,6 @@ Godmin is an admin engine for Rails 4+.
|
|
20
20
|
- [Pagination](#pagination)
|
21
21
|
- [Views](#views)
|
22
22
|
- [Forms](#forms)
|
23
|
-
- [Models](#models)
|
24
23
|
- [Authentication](#authentication)
|
25
24
|
- [Simple authentication](#simple-authentication)
|
26
25
|
- [Shared authentication](#shared-authentication)
|
@@ -39,7 +38,7 @@ Godmin supports two common admin scenarios:
|
|
39
38
|
2. Engine installation
|
40
39
|
|
41
40
|
### Standalone installation
|
42
|
-
Use for admin-only applications, or for architectures where the admin lives in its own app.
|
41
|
+
Use for admin-only applications, or for architectures where the admin lives in its own app. E.g. you want to access the admin section at `localhost:3000`.
|
43
42
|
|
44
43
|
Add the gem to the application's `Gemfile`:
|
45
44
|
```ruby
|
@@ -52,10 +51,10 @@ $ bundle install
|
|
52
51
|
$ bin/rails generate godmin:install
|
53
52
|
```
|
54
53
|
|
55
|
-
Godmin should be up and running at `localhost:3000
|
54
|
+
Godmin should be up and running at `localhost:3000`.
|
56
55
|
|
57
56
|
### Engine installation
|
58
|
-
Use when the admin is part of the same codebase as the main application.
|
57
|
+
Use when the admin is part of the same codebase as the main application. E.g. you want to access the admin section at `localhost:3000/admin`.
|
59
58
|
|
60
59
|
Generate a [mountable engine](http://guides.rubyonrails.org/engines.html):
|
61
60
|
```sh
|
@@ -136,7 +135,7 @@ $ admin/bin/rails generate godmin:resource article title published
|
|
136
135
|
|
137
136
|
This does a number of things.
|
138
137
|
|
139
|
-
First, it inserts a route in the `config/routes.rb` file
|
138
|
+
First, it inserts a route in the `config/routes.rb` file:
|
140
139
|
|
141
140
|
```ruby
|
142
141
|
godmin do
|
@@ -144,7 +143,7 @@ godmin do
|
|
144
143
|
end
|
145
144
|
```
|
146
145
|
|
147
|
-
Second, it creates a controller
|
146
|
+
Second, it creates a controller:
|
148
147
|
|
149
148
|
```ruby
|
150
149
|
class ArticlesController < ApplicationController
|
@@ -263,7 +262,7 @@ end
|
|
263
262
|
|
264
263
|
Resources are made available to the views through instance variables. The index view can access the resources using `@resources` while show, new and edit can access the single resource using `@resource`.
|
265
264
|
|
266
|
-
In order to modify
|
265
|
+
In order to modify resource fetching and construction, these methods can be overridden per resource controller:
|
267
266
|
|
268
267
|
- `resource_class`
|
269
268
|
- `resources_relation`
|
@@ -327,8 +326,8 @@ To change the way a resource is fetched for `show`, `edit`, `update` and `destro
|
|
327
326
|
class ArticlesController
|
328
327
|
include Godmin::Resource
|
329
328
|
|
330
|
-
def find_resource(
|
331
|
-
resources_relation.find_by(slug:
|
329
|
+
def find_resource(slug)
|
330
|
+
resources_relation.find_by(slug: slug)
|
332
331
|
end
|
333
332
|
end
|
334
333
|
```
|
@@ -395,7 +394,7 @@ end
|
|
395
394
|
|
396
395
|
## Views
|
397
396
|
|
398
|
-
It
|
397
|
+
It's easy to override view templates and partials in Godmin, both globally and per resource. All you have to do is place a file with an identical name in your `app/views` directory. For instance, to override the `godmin/resource/index.html.erb` template for all resources, place a file under `app/views/resource/index.html.erb`. If you only wish to override it for articles, place it instead under `app/views/articles/index.html.erb`.
|
399
398
|
|
400
399
|
If you wish to customize the content of a table column, you can place a partial under `app/views/{resource}/columns/{column_name}.html.erb`, e.g. `app/views/articles/columns/_title.html.erb`. The resource is available to the partial through the `resource` variable.
|
401
400
|
|
@@ -403,7 +402,7 @@ Oftentimes, the default form provided by Godmin doesn't cut it. The `godmin/reso
|
|
403
402
|
|
404
403
|
Likewise, the `godmin/shared/_navigation.html.erb` partial can be overridden to build a custom navigation bar.
|
405
404
|
|
406
|
-
The full list of templates and partials that can be overridden [can be found here](https://github.com/varvet/godmin/tree/master/app/views/godmin)
|
405
|
+
The full list of templates and partials that can be overridden [can be found here](https://github.com/varvet/godmin/tree/master/app/views/godmin).
|
407
406
|
|
408
407
|
### Forms
|
409
408
|
|
@@ -417,13 +416,11 @@ form_for @resource do |f|
|
|
417
416
|
end
|
418
417
|
```
|
419
418
|
|
420
|
-
## Models
|
421
|
-
|
422
419
|
## Authentication
|
423
420
|
|
424
|
-
Multiple authentication scenarios are supported. Godmin comes with a built in authentication solution that can be used to sign in to the admin section via the admin interface. In addition, when running an admin engine, it is possible to set up a shared authentication solution so that administrators can sign in via the main app.
|
421
|
+
Multiple authentication scenarios are supported. Godmin comes with a lightweight built in authentication solution that can be used to sign in to the admin section via the admin interface. In addition, when running an admin engine, it is possible to set up a shared authentication solution so that administrators can sign in via the main app.
|
425
422
|
|
426
|
-
###
|
423
|
+
### Built in authentication
|
427
424
|
|
428
425
|
This example uses the built in authentication solution. Authentication is isolated to the admin section and administrators sign in via the admin interface.
|
429
426
|
|
@@ -442,7 +439,7 @@ $ bin/rake admin:install:migrations
|
|
442
439
|
$ bin/rake db:migrate
|
443
440
|
```
|
444
441
|
|
445
|
-
|
442
|
+
A model is generated:
|
446
443
|
|
447
444
|
```ruby
|
448
445
|
class AdminUser < ActiveRecord::Base
|
@@ -470,7 +467,7 @@ class SessionsController < ApplicationController
|
|
470
467
|
end
|
471
468
|
```
|
472
469
|
|
473
|
-
Finally, the application controller is
|
470
|
+
Finally, the application controller is modified:
|
474
471
|
|
475
472
|
```ruby
|
476
473
|
class ApplicationController < ActionController::Base
|
@@ -489,7 +486,7 @@ Authentication is now required when visiting the admin section.
|
|
489
486
|
|
490
487
|
This example uses [Devise](https://github.com/plataformatec/devise) to set up a shared authentication solution between the main app and an admin engine. Administrators sign in and out via the main application.
|
491
488
|
|
492
|
-
There is no need to run a generator in this instance.
|
489
|
+
There is no need to run a generator in this instance. Simply add the authentication module to the admin application controller like so:
|
493
490
|
|
494
491
|
```ruby
|
495
492
|
module Admin
|
@@ -523,7 +520,7 @@ module Admin
|
|
523
520
|
end
|
524
521
|
```
|
525
522
|
|
526
|
-
|
523
|
+
The admin section is now authenticated using Devise.
|
527
524
|
|
528
525
|
## Authorization
|
529
526
|
|
@@ -582,8 +579,8 @@ end
|
|
582
579
|
|
583
580
|
That is, everyone can list and view articles, only editors can create them, and only unpublished articles can be updated and destroyed.
|
584
581
|
|
585
|
-
When a user is not authorized to access a resource, `NotAuthorizedError` is raised. By default this error is rescued
|
586
|
-
If you want to change this behaviour you can rescue the error yourself in the appropriate `ApplicationController
|
582
|
+
When a user is not authorized to access a resource, a `NotAuthorizedError` is raised. By default this error is rescued by Godmin and turned into a status code `403 Forbidden` response.
|
583
|
+
If you want to change this behaviour you can rescue the error yourself in the appropriate `ApplicationController`:
|
587
584
|
|
588
585
|
```ruby
|
589
586
|
module Admin
|
@@ -619,7 +616,7 @@ Or, translate for a specific resource:
|
|
619
616
|
|
620
617
|
```yml
|
621
618
|
godmin:
|
622
|
-
|
619
|
+
article:
|
623
620
|
batch_actions:
|
624
621
|
buttons:
|
625
622
|
select_all: {translation}
|
@@ -629,7 +626,7 @@ In addition, all scopes, filters and batch actions that are added, can be locali
|
|
629
626
|
|
630
627
|
```yml
|
631
628
|
godmin:
|
632
|
-
|
629
|
+
article:
|
633
630
|
batch_actions:
|
634
631
|
labels:
|
635
632
|
publish: {translation}
|
@@ -656,9 +653,9 @@ Godmin comes with a small set of JavaScript components and APIs.
|
|
656
653
|
Make a [bootstrap-datetimepicker](https://github.com/Eonasdan/bootstrap-datetimepicker) out of a text field:
|
657
654
|
|
658
655
|
```ruby
|
659
|
-
f.
|
660
|
-
f.
|
661
|
-
f.
|
656
|
+
f.datepicker_field :date
|
657
|
+
f.timepicker_field :date
|
658
|
+
f.datetimepicker_field :date
|
662
659
|
```
|
663
660
|
|
664
661
|
If the field is added post page render, it can be initialized manually:
|
@@ -691,6 +688,7 @@ If you wish to translate the datetimepicker, add the following to your `app/asse
|
|
691
688
|
Make a [selectize.js](http://brianreavis.github.io/selectize.js/) select box out of a text field or select box:
|
692
689
|
|
693
690
|
```ruby
|
691
|
+
f.select :authors, Author.all, {}, data: { behavior: "select-box" }
|
694
692
|
f.text_field :tag_list, data: { behavior: "select-box" }
|
695
693
|
```
|
696
694
|
|
@@ -713,7 +711,7 @@ Godmin.SelectBoxes.initializeSelectBox($el, {
|
|
713
711
|
Some additional features are available as plugins:
|
714
712
|
|
715
713
|
- [Godmin Uploads](https://github.com/varvet/godmin-uploads)
|
716
|
-
- [Godmin
|
714
|
+
- [Godmin Tags](https://github.com/varvet/godmin-tags)
|
717
715
|
|
718
716
|
## Contributors
|
719
717
|
|
data/lib/godmin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: godmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Ljungblad
|
@@ -10,138 +10,138 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-02-
|
13
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bcrypt
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 3.1.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 3.1.7
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: bootstrap-sass
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ~>
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 3.3.3
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 3.3.3
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: bootstrap_form
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 2.2.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ~>
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 2.2.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: coffee-rails
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '4.0'
|
64
|
-
- -
|
64
|
+
- - <
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '4.2'
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - '>='
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '4.0'
|
74
|
-
- -
|
74
|
+
- - <
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '4.2'
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: momentjs-rails
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: 2.8.1
|
84
84
|
type: :runtime
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 2.8.1
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rails
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '4.0'
|
98
98
|
type: :runtime
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ~>
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '4.0'
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: sass-rails
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '4.0'
|
112
112
|
type: :runtime
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - '>='
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '4.0'
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: selectize-rails
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: 0.11.2
|
126
126
|
type: :runtime
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ~>
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 0.11.2
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: sqlite3
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - '>='
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
type: :development
|
141
141
|
prerelease: false
|
142
142
|
version_requirements: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- -
|
144
|
+
- - '>='
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
description: Godmin is an admin engine for Rails 4+
|
@@ -151,10 +151,10 @@ executables: []
|
|
151
151
|
extensions: []
|
152
152
|
extra_rdoc_files: []
|
153
153
|
files:
|
154
|
-
-
|
155
|
-
-
|
156
|
-
-
|
157
|
-
-
|
154
|
+
- .gitignore
|
155
|
+
- .hound.yml
|
156
|
+
- .rubocop.yml
|
157
|
+
- .travis.yml
|
158
158
|
- CHANGELOG.md
|
159
159
|
- Gemfile
|
160
160
|
- MIT-LICENSE
|
@@ -284,17 +284,17 @@ require_paths:
|
|
284
284
|
- lib
|
285
285
|
required_ruby_version: !ruby/object:Gem::Requirement
|
286
286
|
requirements:
|
287
|
-
- -
|
287
|
+
- - '>='
|
288
288
|
- !ruby/object:Gem::Version
|
289
289
|
version: '0'
|
290
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
291
291
|
requirements:
|
292
|
-
- -
|
292
|
+
- - '>='
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: '0'
|
295
295
|
requirements: []
|
296
296
|
rubyforge_project:
|
297
|
-
rubygems_version: 2.
|
297
|
+
rubygems_version: 2.4.1
|
298
298
|
signing_key:
|
299
299
|
specification_version: 4
|
300
300
|
summary: Godmin is an admin engine for Rails 4+
|
@@ -344,4 +344,3 @@ test_files:
|
|
344
344
|
- test/lib/godmin/policy_finder_test.rb
|
345
345
|
- test/lib/godmin/resolver_test.rb
|
346
346
|
- test/test_helper.rb
|
347
|
-
has_rdoc:
|