Commit f142891e9d09d1001a2de0356f30466654273d3a
1 parent
f285ecc3
Exists in
master
and in
29 other branches
ActionItem5: interface to manage roles functional
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@483 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
19 additions
and
7 deletions
Show diff stats
app/controllers/role_controller.rb
app/models/role.rb
... | ... | @@ -11,9 +11,8 @@ class Role < ActiveRecord::Base |
11 | 11 | } |
12 | 12 | |
13 | 13 | def self.permission_name(p) |
14 | -# msgid = ... | |
15 | -# gettext(msgid) | |
16 | - raise "Moises need to write me" | |
14 | + msgid = PERMISSIONS.values.inject({}){|s,v| s.merge(v)}[p] | |
15 | + gettext(msgid) | |
17 | 16 | end |
18 | 17 | |
19 | 18 | has_many :role_assignments | ... | ... |
app/views/role/_form.rhtml
1 | 1 | <%= error_messages_for :role %> |
2 | 2 | |
3 | -<% labelled_form_for :role, @role do |f| %> | |
3 | +<% labelled_form_for :role, @role, :url => (mode == :edit) ? {:action => 'update', :id => role} : {:action => 'create'} do |f| %> | |
4 | 4 | |
5 | 5 | <%= f.text_field :name %> |
6 | 6 | |
7 | 7 | <%= _('Permissions: ') %> <br> |
8 | 8 | <% Role::PERMISSIONS[:profile].keys.each do |p| %> |
9 | - <%= labelled_form_field("bla", (check_box_tag "role[permissions][#{p}]", @role.has_permission?(p))) %> | |
9 | + <%= labelled_form_field(Role.permission_name(p), (check_box_tag "role[permissions][]", p, @role.has_permission?(p))) %> | |
10 | 10 | <% end %> |
11 | + | |
12 | + <%= submit_tag (mode == :edit) ? _('Save changes') : _('Create role')%> | |
11 | 13 | <% end %> | ... | ... |
app/views/role/index.rhtml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <li> |
5 | 5 | <%= link_to role.name, :action => 'show', :id => role %> |
6 | 6 | <%= link_to _('Edit'), :action => 'edit', :id => role %> |
7 | - <%= link_to _('Destroy'), :action => 'destoy', :id => role %> | |
7 | + <%= link_to _('Destroy'), :action => 'destroy', :id => role %> | |
8 | 8 | </li> |
9 | 9 | <% end %> |
10 | 10 | </ul> | ... | ... |