2023-09-29 00:36:24 +10:00
|
|
|
= render 'shared/error_messages', object: form.object
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
- if form.object.everyone?
|
|
|
|
.flash-message.info
|
|
|
|
= t('admin.roles.everyone_full_description_html')
|
|
|
|
- else
|
|
|
|
.fields-group
|
|
|
|
= form.input :name, wrapper: :with_label
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
- unless current_user.role == form.object
|
2022-07-05 10:41:40 +10:00
|
|
|
.fields-group
|
2023-09-29 00:36:24 +10:00
|
|
|
= form.input :position, wrapper: :with_label, input_html: { max: current_user.role.position - 1 }
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
.fields-group
|
|
|
|
= form.input :color, wrapper: :with_label, input_html: { placeholder: '#000000', type: 'color' }
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
%hr.spacer/
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
.fields-group
|
|
|
|
= form.input :highlighted, wrapper: :with_label
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
%hr.spacer/
|
2022-07-17 21:37:30 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
- unless current_user.role == form.object
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
.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')
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
- (form.object.everyone? ? UserRole::Flags::CATEGORIES.slice(:invites) : UserRole::Flags::CATEGORIES).each do |category, permissions|
|
|
|
|
%h4= t(category, scope: 'admin.roles.categories')
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
= form.input :permissions_as_keys, collection: permissions, wrapper: :with_block_label, include_blank: false, label_method: ->(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 }
|
2022-07-05 10:41:40 +10:00
|
|
|
|
2023-09-29 00:36:24 +10:00
|
|
|
%hr.spacer/
|