Reorder roles and add icons
This commit is contained in:
parent
07311aa032
commit
de794a48b0
9 changed files with 22 additions and 20 deletions
|
@ -37,3 +37,4 @@ License
|
|||
|
||||
GPL version 3 or later, please see [LICENSE](LICENSE.md) for the full text.
|
||||
|
||||
Thanks to [Icons8](http://icons8.com/) for letting us use their icons.
|
||||
|
|
BIN
app/assets/images/role-admin.png
Normal file
BIN
app/assets/images/role-admin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 761 B |
BIN
app/assets/images/role-article_meta.png
Normal file
BIN
app/assets/images/role-article_meta.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 757 B |
BIN
app/assets/images/role-finance.png
Normal file
BIN
app/assets/images/role-finance.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 883 B |
BIN
app/assets/images/role-orders.png
Normal file
BIN
app/assets/images/role-orders.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 275 B |
BIN
app/assets/images/role-suppliers.png
Normal file
BIN
app/assets/images/role-suppliers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 823 B |
|
@ -149,14 +149,15 @@ module ApplicationHelper
|
|||
link_to(text, options[:url], remote_options.merge(options))
|
||||
end
|
||||
|
||||
def format_roles(record)
|
||||
roles = []
|
||||
roles << I18n.t('helpers.application.role_admin') if record.role_admin?
|
||||
roles << I18n.t('helpers.application.role_finance') if record.role_finance?
|
||||
roles << I18n.t('helpers.application.role_suppliers') if record.role_suppliers?
|
||||
roles << I18n.t('helpers.application.role_article_meta') if record.role_article_meta?
|
||||
roles << I18n.t('helpers.application.role_orders') if record.role_orders?
|
||||
roles.join(', ')
|
||||
def format_roles(record, icon=false)
|
||||
roles = %w(suppliers article_meta orders finance admin)
|
||||
roles.select! {|role| record.send "role_#{role}?"}
|
||||
names = Hash[roles.map{|r| [r, I18n.t("helpers.application.role_#{r}")]}]
|
||||
if icon
|
||||
roles.map{|r| image_tag("role-#{r}.png", size: '22x22', border: 0, alt: names[r], title: names[r])}.join(' ').html_safe
|
||||
else
|
||||
roles.map{|r| names[r]}.join(', ')
|
||||
end
|
||||
end
|
||||
|
||||
def link_to_gmaps(address)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
- if FoodsoftConfig[:use_nick]
|
||||
%td= user.name
|
||||
%td= user.email
|
||||
%td= format_roles(user)
|
||||
%td= format_roles(user, true)
|
||||
%td= format_time(user.last_activity)
|
||||
%td= link_to t('ui.edit'), edit_admin_user_path(user), class: 'btn btn-mini'
|
||||
%td= link_to t('ui.delete'), [:admin, user], :data => {:confirm => t('admin.confirm', name: user.name)},
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
= simple_form_for [:admin, @workgroup] do |f|
|
||||
- captured = capture do
|
||||
%h4= t 'admin.access_to'
|
||||
= f.input :role_admin
|
||||
= f.input :role_finance
|
||||
= f.input :role_suppliers
|
||||
= f.input :role_article_meta
|
||||
= f.input :role_orders
|
||||
= f.input :role_finance
|
||||
= f.input :role_admin
|
||||
= render 'shared/group_form_fields', :f => f, captured: captured
|
||||
.form-actions
|
||||
= f.button :submit
|
||||
|
|
Loading…
Reference in a new issue