Retrospring/app/views/modal/privileges/_item.html.haml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
655 B
Plaintext
Raw Normal View History

2020-05-10 03:53:30 -07:00
:ruby
description ||= ""
role_mapping = { admin: "administrator" }
2020-05-10 03:53:30 -07:00
requires_role = %w[admin moderator].include?(privilege)
checked = requires_role ? user.has_cached_role?(role_mapping.fetch(privilege, privilege).to_sym) : user.public_send("#{privilege}?")
2020-05-10 03:53:30 -07:00
%li.list-group-item{ id: "privilege-#{privilege}" }
.d-flex
.flex-shrink-0
%input{ type: :checkbox, name: "check-your-privileges", data: { type: privilege, user: user.screen_name }, checked: checked, autocomplete: :off }
.flex-grow-1
2015-02-03 08:13:50 -08:00
.list-group-item-heading= privilege.capitalize
- unless description.blank?
2015-04-19 13:38:10 -07:00
.list-group-item-text.text-muted= description