cream 0.7.3 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.txt +5 -0
- data/Gemfile +5 -5
- data/README.markdown +31 -7
- data/Rakefile +9 -9
- data/VERSION +1 -1
- data/config/locales/cream.en.yml +16 -0
- data/cream.gemspec +30 -33
- data/lib/cream/configure/rails.rb +5 -5
- data/lib/cream/role.rb +32 -6
- data/lib/generators/cream/full_config/full_config_generator.rb +1 -1
- data/lib/generators/cream/views/views_generator.rb +1 -1
- data/lib/generators/permits/config/config_generator.rb +2 -1
- data/spec/cream/configure/rails_custom_roles_spec.rb +3 -2
- data/spec/cream/configure/rails_role_spec.rb +3 -3
- data/spec/cream/configure/rails_user_roles_spec.rb +3 -2
- data/spec/cream/helper/host_spec.rb +4 -4
- data/spec/cream/helper/role_spec.rb +13 -13
- data/spec/cream/view/host_area_spec.rb +4 -4
- data/spec/cream/view/role_area_spec.rb +9 -9
- data/wiki/ROLE_STRATEGIES.txt +1 -1
- metadata +26 -28
- data/config/locales/en.yml +0 -14
- data/lib/cream/helper/authlabels.rb +0 -19
- data/spec/cream/configure/cream_setup_spec.rb +0 -7
data/Changelog.txt
CHANGED
data/Gemfile
CHANGED
@@ -3,19 +3,19 @@ source 'http://gems.github.com/'
|
|
3
3
|
|
4
4
|
group :default do
|
5
5
|
gem "devise-links", "~> 0.1.4"
|
6
|
-
gem "cancan-rest-links", ">= 0.1.
|
7
|
-
gem "cancan-permits", ">= 0.2
|
6
|
+
gem "cancan-rest-links", ">= 0.1.5"
|
7
|
+
gem "cancan-permits", ">= 0.3.2"
|
8
8
|
|
9
9
|
gem "require_all", "~> 1.2.0"
|
10
10
|
|
11
11
|
gem "devise", ">= 1.2.0"
|
12
|
-
gem "cancan", "
|
13
|
-
gem "rails", "
|
12
|
+
gem "cancan", ">= 1.4.0"
|
13
|
+
gem "rails", ">= 3.0.1"
|
14
14
|
|
15
15
|
gem "rails3_artifactor", "~> 0.3.0"
|
16
16
|
gem 'logging_assist', "~> 0.1.6"
|
17
17
|
|
18
|
-
gem "r3_plugin_toolbox", ">= 0.
|
18
|
+
gem "r3_plugin_toolbox", ">= 0.4.0"
|
19
19
|
gem "sugar-high", "~> 0.3.0"
|
20
20
|
end
|
21
21
|
|
data/README.markdown
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Cream
|
2
2
|
|
3
3
|
This project aims to assist you in setting up a complete user login and role permission system for your Rails 3 app.
|
4
|
-
|
5
|
-
[Roles](http://github.com/kristianmandrup/roles_generic) as the user Roles system.
|
4
|
+
|
5
|
+
It targets [Devise](http://github.com/plataformatec/devise) as the Authentication system, [CanCan](http://github.com/ryanb/cancan) with Permits and Licenses as the Authorization system and [Roles Generic](http://github.com/kristianmandrup/roles_generic) as the user Roles system.
|
6
6
|
|
7
7
|
The objective of this project is to
|
8
8
|
* Integrate all these sub-systems
|
@@ -19,11 +19,19 @@ that demonstrates what a final Rails 3 app using Cream will look like. I plan to
|
|
19
19
|
Mongo Mapper as the ORM and default arguments, the generartor should generate a "mirror image" of this template project. You are most welcome to help me in this effort
|
20
20
|
or provide suggestions etc. The README of the template project will contain a recipe with the steps to be taken to produce it ;)
|
21
21
|
|
22
|
-
|
22
|
+
### Update Nov 25, 2010
|
23
|
+
|
24
|
+
Cream dependency to *cancan-permits* updated to use version 0.3.2.
|
25
|
+
Cream Permits Config generator uses new *cancan:permits* and *cancan:licenses* generators.
|
26
|
+
|
27
|
+
Currently to activate Cream in a rails app, insert this line in a Rails initializer.
|
28
|
+
<code>
|
29
|
+
require 'cream/configure/rails'
|
30
|
+
</code>
|
23
31
|
|
24
|
-
##
|
32
|
+
## Authentication systems
|
25
33
|
|
26
|
-
Cream targets [Devise](http://github.com/plataformatec/devise) as the
|
34
|
+
Cream targets [Devise](http://github.com/plataformatec/devise) as the Authentication system of choice
|
27
35
|
|
28
36
|
* [devise](http://github.com/plataformatec/devise)
|
29
37
|
|
@@ -45,6 +53,8 @@ The Roles Generic API has been implemented for the following ORMs
|
|
45
53
|
* [Roles DataMapper](http://github.com/kristianmandrup/roles_data_mapper)
|
46
54
|
* [Roles MongoMapper](http://github.com/kristianmandrup/roles_mongo_mapper)
|
47
55
|
* [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
|
56
|
+
* [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
|
57
|
+
* [Roles Simply Stored](https://github.com/kristianmandrup/roles_simply_stored)
|
48
58
|
|
49
59
|
_Role Groups_
|
50
60
|
Document DBs such as *Mongo* and *Riak* are good for modeling a role-group hierarchical relationship.
|
@@ -52,7 +62,10 @@ Role-Group support is planned as a future add-on for the roles strategies integr
|
|
52
62
|
|
53
63
|
_Note:_
|
54
64
|
You are most welcome to provide "plugins" for any other role frameworks. Please follow the API conventions of Roles generic.
|
55
|
-
|
65
|
+
|
66
|
+
_Update:_
|
67
|
+
Roles Generic has recently been upgraded with a better API, architecture, framework for testing and more and better functionality. It should also now be more DRY and
|
68
|
+
easier/simpler to add more strategies and Datastore adapters.
|
56
69
|
|
57
70
|
## Permission systems
|
58
71
|
|
@@ -70,6 +83,7 @@ In general, it should now finally be pretty easy to set up a Rails 3 app, with a
|
|
70
83
|
* Data Mapper
|
71
84
|
* Mongo Mapper
|
72
85
|
* Mongoid
|
86
|
+
* Couch DB
|
73
87
|
|
74
88
|
These ORMs are also supported for the Roles strategy system. The Permission system should not have any ORM dependency.
|
75
89
|
There are plans to create a top-level generator which sets up your project with all these systems for a given ORM.
|
@@ -97,6 +111,12 @@ Role strategies can be set up using the [Roles Generic](http://github.com/kristi
|
|
97
111
|
* Data Mapper
|
98
112
|
* Mongo Mapper
|
99
113
|
* Mongoid
|
114
|
+
* Couch DB
|
115
|
+
|
116
|
+
### Update
|
117
|
+
|
118
|
+
The Role systems for Active Record, Mongoid and MongoMapper have recently been upgraded to take advantage of the new Roles Generic API and archictecture.
|
119
|
+
I hope to soon have time to also upgrade the remaining ORM Role adapters.
|
100
120
|
|
101
121
|
## Permission system
|
102
122
|
|
@@ -118,7 +138,11 @@ Currently CanCan is supported as the permission system. I have added the concept
|
|
118
138
|
Check out [Cancan permits](http://github.com/kristianmandrup/cancan-permits) for more info for how to use Permits.
|
119
139
|
|
120
140
|
Cream has ben updated to support my the version of *Cancan permits*, which now support all the ORMs that both Cream and Roles Generic support.
|
121
|
-
|
141
|
+
|
142
|
+
For more advanced role/permission scenarios you can create Licenses placed in '/app/licenses/', which are 'permission sets' that can be reused across multiple Permits.
|
143
|
+
Note: The gem *cancan-permits* comes with both a *permits* and a *licenses* generator.
|
144
|
+
|
145
|
+
See [CanCan permits demo app](https://github.com/kristianmandrup/cancan-permits-demo) for an example of how to use cancan-permits and licenses.
|
122
146
|
|
123
147
|
## Generators
|
124
148
|
|
data/Rakefile
CHANGED
@@ -9,24 +9,24 @@ begin
|
|
9
9
|
gem.authors = ["Kristian Mandrup"]
|
10
10
|
|
11
11
|
gem.add_development_dependency "rspec", ">= 2.0.0"
|
12
|
-
gem.add_development_dependency "generator-spec", "
|
12
|
+
gem.add_development_dependency "generator-spec", ">= 0.7.0"
|
13
13
|
gem.add_development_dependency "rspec-action_view", ">= 0.3.1"
|
14
14
|
gem.add_development_dependency "rails-app-spec", ">= 0.3.0"
|
15
15
|
|
16
16
|
gem.add_dependency "require_all", "~> 1.2.0"
|
17
17
|
|
18
|
-
gem.add_dependency "devise-links", ">= 0.
|
19
|
-
gem.add_dependency "cancan-rest-links", ">= 0.
|
20
|
-
gem.add_dependency "cancan-permits", ">= 0.2
|
18
|
+
gem.add_dependency "devise-links", ">= 0.2.0"
|
19
|
+
gem.add_dependency "cancan-rest-links", ">= 0.2.0"
|
20
|
+
gem.add_dependency "cancan-permits", ">= 0.3.2"
|
21
21
|
|
22
|
-
gem.add_dependency "devise", "
|
23
|
-
gem.add_dependency "cancan", "
|
24
|
-
gem.add_dependency "rails", "
|
22
|
+
gem.add_dependency "devise", ">= 1.2.0"
|
23
|
+
gem.add_dependency "cancan", ">= 1.4.0"
|
24
|
+
gem.add_dependency "rails", ">= 3.0.1"
|
25
25
|
|
26
|
-
gem.add_dependency "rails3_artifactor", "~> 0.3.
|
26
|
+
gem.add_dependency "rails3_artifactor", "~> 0.3.1"
|
27
27
|
gem.add_dependency 'logging_assist', "~> 0.1.6"
|
28
28
|
|
29
|
-
gem.add_dependency "r3_plugin_toolbox", ">= 0.
|
29
|
+
gem.add_dependency "r3_plugin_toolbox", ">= 0.4.0"
|
30
30
|
gem.add_dependency "sugar-high", "~> 0.3.0"
|
31
31
|
|
32
32
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.5
|
@@ -0,0 +1,16 @@
|
|
1
|
+
en:
|
2
|
+
cream:
|
3
|
+
confirm: 'Are you sure?'
|
4
|
+
actions:
|
5
|
+
rest:
|
6
|
+
index: "Index"
|
7
|
+
new: "New"
|
8
|
+
edit: "Edit"
|
9
|
+
delete: "Delete"
|
10
|
+
show: "Show"
|
11
|
+
auth:
|
12
|
+
sign_in: "Sign in"
|
13
|
+
sign_out: "Sign out"
|
14
|
+
sign_up: "Sign up"
|
15
|
+
edit_registration: "Edit registration"
|
16
|
+
|
data/cream.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cream}
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-11-26}
|
13
13
|
s.description = %q{Provides assistance for setting up Session, Role and Permission systems for a Rails 3 app. Support for multiple ORMs}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"app/views/auth_assist/menu/_admin_login_items.html.erb",
|
31
31
|
"app/views/auth_assist/menu/_login_items.html.erb",
|
32
32
|
"app/views/auth_assist/menu/_registration_items.html.erb",
|
33
|
-
"config/locales/en.yml",
|
33
|
+
"config/locales/cream.en.yml",
|
34
34
|
"cream.gemspec",
|
35
35
|
"features/FEATURE_NOTES.txt",
|
36
36
|
"features/permission/adds_permission.feature",
|
@@ -41,7 +41,6 @@ Gem::Specification.new do |s|
|
|
41
41
|
"lib/cream/configure/after_init/role_config.rb",
|
42
42
|
"lib/cream/configure/rails.rb",
|
43
43
|
"lib/cream/controller/ability.rb",
|
44
|
-
"lib/cream/helper/authlabels.rb",
|
45
44
|
"lib/cream/helper/host.rb",
|
46
45
|
"lib/cream/helper/role.rb",
|
47
46
|
"lib/cream/namespaces.rb",
|
@@ -64,7 +63,6 @@ Gem::Specification.new do |s|
|
|
64
63
|
"log/development.log",
|
65
64
|
"sandbox/test.rb",
|
66
65
|
"spec/configure_helper.rb",
|
67
|
-
"spec/cream/configure/cream_setup_spec.rb",
|
68
66
|
"spec/cream/configure/rails_custom_roles_spec.rb",
|
69
67
|
"spec/cream/configure/rails_role_spec.rb",
|
70
68
|
"spec/cream/configure/rails_user_roles_spec.rb",
|
@@ -98,7 +96,6 @@ Gem::Specification.new do |s|
|
|
98
96
|
s.summary = %q{Integrates Devise, Roles and CanCan with Permits for a Rails 3 app}
|
99
97
|
s.test_files = [
|
100
98
|
"spec/configure_helper.rb",
|
101
|
-
"spec/cream/configure/cream_setup_spec.rb",
|
102
99
|
"spec/cream/configure/rails_custom_roles_spec.rb",
|
103
100
|
"spec/cream/configure/rails_role_spec.rb",
|
104
101
|
"spec/cream/configure/rails_user_roles_spec.rb",
|
@@ -124,52 +121,52 @@ Gem::Specification.new do |s|
|
|
124
121
|
|
125
122
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
126
123
|
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
|
127
|
-
s.add_development_dependency(%q<generator-spec>, ["
|
124
|
+
s.add_development_dependency(%q<generator-spec>, [">= 0.7.0"])
|
128
125
|
s.add_development_dependency(%q<rspec-action_view>, [">= 0.3.1"])
|
129
126
|
s.add_development_dependency(%q<rails-app-spec>, [">= 0.3.0"])
|
130
127
|
s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
|
131
|
-
s.add_runtime_dependency(%q<devise-links>, [">= 0.
|
132
|
-
s.add_runtime_dependency(%q<cancan-rest-links>, [">= 0.
|
133
|
-
s.add_runtime_dependency(%q<cancan-permits>, [">= 0.2
|
134
|
-
s.add_runtime_dependency(%q<devise>, ["
|
135
|
-
s.add_runtime_dependency(%q<cancan>, ["
|
136
|
-
s.add_runtime_dependency(%q<rails>, ["
|
137
|
-
s.add_runtime_dependency(%q<rails3_artifactor>, ["~> 0.3.
|
128
|
+
s.add_runtime_dependency(%q<devise-links>, [">= 0.2.0"])
|
129
|
+
s.add_runtime_dependency(%q<cancan-rest-links>, [">= 0.2.0"])
|
130
|
+
s.add_runtime_dependency(%q<cancan-permits>, [">= 0.3.2"])
|
131
|
+
s.add_runtime_dependency(%q<devise>, [">= 1.2.0"])
|
132
|
+
s.add_runtime_dependency(%q<cancan>, [">= 1.4.0"])
|
133
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.1"])
|
134
|
+
s.add_runtime_dependency(%q<rails3_artifactor>, ["~> 0.3.1"])
|
138
135
|
s.add_runtime_dependency(%q<logging_assist>, ["~> 0.1.6"])
|
139
|
-
s.add_runtime_dependency(%q<r3_plugin_toolbox>, [">= 0.
|
136
|
+
s.add_runtime_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
|
140
137
|
s.add_runtime_dependency(%q<sugar-high>, ["~> 0.3.0"])
|
141
138
|
else
|
142
139
|
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
143
|
-
s.add_dependency(%q<generator-spec>, ["
|
140
|
+
s.add_dependency(%q<generator-spec>, [">= 0.7.0"])
|
144
141
|
s.add_dependency(%q<rspec-action_view>, [">= 0.3.1"])
|
145
142
|
s.add_dependency(%q<rails-app-spec>, [">= 0.3.0"])
|
146
143
|
s.add_dependency(%q<require_all>, ["~> 1.2.0"])
|
147
|
-
s.add_dependency(%q<devise-links>, [">= 0.
|
148
|
-
s.add_dependency(%q<cancan-rest-links>, [">= 0.
|
149
|
-
s.add_dependency(%q<cancan-permits>, [">= 0.2
|
150
|
-
s.add_dependency(%q<devise>, ["
|
151
|
-
s.add_dependency(%q<cancan>, ["
|
152
|
-
s.add_dependency(%q<rails>, ["
|
153
|
-
s.add_dependency(%q<rails3_artifactor>, ["~> 0.3.
|
144
|
+
s.add_dependency(%q<devise-links>, [">= 0.2.0"])
|
145
|
+
s.add_dependency(%q<cancan-rest-links>, [">= 0.2.0"])
|
146
|
+
s.add_dependency(%q<cancan-permits>, [">= 0.3.2"])
|
147
|
+
s.add_dependency(%q<devise>, [">= 1.2.0"])
|
148
|
+
s.add_dependency(%q<cancan>, [">= 1.4.0"])
|
149
|
+
s.add_dependency(%q<rails>, [">= 3.0.1"])
|
150
|
+
s.add_dependency(%q<rails3_artifactor>, ["~> 0.3.1"])
|
154
151
|
s.add_dependency(%q<logging_assist>, ["~> 0.1.6"])
|
155
|
-
s.add_dependency(%q<r3_plugin_toolbox>, [">= 0.
|
152
|
+
s.add_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
|
156
153
|
s.add_dependency(%q<sugar-high>, ["~> 0.3.0"])
|
157
154
|
end
|
158
155
|
else
|
159
156
|
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
160
|
-
s.add_dependency(%q<generator-spec>, ["
|
157
|
+
s.add_dependency(%q<generator-spec>, [">= 0.7.0"])
|
161
158
|
s.add_dependency(%q<rspec-action_view>, [">= 0.3.1"])
|
162
159
|
s.add_dependency(%q<rails-app-spec>, [">= 0.3.0"])
|
163
160
|
s.add_dependency(%q<require_all>, ["~> 1.2.0"])
|
164
|
-
s.add_dependency(%q<devise-links>, [">= 0.
|
165
|
-
s.add_dependency(%q<cancan-rest-links>, [">= 0.
|
166
|
-
s.add_dependency(%q<cancan-permits>, [">= 0.2
|
167
|
-
s.add_dependency(%q<devise>, ["
|
168
|
-
s.add_dependency(%q<cancan>, ["
|
169
|
-
s.add_dependency(%q<rails>, ["
|
170
|
-
s.add_dependency(%q<rails3_artifactor>, ["~> 0.3.
|
161
|
+
s.add_dependency(%q<devise-links>, [">= 0.2.0"])
|
162
|
+
s.add_dependency(%q<cancan-rest-links>, [">= 0.2.0"])
|
163
|
+
s.add_dependency(%q<cancan-permits>, [">= 0.3.2"])
|
164
|
+
s.add_dependency(%q<devise>, [">= 1.2.0"])
|
165
|
+
s.add_dependency(%q<cancan>, [">= 1.4.0"])
|
166
|
+
s.add_dependency(%q<rails>, [">= 3.0.1"])
|
167
|
+
s.add_dependency(%q<rails3_artifactor>, ["~> 0.3.1"])
|
171
168
|
s.add_dependency(%q<logging_assist>, ["~> 0.1.6"])
|
172
|
-
s.add_dependency(%q<r3_plugin_toolbox>, [">= 0.
|
169
|
+
s.add_dependency(%q<r3_plugin_toolbox>, [">= 0.4.0"])
|
173
170
|
s.add_dependency(%q<sugar-high>, ["~> 0.3.0"])
|
174
171
|
end
|
175
172
|
end
|
@@ -7,20 +7,20 @@ Rails3::Plugin::Extender.new do
|
|
7
7
|
extend_rails :controller do
|
8
8
|
extend_from_module Cream, :role
|
9
9
|
extend_from_module Cream::Controller, :ability
|
10
|
-
extend_from_module Cream::Helper, :role, :host
|
10
|
+
extend_from_module Cream::Helper, :role, :host
|
11
11
|
end
|
12
12
|
|
13
13
|
# extend action_view with methods from some modules
|
14
14
|
extend_rails :view do
|
15
15
|
extend_from_module Cream::View, :role, :host, :user_action_menu
|
16
|
-
extend_from_module Cream::Helper, :role
|
16
|
+
extend_from_module Cream::Helper, :role
|
17
17
|
end
|
18
18
|
|
19
19
|
after :initialize do
|
20
20
|
require_all File.dirname(__FILE__) + '/after_init'
|
21
21
|
|
22
|
-
Rails3.with_configuration do
|
23
|
-
|
24
|
-
end
|
22
|
+
# Rails3.with_configuration do
|
23
|
+
# load_paths += %W(#{Rails.root}/app/permits)
|
24
|
+
# end
|
25
25
|
end
|
26
26
|
end
|
data/lib/cream/role.rb
CHANGED
@@ -7,18 +7,44 @@ module Cream
|
|
7
7
|
def self.available
|
8
8
|
return Cream.available_roles if Cream.available_roles.present?
|
9
9
|
return Cream.roles if Cream.roles.present?
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
|
11
|
+
puts "Cream didn't have available roles configured, now trying alternatives: User and Role"
|
12
|
+
|
13
|
+
return try_role if try_role
|
14
|
+
return try_user if try_user
|
15
|
+
|
16
|
+
raise %q{Available roles could not be determined. Please do either of the following:\n
|
16
17
|
1) Create a Cream.setup block
|
17
18
|
2) Set Cream.available_roles explicitly
|
18
19
|
3) Create Role instances and ensure a call to Role.all returns them
|
19
20
|
4) Set User.roles explicitly
|
20
21
|
}
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def self.try_user
|
27
|
+
if !defined? ::User
|
28
|
+
puts "No User defined"
|
29
|
+
return nil
|
21
30
|
end
|
31
|
+
|
32
|
+
puts "User has roles available?"
|
33
|
+
return ::User.roles.to_symbols if ::User.respond_to?(:roles)
|
34
|
+
puts "User didn't have a #roles class method"
|
35
|
+
nil
|
22
36
|
end
|
37
|
+
|
38
|
+
def self.try_role
|
39
|
+
if !defined? ::Role
|
40
|
+
puts "No Role defined"
|
41
|
+
return nil
|
42
|
+
end
|
43
|
+
|
44
|
+
puts "Role has roles available?"
|
45
|
+
return ::Role.all.map(&:name).to_symbols if ::Role.respond_to?(:all)
|
46
|
+
puts "Role didn't have an #all class method"
|
47
|
+
nil
|
48
|
+
end
|
23
49
|
end
|
24
50
|
end
|
@@ -143,7 +143,7 @@ module Cream
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def cream_locale
|
146
|
-
src = File.expand_path "config/locales/en.yml".path.up(2)
|
146
|
+
src = File.expand_path "config/locales/cream.en.yml".path.up(2)
|
147
147
|
# src = "config/locales/en.yml"
|
148
148
|
logger.debug "configure_locale, copy from: #{src}"
|
149
149
|
copy_file src, "config/locales/cream.en.yml"
|
@@ -4,7 +4,7 @@ require 'generators/views/haml_util'
|
|
4
4
|
module Cream
|
5
5
|
module Generators
|
6
6
|
class ViewsGenerator < Rails::Generators::Base
|
7
|
-
desc "Copies all
|
7
|
+
desc "Copies all Cream views to your application."
|
8
8
|
|
9
9
|
argument :scope, :required => false, :default => nil, :desc => "The scope to copy views to"
|
10
10
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'configure_helper'
|
2
|
+
require 'cream/configure/rails'
|
2
3
|
|
3
4
|
Cream.available_roles = [:guest, :admin]
|
4
5
|
|
@@ -7,7 +8,7 @@ describe "Rails extension" do
|
|
7
8
|
it "should extend Action View with Roles helper instance_methods and specific role methods" do
|
8
9
|
after_init :view do
|
9
10
|
:view.should be_extended_with Cream::View, :role, :host, :user_action_menu
|
10
|
-
:view.should be_extended_with Cream::Helper, :role
|
11
|
+
:view.should be_extended_with Cream::Helper, :role
|
11
12
|
end
|
12
13
|
|
13
14
|
init_app_railties :minimal, :view
|
@@ -17,7 +18,7 @@ describe "Rails extension" do
|
|
17
18
|
after_init :controller do
|
18
19
|
:controller.should be_extended_with Cream, :role
|
19
20
|
:controller.should be_extended_with Cream::Controller, :ability
|
20
|
-
:controller.should be_extended_with Cream::Helper, :role, :host
|
21
|
+
:controller.should be_extended_with Cream::Helper, :role, :host
|
21
22
|
end
|
22
23
|
|
23
24
|
init_app_railties :minimal, :view
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'configure_helper'
|
2
2
|
|
3
|
-
require 'cream/configure'
|
3
|
+
require 'cream/configure/rails'
|
4
4
|
|
5
5
|
class Role
|
6
6
|
attr_accessor :name
|
@@ -19,7 +19,7 @@ describe "Rails extension" do
|
|
19
19
|
it "should extend Action View with Roles helper instance_methods and specific role methods" do
|
20
20
|
after_init :view do
|
21
21
|
:view.should be_extended_with Cream::View, :role, :host, :user_action_menu
|
22
|
-
:view.should be_extended_with Cream::Helper, :role
|
22
|
+
:view.should be_extended_with Cream::Helper, :role
|
23
23
|
end
|
24
24
|
|
25
25
|
init_app_railties :minimal, :view
|
@@ -29,7 +29,7 @@ describe "Rails extension" do
|
|
29
29
|
after_init :controller do
|
30
30
|
:controller.should be_extended_with Cream, :role
|
31
31
|
:controller.should be_extended_with Cream::Controller, :ability
|
32
|
-
:controller.should be_extended_with Cream::Helper, :role, :host
|
32
|
+
:controller.should be_extended_with Cream::Helper, :role, :host
|
33
33
|
end
|
34
34
|
|
35
35
|
init_app_railties :minimal, :view
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'configure_helper'
|
2
|
+
require 'cream/configure/rails'
|
2
3
|
|
3
4
|
class User
|
4
5
|
def self.roles
|
@@ -11,7 +12,7 @@ describe "Rails extension" do
|
|
11
12
|
it "should extend Action View with Roles helper instance_methods and specific role methods" do
|
12
13
|
after_init :view do
|
13
14
|
:view.should be_extended_with Cream::View, :role, :host, :user_action_menu
|
14
|
-
:view.should be_extended_with Cream::Helper, :role
|
15
|
+
:view.should be_extended_with Cream::Helper, :role
|
15
16
|
end
|
16
17
|
|
17
18
|
init_app_railties :minimal, :view
|
@@ -21,7 +22,7 @@ describe "Rails extension" do
|
|
21
22
|
after_init :controller do
|
22
23
|
:controller.should be_extended_with Cream, :role
|
23
24
|
:controller.should be_extended_with Cream::Controller, :ability
|
24
|
-
:controller.should be_extended_with Cream::Helper, :role, :host
|
25
|
+
:controller.should be_extended_with Cream::Helper, :role, :host
|
25
26
|
end
|
26
27
|
|
27
28
|
init_app_railties :minimal, :view
|
@@ -11,7 +11,7 @@ describe Cream::Helper::Host do
|
|
11
11
|
request = stub()
|
12
12
|
request.stubs(:host).returns 'localhost'
|
13
13
|
|
14
|
-
|
14
|
+
view_engine do |e, view|
|
15
15
|
view.stubs(:request).returns request
|
16
16
|
|
17
17
|
res = e.run_template do
|
@@ -25,7 +25,7 @@ describe Cream::Helper::Host do
|
|
25
25
|
request = stub()
|
26
26
|
request.stubs(:host).returns '127.0.0.1'
|
27
27
|
|
28
|
-
|
28
|
+
view_engine do |e, view|
|
29
29
|
view.stubs(:request).returns request
|
30
30
|
|
31
31
|
res = e.run_template do
|
@@ -41,7 +41,7 @@ describe Cream::Helper::Host do
|
|
41
41
|
request = stub()
|
42
42
|
request.stubs(:host).returns 'localhost'
|
43
43
|
|
44
|
-
|
44
|
+
view_engine do |e, view|
|
45
45
|
view.stubs(:request).returns request
|
46
46
|
|
47
47
|
res = e.run_template do
|
@@ -55,7 +55,7 @@ describe Cream::Helper::Host do
|
|
55
55
|
request = stub()
|
56
56
|
request.stubs(:host).returns '214.353.343.222'
|
57
57
|
|
58
|
-
|
58
|
+
view_engine do |e, view|
|
59
59
|
view.stubs(:request).returns request
|
60
60
|
|
61
61
|
res = e.run_template do
|
@@ -9,7 +9,7 @@ describe Cream::Helper::Role do
|
|
9
9
|
describe '#guest_area' do
|
10
10
|
|
11
11
|
# it "should execute an Admin guarded block for :admin" do
|
12
|
-
#
|
12
|
+
# view_engine do |e, view|
|
13
13
|
# view.stubs(:has_role?).with([:admin]).returns true
|
14
14
|
#
|
15
15
|
# res = e.run_template do
|
@@ -20,7 +20,7 @@ describe Cream::Helper::Role do
|
|
20
20
|
# end
|
21
21
|
#
|
22
22
|
# it "should not execute an Admin guarded block for user not :admin" do
|
23
|
-
#
|
23
|
+
# view_engine do |e, view|
|
24
24
|
# view.stubs(:has_role?).with([:admin]).returns false
|
25
25
|
#
|
26
26
|
# res = e.run_template do
|
@@ -35,7 +35,7 @@ describe Cream::Helper::Role do
|
|
35
35
|
context 'admin user' do
|
36
36
|
describe '#for_roles' do
|
37
37
|
it "display an :admin only block" do
|
38
|
-
|
38
|
+
view_engine do |e, view|
|
39
39
|
view.stubs(:has_role?).with([:admin]).returns true
|
40
40
|
|
41
41
|
res = e.run_template do
|
@@ -46,7 +46,7 @@ describe Cream::Helper::Role do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should not display a :guest only block" do
|
49
|
-
|
49
|
+
view_engine do |e, view|
|
50
50
|
view.stubs(:has_role?).with([:guest]).returns false
|
51
51
|
|
52
52
|
res = e.run_template do
|
@@ -59,7 +59,7 @@ describe Cream::Helper::Role do
|
|
59
59
|
|
60
60
|
describe '#not_for_roles' do
|
61
61
|
it "should not display a block not for :admin" do
|
62
|
-
|
62
|
+
view_engine do |e, view|
|
63
63
|
view.stubs(:has_role?).with([:admin]).returns true
|
64
64
|
|
65
65
|
res = e.run_template do
|
@@ -70,7 +70,7 @@ describe Cream::Helper::Role do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should display a div block not for :guest" do
|
73
|
-
|
73
|
+
view_engine do |e, view|
|
74
74
|
view.stubs(:has_role?).with([:guest]).returns false
|
75
75
|
|
76
76
|
res = e.run_template do
|
@@ -88,7 +88,7 @@ describe Cream::Helper::Role do
|
|
88
88
|
user = stub()
|
89
89
|
user.stubs(:has_role?).with([:admin]).returns true
|
90
90
|
|
91
|
-
|
91
|
+
view_engine do |e, view|
|
92
92
|
view.stubs(:current_user).returns user
|
93
93
|
|
94
94
|
res = e.run_template do
|
@@ -102,7 +102,7 @@ describe Cream::Helper::Role do
|
|
102
102
|
user = stub()
|
103
103
|
user.stubs(:has_role?).with([:guest]).returns false
|
104
104
|
|
105
|
-
|
105
|
+
view_engine do |e, view|
|
106
106
|
view.stubs(:current_user).returns user
|
107
107
|
res = e.run_template do
|
108
108
|
%{<%= has_role?(:guest) %> }
|
@@ -119,7 +119,7 @@ describe Cream::Helper::Role do
|
|
119
119
|
user = stub()
|
120
120
|
user.stubs(:has_roles?).with([:admin, :guest]).returns true
|
121
121
|
|
122
|
-
|
122
|
+
view_engine do |e, view|
|
123
123
|
view.stubs(:current_user).returns user
|
124
124
|
res = e.run_template do
|
125
125
|
%{<%= has_roles?(:admin, :guest) %> }
|
@@ -132,7 +132,7 @@ describe Cream::Helper::Role do
|
|
132
132
|
user = stub()
|
133
133
|
user.stubs(:has_roles?).with([:unknown, :guest]).returns false
|
134
134
|
|
135
|
-
|
135
|
+
view_engine do |e, view|
|
136
136
|
view.stubs(:current_user).returns user
|
137
137
|
res = e.run_template do
|
138
138
|
%{<%= has_roles?(:unknown, :guest) %> }
|
@@ -147,7 +147,7 @@ describe Cream::Helper::Role do
|
|
147
147
|
it "should return false, since the user is NOT the owner of the post, but an other user" do
|
148
148
|
user = stub()
|
149
149
|
other_user = stub()
|
150
|
-
|
150
|
+
view_engine do |e, view|
|
151
151
|
view.stubs(:current_user).returns user
|
152
152
|
@post.stubs(:owner).returns other_user
|
153
153
|
|
@@ -160,7 +160,7 @@ describe Cream::Helper::Role do
|
|
160
160
|
|
161
161
|
it "should return true, since the user is the owner of the post (default :owner relation)" do
|
162
162
|
user = stub()
|
163
|
-
|
163
|
+
view_engine do |e, view|
|
164
164
|
view.stubs(:current_user).returns user
|
165
165
|
@post.stubs(:owner).returns user
|
166
166
|
|
@@ -173,7 +173,7 @@ describe Cream::Helper::Role do
|
|
173
173
|
|
174
174
|
it "should return true, since the user is the owner of the post using custom ownership relation :maker" do
|
175
175
|
user = stub()
|
176
|
-
|
176
|
+
view_engine do |e, view|
|
177
177
|
view.stubs(:current_user).returns user
|
178
178
|
@post.stubs(:maker).returns user
|
179
179
|
|
@@ -10,7 +10,7 @@ describe Cream::View::Host do
|
|
10
10
|
|
11
11
|
describe '#for_localhost' do
|
12
12
|
it "should display localhost guarded content for localhost browser agent" do
|
13
|
-
|
13
|
+
view_engine do |e, view|
|
14
14
|
view.stubs(:localhost?).returns true
|
15
15
|
|
16
16
|
res = e.run_template do
|
@@ -24,7 +24,7 @@ describe Cream::View::Host do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should NOT display localhost guarded content for NON-localhost browser agent" do
|
27
|
-
|
27
|
+
view_engine do |e, view|
|
28
28
|
view.stubs(:localhost?).returns false
|
29
29
|
|
30
30
|
res = e.run_template do
|
@@ -37,7 +37,7 @@ describe Cream::View::Host do
|
|
37
37
|
|
38
38
|
describe '#for_public' do
|
39
39
|
it "should display public content for public browser agent" do
|
40
|
-
|
40
|
+
view_engine do |e, view|
|
41
41
|
view.stubs(:publichost?).returns true
|
42
42
|
|
43
43
|
res = e.run_template do
|
@@ -48,7 +48,7 @@ describe Cream::View::Host do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should display public content for public browser agent" do
|
51
|
-
|
51
|
+
view_engine do |e, view|
|
52
52
|
view.stubs(:publichost?).returns false
|
53
53
|
|
54
54
|
res = e.run_template do
|
@@ -12,7 +12,7 @@ describe Cream::View::Role do
|
|
12
12
|
|
13
13
|
describe '#area' do
|
14
14
|
it "should display the div with hello" do
|
15
|
-
|
15
|
+
view_engine do |e, view|
|
16
16
|
|
17
17
|
res = e.run_template do
|
18
18
|
%{<%= area :class => 'red' do %>
|
@@ -25,7 +25,7 @@ describe Cream::View::Role do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should display the div with hello when localhost block nested inside" do
|
28
|
-
|
28
|
+
view_engine do |e, view|
|
29
29
|
view.stubs(:localhost?).returns true
|
30
30
|
|
31
31
|
res = e.run_template do
|
@@ -39,7 +39,7 @@ describe Cream::View::Role do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should display the div with hello when nested within localhost block" do
|
42
|
-
|
42
|
+
view_engine do |e, view|
|
43
43
|
view.stubs(:localhost?).returns true
|
44
44
|
|
45
45
|
res = e.run_template do
|
@@ -58,7 +58,7 @@ describe Cream::View::Role do
|
|
58
58
|
|
59
59
|
describe '#area_for_roles' do
|
60
60
|
it "should display an area for :admin" do
|
61
|
-
|
61
|
+
view_engine do |e, view|
|
62
62
|
view.stubs(:has_role?).with([:admin]).returns true
|
63
63
|
|
64
64
|
res = e.run_template do
|
@@ -69,7 +69,7 @@ describe Cream::View::Role do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should not display an area for user not :admin" do
|
72
|
-
|
72
|
+
view_engine do |e, view|
|
73
73
|
view.stubs(:has_role?).with([:admin]).returns false
|
74
74
|
|
75
75
|
res = e.run_template do
|
@@ -82,7 +82,7 @@ describe Cream::View::Role do
|
|
82
82
|
|
83
83
|
describe '#area_not_for_roles' do
|
84
84
|
it "should not display an area for user :admin" do
|
85
|
-
|
85
|
+
view_engine do |e, view|
|
86
86
|
view.stubs(:has_role?).with([:admin]).returns true
|
87
87
|
res = e.run_template do
|
88
88
|
%{<%= area_not_for_roles(:admin) { 'hello' } %>}
|
@@ -92,7 +92,7 @@ describe Cream::View::Role do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should display an area for user not :admin" do
|
95
|
-
|
95
|
+
view_engine do |e, view|
|
96
96
|
# he is not admin
|
97
97
|
view.stubs(:has_role?).with([:admin]).returns false
|
98
98
|
|
@@ -107,7 +107,7 @@ describe Cream::View::Role do
|
|
107
107
|
# context 'method auto-generated when Rails initialize based on registered roles' do
|
108
108
|
# describe '#guest_area' do
|
109
109
|
# it "should display an Admin area for :admin" do
|
110
|
-
#
|
110
|
+
# view_engine do |e, view|
|
111
111
|
# view.stubs(:has_role?).with([:admin]).returns true
|
112
112
|
#
|
113
113
|
# res = e.run_template do
|
@@ -118,7 +118,7 @@ describe Cream::View::Role do
|
|
118
118
|
# end
|
119
119
|
#
|
120
120
|
# it "should not display a Admin area for user not :admin" do
|
121
|
-
#
|
121
|
+
# view_engine do |e, view|
|
122
122
|
# view.stubs(:has_role?).with([:admin]).returns false
|
123
123
|
#
|
124
124
|
# res = e.run_template do
|
data/wiki/ROLE_STRATEGIES.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
*
|
1
|
+
*Cream* supports single and multiple role strategies. Currently groups are not supported.
|
2
2
|
|
3
3
|
Note: Maybe roles support could be integrated in the future using an existing solution for roles and groups?
|
4
4
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 5
|
9
|
+
version: 0.7.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-26 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -38,13 +38,13 @@ dependencies:
|
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
segments:
|
44
44
|
- 0
|
45
|
-
-
|
46
|
-
-
|
47
|
-
version: 0.
|
45
|
+
- 7
|
46
|
+
- 0
|
47
|
+
version: 0.7.0
|
48
48
|
type: :development
|
49
49
|
version_requirements: *id002
|
50
50
|
- !ruby/object:Gem::Dependency
|
@@ -102,9 +102,9 @@ dependencies:
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
segments:
|
104
104
|
- 0
|
105
|
-
-
|
106
|
-
-
|
107
|
-
version: 0.
|
105
|
+
- 2
|
106
|
+
- 0
|
107
|
+
version: 0.2.0
|
108
108
|
type: :runtime
|
109
109
|
version_requirements: *id006
|
110
110
|
- !ruby/object:Gem::Dependency
|
@@ -117,9 +117,9 @@ dependencies:
|
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
segments:
|
119
119
|
- 0
|
120
|
-
-
|
121
|
-
-
|
122
|
-
version: 0.
|
120
|
+
- 2
|
121
|
+
- 0
|
122
|
+
version: 0.2.0
|
123
123
|
type: :runtime
|
124
124
|
version_requirements: *id007
|
125
125
|
- !ruby/object:Gem::Dependency
|
@@ -132,9 +132,9 @@ dependencies:
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
segments:
|
134
134
|
- 0
|
135
|
+
- 3
|
135
136
|
- 2
|
136
|
-
|
137
|
-
version: 0.2.6
|
137
|
+
version: 0.3.2
|
138
138
|
type: :runtime
|
139
139
|
version_requirements: *id008
|
140
140
|
- !ruby/object:Gem::Dependency
|
@@ -143,7 +143,7 @@ dependencies:
|
|
143
143
|
requirement: &id009 !ruby/object:Gem::Requirement
|
144
144
|
none: false
|
145
145
|
requirements:
|
146
|
-
- -
|
146
|
+
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
segments:
|
149
149
|
- 1
|
@@ -158,7 +158,7 @@ dependencies:
|
|
158
158
|
requirement: &id010 !ruby/object:Gem::Requirement
|
159
159
|
none: false
|
160
160
|
requirements:
|
161
|
-
- -
|
161
|
+
- - ">="
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
segments:
|
164
164
|
- 1
|
@@ -173,12 +173,13 @@ dependencies:
|
|
173
173
|
requirement: &id011 !ruby/object:Gem::Requirement
|
174
174
|
none: false
|
175
175
|
requirements:
|
176
|
-
- -
|
176
|
+
- - ">="
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
segments:
|
179
179
|
- 3
|
180
180
|
- 0
|
181
|
-
|
181
|
+
- 1
|
182
|
+
version: 3.0.1
|
182
183
|
type: :runtime
|
183
184
|
version_requirements: *id011
|
184
185
|
- !ruby/object:Gem::Dependency
|
@@ -192,8 +193,8 @@ dependencies:
|
|
192
193
|
segments:
|
193
194
|
- 0
|
194
195
|
- 3
|
195
|
-
-
|
196
|
-
version: 0.3.
|
196
|
+
- 1
|
197
|
+
version: 0.3.1
|
197
198
|
type: :runtime
|
198
199
|
version_requirements: *id012
|
199
200
|
- !ruby/object:Gem::Dependency
|
@@ -221,9 +222,9 @@ dependencies:
|
|
221
222
|
- !ruby/object:Gem::Version
|
222
223
|
segments:
|
223
224
|
- 0
|
224
|
-
-
|
225
|
-
-
|
226
|
-
version: 0.
|
225
|
+
- 4
|
226
|
+
- 0
|
227
|
+
version: 0.4.0
|
227
228
|
type: :runtime
|
228
229
|
version_requirements: *id014
|
229
230
|
- !ruby/object:Gem::Dependency
|
@@ -264,7 +265,7 @@ files:
|
|
264
265
|
- app/views/auth_assist/menu/_admin_login_items.html.erb
|
265
266
|
- app/views/auth_assist/menu/_login_items.html.erb
|
266
267
|
- app/views/auth_assist/menu/_registration_items.html.erb
|
267
|
-
- config/locales/en.yml
|
268
|
+
- config/locales/cream.en.yml
|
268
269
|
- cream.gemspec
|
269
270
|
- features/FEATURE_NOTES.txt
|
270
271
|
- features/permission/adds_permission.feature
|
@@ -275,7 +276,6 @@ files:
|
|
275
276
|
- lib/cream/configure/after_init/role_config.rb
|
276
277
|
- lib/cream/configure/rails.rb
|
277
278
|
- lib/cream/controller/ability.rb
|
278
|
-
- lib/cream/helper/authlabels.rb
|
279
279
|
- lib/cream/helper/host.rb
|
280
280
|
- lib/cream/helper/role.rb
|
281
281
|
- lib/cream/namespaces.rb
|
@@ -298,7 +298,6 @@ files:
|
|
298
298
|
- log/development.log
|
299
299
|
- sandbox/test.rb
|
300
300
|
- spec/configure_helper.rb
|
301
|
-
- spec/cream/configure/cream_setup_spec.rb
|
302
301
|
- spec/cream/configure/rails_custom_roles_spec.rb
|
303
302
|
- spec/cream/configure/rails_role_spec.rb
|
304
303
|
- spec/cream/configure/rails_user_roles_spec.rb
|
@@ -358,7 +357,6 @@ specification_version: 3
|
|
358
357
|
summary: Integrates Devise, Roles and CanCan with Permits for a Rails 3 app
|
359
358
|
test_files:
|
360
359
|
- spec/configure_helper.rb
|
361
|
-
- spec/cream/configure/cream_setup_spec.rb
|
362
360
|
- spec/cream/configure/rails_custom_roles_spec.rb
|
363
361
|
- spec/cream/configure/rails_role_spec.rb
|
364
362
|
- spec/cream/configure/rails_user_roles_spec.rb
|
data/config/locales/en.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Cream::Helper
|
2
|
-
module AuthLabel
|
3
|
-
def auth_labels
|
4
|
-
@auth_labels ||= translate_labels
|
5
|
-
end
|
6
|
-
|
7
|
-
protected
|
8
|
-
|
9
|
-
def translate_labels
|
10
|
-
ns_actions = 'cream.actions'
|
11
|
-
labels = {}
|
12
|
-
%w{new edit delete show sign_in sign_out sign_up edit_registration}.each do |action|
|
13
|
-
labels[action.to_sym] = t "#{ns_actions}.#{action}"
|
14
|
-
end
|
15
|
-
labels[:confirm] = t 'cream.confirm'
|
16
|
-
labels
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|