Refactor roles

This commit is contained in:
Martin Lensment 2015-01-20 17:49:14 +02:00
parent b527221baf
commit b0eb6798b0
16 changed files with 155 additions and 223 deletions

View file

@ -26,8 +26,8 @@
= f.label :email
= f.text_field(:email, class: 'form-control')
.form-group
= f.label :role_id
= f.select(:role_id, Role.all.map {|x| [t(x.code), x.id] }, {}, { class: 'form-control selectize' })
= f.label :role
= select_tag 'user[roles][]', options_for_select(User::ROLES.map {|x| [t(x), x] }, @user.roles.try(:first)), class: 'form-control selectize'
%hr
.row

View file

@ -25,8 +25,8 @@
%td= link_to(x, [:admin, x])
%td= x.email
%td= x.identity_code
- if x.role
%td= t(x.role)
- if x.roles
%td= t(x.roles.first)
- else
%td
.row

View file

@ -40,7 +40,7 @@
%dd= @user.email
%dt= t('role')
- if @user.role
%dd= t(@user.role)
- if @user.roles
%dd= t(@user.roles.first)
- else
%dd