_form.html.haml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. = render 'shared/error_messages', object: form.object
  2. - if form.object.everyone?
  3. .flash-message.info
  4. = t('admin.roles.everyone_full_description_html')
  5. - else
  6. .fields-group
  7. = form.input :name, wrapper: :with_label
  8. - unless current_user.role == form.object
  9. .fields-group
  10. = form.input :position, wrapper: :with_label, input_html: { max: current_user.role.position - 1 }
  11. .fields-group
  12. = form.input :color, wrapper: :with_label, input_html: { placeholder: '#000000', type: 'color' }
  13. %hr.spacer/
  14. .fields-group
  15. = form.input :highlighted, wrapper: :with_label
  16. %hr.spacer/
  17. - unless current_user.role == form.object
  18. .field-group
  19. .input.with_block_label
  20. %label= t('simple_form.labels.user_role.permissions_as_keys')
  21. %span.hint= t('simple_form.hints.user_role.permissions_as_keys')
  22. - (form.object.everyone? ? UserRole::Flags::CATEGORIES.slice(:invites) : UserRole::Flags::CATEGORIES).each do |category, permissions|
  23. %h4= t(category, scope: 'admin.roles.categories')
  24. = form.input :permissions_as_keys, collection: permissions, wrapper: :with_block_label, include_blank: false, label_method: ->(privilege) { privilege_label(privilege) }, required: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label: false, hint: false, disabled: disable_permissions?(permissions)
  25. %hr.spacer/