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

43 lines
1 KiB
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
2015-09-25 12:07:36 +05:30
'no_group_avatar.png'
end
end
def group_title(group, name = nil, url = nil)
full_title = link_to(simple_sanitize(group.name), group_path(group))
full_title += ' · '.html_safe + link_to(simple_sanitize(name), url) if name
content_tag :span do
full_title
2015-04-26 12:48:37 +05:30
end
2014-09-02 18:07:02 +05:30
end
end