OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/cells/members/role_form_cell.rb

38 lines
768 B

module Members
class RoleFormCell < ::RailsCell
include RemovedJsHelpersHelper
options :row, :params, :roles
def member
model
end
def form_url
url_for form_url_hash
end
def form_url_hash
{
controller: '/members',
action: 'update',
id: member.id,
page: params[:page],
per_page: params[:per_page]
}
end
def role_checkbox(role)
check_box_tag 'member[role_ids][]',
role.id,
member.roles.include?(role),
disabled: role_disabled?(role)
end
def role_disabled?(role)
member
.member_roles
.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? }
end
end
end