godmin 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -4
- data/app/views/godmin/resource/_actions.html.erb +1 -3
- data/app/views/godmin/resource/_button_actions.html.erb +3 -0
- data/app/views/godmin/resource/columns/_actions.html.erb +3 -3
- data/app/views/godmin/shared/_navigation.html.erb +1 -1
- data/godmin.gemspec +1 -1
- data/lib/godmin/authorization/policy.rb +7 -6
- data/lib/godmin/helpers/application.rb +10 -0
- data/lib/godmin/version.rb +1 -1
- metadata +33 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9db8432a519eafbc75e576858f5dc03c395d205f
|
4
|
+
data.tar.gz: 14102d5be211e5ce235f02253d74b6d998720202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d921e069ef6d045e746c3fc144247712caf0a96fa91e7276c66c26b292274400e4dfeb4299fac5e5bb4aa9a36963453dcfb6fb5d0b0355a735d417b1b6077dba
|
7
|
+
data.tar.gz: 3bf7c1fb9d173572327622e398d27185e5d1ad968c8667be9104379043fa1db594b1340ca7629629c644145f7fd125334daba01b91990f38dd5af29f406cb2c3
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Godmin
|
2
2
|
|
3
|
-
[![Gem Version](http://img.shields.io/gem/v/godmin.svg
|
4
|
-
[![Build Status](https://img.shields.io/travis/varvet/godmin/master.svg
|
5
|
-
[![Code Climate](https://img.shields.io/codeclimate/github/varvet/godmin.svg
|
3
|
+
[![Gem Version](http://img.shields.io/gem/v/godmin.svg)](https://rubygems.org/gems/godmin)
|
4
|
+
[![Build Status](https://img.shields.io/travis/varvet/godmin/master.svg)](https://travis-ci.org/varvet/godmin)
|
5
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/varvet/godmin.svg)](https://codeclimate.com/github/varvet/godmin)
|
6
6
|
|
7
7
|
Godmin is an admin engine for Rails 4+.
|
8
8
|
|
@@ -253,7 +253,7 @@ If you wish to implement your own redirect after a batch action, return false af
|
|
253
253
|
```ruby
|
254
254
|
def batch_action_publish(resources)
|
255
255
|
resources.each { |r| r.update_attributes(published: true) }
|
256
|
-
redirect_to articles_path(scope: published) and return false
|
256
|
+
redirect_to articles_path(scope: :published) and return false
|
257
257
|
end
|
258
258
|
```
|
259
259
|
|
@@ -3,8 +3,6 @@
|
|
3
3
|
<%= render partial: "batch_actions" %>
|
4
4
|
</div>
|
5
5
|
<div class="pull-right">
|
6
|
-
|
7
|
-
<%= link_to t("helpers.submit.create", model: @resource_class.model_name.human), [:new, @resource_class.to_s.underscore], class: "btn btn-default" %>
|
8
|
-
<% end %>
|
6
|
+
<%= render partial: "button_actions" %>
|
9
7
|
</div>
|
10
8
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<div class="btn-group btn-group-sm pull-right">
|
2
|
-
<%
|
2
|
+
<% if policy(resource).show? %>
|
3
3
|
<%= link_to translate_scoped("column_actions.show"), resource, class: "btn btn-default" %>
|
4
4
|
<% end %>
|
5
|
-
<%
|
5
|
+
<% if policy(resource).edit? %>
|
6
6
|
<%= link_to translate_scoped("column_actions.edit"), [:edit, resource], class: "btn btn-default" %>
|
7
7
|
<% end %>
|
8
|
-
<%
|
8
|
+
<% if policy(resource).destroy? %>
|
9
9
|
<%= link_to translate_scoped("column_actions.destroy"), resource, method: :delete, data: { confirm: translate_scoped("column_actions.confirm_message") }, class: "btn btn-danger" %>
|
10
10
|
<% end %>
|
11
11
|
</div>
|
data/godmin.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.require_paths = ["lib"]
|
21
21
|
|
22
22
|
gem.add_dependency "bcrypt", "~> 3.1.7"
|
23
|
-
gem.add_dependency "bootstrap-sass", "~> 3.3.
|
23
|
+
gem.add_dependency "bootstrap-sass", "~> 3.3.3"
|
24
24
|
gem.add_dependency "bootstrap_form", "~> 2.2.0"
|
25
25
|
gem.add_dependency "coffee-rails", [">= 4.0", "< 4.2"]
|
26
26
|
gem.add_dependency "momentjs-rails", ">= 2.8.1"
|
@@ -3,17 +3,18 @@ module Godmin
|
|
3
3
|
class Policy
|
4
4
|
attr_reader :user, :record
|
5
5
|
|
6
|
-
def initialize(user, record)
|
6
|
+
def initialize(user, record, default: false)
|
7
7
|
@user = user
|
8
8
|
@record = record
|
9
|
+
@default = default
|
9
10
|
end
|
10
11
|
|
11
12
|
def index?
|
12
|
-
|
13
|
+
@default
|
13
14
|
end
|
14
15
|
|
15
16
|
def show?
|
16
|
-
|
17
|
+
@default
|
17
18
|
end
|
18
19
|
|
19
20
|
def new?
|
@@ -25,15 +26,15 @@ module Godmin
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def create?
|
28
|
-
|
29
|
+
@default
|
29
30
|
end
|
30
31
|
|
31
32
|
def update?
|
32
|
-
|
33
|
+
@default
|
33
34
|
end
|
34
35
|
|
35
36
|
def destroy?
|
36
|
-
|
37
|
+
@default
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -1,6 +1,16 @@
|
|
1
1
|
module Godmin
|
2
2
|
module Helpers
|
3
3
|
module Application
|
4
|
+
# Wraps the policy helper so that it is always accessible, even when
|
5
|
+
# authorization is not enabled. When that is the case, it returns a
|
6
|
+
# policy that always returns true.
|
7
|
+
def policy(resource)
|
8
|
+
if authorization_enabled?
|
9
|
+
super(resource)
|
10
|
+
else
|
11
|
+
Authorization::Policy.new(nil, nil, default: true)
|
12
|
+
end
|
13
|
+
end
|
4
14
|
end
|
5
15
|
end
|
6
16
|
end
|
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.9.
|
4
|
+
version: 0.9.9
|
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-01-
|
13
|
+
date: 2015-01-23 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
|
-
version: 3.3.
|
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
|
-
version: 3.3.
|
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
|
-
- .gitignore
|
155
|
-
- .hound.yml
|
156
|
-
- .rubocop.yml
|
157
|
-
- .travis.yml
|
154
|
+
- ".gitignore"
|
155
|
+
- ".hound.yml"
|
156
|
+
- ".rubocop.yml"
|
157
|
+
- ".travis.yml"
|
158
158
|
- CHANGELOG.md
|
159
159
|
- Gemfile
|
160
160
|
- MIT-LICENSE
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- app/views/godmin/resource/_actions.html.erb
|
172
172
|
- app/views/godmin/resource/_batch_actions.html.erb
|
173
173
|
- app/views/godmin/resource/_breadcrumb.html.erb
|
174
|
+
- app/views/godmin/resource/_button_actions.html.erb
|
174
175
|
- app/views/godmin/resource/_errors.html.erb
|
175
176
|
- app/views/godmin/resource/_filters.html.erb
|
176
177
|
- app/views/godmin/resource/_form.html.erb
|
@@ -279,17 +280,17 @@ require_paths:
|
|
279
280
|
- lib
|
280
281
|
required_ruby_version: !ruby/object:Gem::Requirement
|
281
282
|
requirements:
|
282
|
-
- -
|
283
|
+
- - ">="
|
283
284
|
- !ruby/object:Gem::Version
|
284
285
|
version: '0'
|
285
286
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
286
287
|
requirements:
|
287
|
-
- -
|
288
|
+
- - ">="
|
288
289
|
- !ruby/object:Gem::Version
|
289
290
|
version: '0'
|
290
291
|
requirements: []
|
291
292
|
rubyforge_project:
|
292
|
-
rubygems_version: 2.
|
293
|
+
rubygems_version: 2.2.2
|
293
294
|
signing_key:
|
294
295
|
specification_version: 4
|
295
296
|
summary: Godmin is an admin engine for Rails 4+
|
@@ -339,3 +340,4 @@ test_files:
|
|
339
340
|
- test/lib/godmin/policy_finder_test.rb
|
340
341
|
- test/lib/godmin/resolver_test.rb
|
341
342
|
- test/test_helper.rb
|
343
|
+
has_rdoc:
|