|
|
|
@ -8,8 +8,9 @@
|
|
|
|
|
.fields-group
|
|
|
|
|
= f.input :name, wrapper: :with_label
|
|
|
|
|
|
|
|
|
|
.fields-group
|
|
|
|
|
= f.input :position, wrapper: :with_label, input_html: { max: current_user.role.position - 1 }
|
|
|
|
|
- unless current_user.role.id == @role.id
|
|
|
|
|
.fields-group
|
|
|
|
|
= f.input :position, wrapper: :with_label, input_html: { max: current_user.role.position - 1 }
|
|
|
|
|
|
|
|
|
|
.fields-group
|
|
|
|
|
= f.input :color, wrapper: :with_label, input_html: { placeholder: '#000000' }
|
|
|
|
@ -21,17 +22,19 @@
|
|
|
|
|
|
|
|
|
|
%hr.spacer/
|
|
|
|
|
|
|
|
|
|
.field-group
|
|
|
|
|
.input.with_block_label
|
|
|
|
|
%label= t('simple_form.labels.user_role.permissions_as_keys')
|
|
|
|
|
%span.hint= t('simple_form.hints.user_role.permissions_as_keys')
|
|
|
|
|
- unless current_user.role.id == @role.id
|
|
|
|
|
|
|
|
|
|
.field-group
|
|
|
|
|
.input.with_block_label
|
|
|
|
|
%label= t('simple_form.labels.user_role.permissions_as_keys')
|
|
|
|
|
%span.hint= t('simple_form.hints.user_role.permissions_as_keys')
|
|
|
|
|
|
|
|
|
|
- (@role.everyone? ? UserRole::Flags::CATEGORIES.slice(:invites) : UserRole::Flags::CATEGORIES).each do |category, permissions|
|
|
|
|
|
%h4= t(category, scope: 'admin.roles.categories')
|
|
|
|
|
- (@role.everyone? ? UserRole::Flags::CATEGORIES.slice(:invites) : UserRole::Flags::CATEGORIES).each do |category, permissions|
|
|
|
|
|
%h4= t(category, scope: 'admin.roles.categories')
|
|
|
|
|
|
|
|
|
|
= f.input :permissions_as_keys, collection: permissions, wrapper: :with_block_label, include_blank: false, label_method: lambda { |privilege| safe_join([t("admin.roles.privileges.#{privilege}"), content_tag(:span, t("admin.roles.privileges.#{privilege}_description"), class: 'hint')]) }, required: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label: false, hint: false, disabled: permissions.filter { |privilege| UserRole::FLAGS[privilege] & current_user.role.computed_permissions == 0 }
|
|
|
|
|
= f.input :permissions_as_keys, collection: permissions, wrapper: :with_block_label, include_blank: false, label_method: lambda { |privilege| safe_join([t("admin.roles.privileges.#{privilege}"), content_tag(:span, t("admin.roles.privileges.#{privilege}_description"), class: 'hint')]) }, required: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label: false, hint: false, disabled: permissions.filter { |privilege| UserRole::FLAGS[privilege] & current_user.role.computed_permissions == 0 }
|
|
|
|
|
|
|
|
|
|
%hr.spacer/
|
|
|
|
|
%hr.spacer/
|
|
|
|
|
|
|
|
|
|
.actions
|
|
|
|
|
= f.button :button, @role.new_record? ? t('admin.roles.add_new') : t('generic.save_changes'), type: :submit
|
|
|
|
|