mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-26 21:16:06 +10:00
# Conflicts: # app/controllers/groups/application_controller.rb # app/services/test_hook_service.rb # app/views/admin/groups/show.html.haml # app/views/groups/_settings_nav.html.haml # app/views/groups/show.html.haml # app/views/layouts/_head.html.haml # app/views/projects/_settings_nav.html.haml # db/schema.rb # features/project/project.feature # features/steps/project/project.rb
44 lines
1.0 KiB
Ruby
44 lines
1.0 KiB
Ruby
module GroupsHelper
|
|
def remove_user_from_group_message(group, member)
|
|
if member.user
|
|
"Are you sure you want to remove \"#{member.user.name}\" from \"#{group.name}\"?"
|
|
else
|
|
"Are you sure you want to revoke the invitation for \"#{member.invite_email}\" to join \"#{group.name}\"?"
|
|
end
|
|
end
|
|
|
|
def leave_group_message(group)
|
|
"Are you sure you want to leave \"#{group}\" group?"
|
|
end
|
|
|
|
def should_user_see_group_roles?(user, group)
|
|
if user
|
|
user.is_admin? || group.members.exists?(user_id: user.id)
|
|
else
|
|
false
|
|
end
|
|
end
|
|
|
|
def group_settings_page?
|
|
if current_controller?('groups')
|
|
current_action?('edit') || current_action?('projects')
|
|
elsif ['ldap_group_links', 'audit_events', 'hooks'].any?{ |c| current_controller? c }
|
|
true
|
|
else
|
|
false
|
|
end
|
|
end
|
|
|
|
def group_icon(group)
|
|
if group.is_a?(String)
|
|
group = Group.find_by(path: group)
|
|
end
|
|
|
|
if group && group.avatar.present?
|
|
group.avatar.url
|
|
else
|
|
image_path('no_group_avatar.png')
|
|
end
|
|
end
|
|
end
|