2020-05-10 03:53:30 -07:00
|
|
|
:ruby
|
2022-07-26 17:12:07 -07:00
|
|
|
description ||= ""
|
|
|
|
role_mapping = { admin: "administrator" }
|
2020-05-10 03:53:30 -07:00
|
|
|
requires_role = %w[admin moderator].include?(privilege)
|
2022-12-17 18:21:25 -08:00
|
|
|
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}" }
|
2023-01-04 07:12:43 -08:00
|
|
|
.d-flex
|
|
|
|
.flex-shrink-0
|
2022-07-26 17:12:07 -07:00
|
|
|
%input{ type: :checkbox, name: "check-your-privileges", data: { type: privilege, user: user.screen_name }, checked: checked, autocomplete: :off }
|
2023-01-04 07:12:43 -08:00
|
|
|
.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
|