debian-mirror-gitlab/app/helpers/groups_helper.rb

34 lines
802 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module GroupsHelper
2015-04-26 12:48:37 +05:30
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
2014-09-02 18:07:02 +05:30
end
def leave_group_message(group)
"Are you sure you want to leave \"#{group}\" group?"
end
2015-04-26 12:48:37 +05:30
2014-09-02 18:07:02 +05:30
def should_user_see_group_roles?(user, group)
if user
user.is_admin? || group.members.exists?(user_id: user.id)
else
false
end
end
2015-04-26 12:48:37 +05:30
def group_icon(group)
if group.is_a?(String)
group = Group.find_by(path: group)
end
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
if group && group.avatar.present?
group.avatar.url
else
image_path('no_group_avatar.png')
end
2014-09-02 18:07:02 +05:30
end
end