_form.html.haml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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,
  8. wrapper: :with_label
  9. - unless current_user.role == form.object
  10. .fields-group
  11. = form.input :position,
  12. input_html: { max: current_user.role.position - 1 },
  13. wrapper: :with_label
  14. .fields-group
  15. = form.input :color,
  16. input_html: { placeholder: '#000000', type: 'color' },
  17. wrapper: :with_label
  18. %hr.spacer/
  19. .fields-group
  20. = form.input :highlighted,
  21. wrapper: :with_label
  22. %hr.spacer/
  23. - unless current_user.role == form.object
  24. .field-group
  25. .input.with_block_label
  26. %label= t('simple_form.labels.user_role.permissions_as_keys')
  27. %span.hint= t('simple_form.hints.user_role.permissions_as_keys')
  28. - (form.object.everyone? ? UserRole::Flags::CATEGORIES.slice(:invites) : UserRole::Flags::CATEGORIES).each do |category, permissions|
  29. %h4= t(category, scope: 'admin.roles.categories')
  30. = form.input :permissions_as_keys,
  31. as: :check_boxes,
  32. collection_wrapper_tag: 'ul',
  33. collection: permissions,
  34. disabled: disable_permissions?(permissions),
  35. hint: false,
  36. include_blank: false,
  37. item_wrapper_tag: 'li',
  38. label_method: ->(privilege) { privilege_label(privilege) },
  39. label: false,
  40. required: false,
  41. wrapper: :with_block_label
  42. %hr.spacer/