Retrospring/app/views/user/_modal_privileges_item.html...

13 lines
658 B
Plaintext

- description ||= ''
- role_mapping = {"admin" => "administrator"}
- requires_role = %w[admin moderator].include?(privilege)
- checked = requires_role ? user.has_role?(role_mapping.fetch(privilege, privilege).to_sym) : user.public_send("#{privilege}?")
%li.list-group-item{id: "privilege-#{privilege}"}
.media
.pull-left.j2-table
%input.input--center{type: :checkbox, name: 'check-your-privileges', data: { type: privilege, user: user.screen_name }, checked: checked, autocomplete: 'off'}
.media-body
.list-group-item-heading= privilege.capitalize
- unless description.blank?
.list-group-item-text.text-muted= description