2013-01-07 13:48:57 -05:00
|
|
|
module GroupsHelper
|
2013-06-17 09:51:43 -04:00
|
|
|
def remove_user_from_group_message(group, user)
|
2014-02-07 11:59:55 -05:00
|
|
|
"Are you sure you want to remove \"#{user.name}\" from \"#{group.name}\"?"
|
|
|
|
end
|
|
|
|
|
|
|
|
def leave_group_message(group)
|
|
|
|
"Are you sure you want to leave \"#{group}\" group?"
|
2013-06-17 09:51:43 -04:00
|
|
|
end
|
2014-02-13 15:45:51 -05:00
|
|
|
|
|
|
|
def should_user_see_group_roles?(user, group)
|
|
|
|
if user
|
|
|
|
user.is_admin? || group.members.exists?(user_id: user.id)
|
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
2013-11-13 03:35:10 -05:00
|
|
|
|
|
|
|
def group_head_title
|
|
|
|
title = @group.name
|
|
|
|
|
|
|
|
title = if current_action?(:issues)
|
|
|
|
"Issues - " + title
|
|
|
|
elsif current_action?(:merge_requests)
|
|
|
|
"Merge requests - " + title
|
|
|
|
elsif current_action?(:members)
|
|
|
|
"Members - " + title
|
|
|
|
elsif current_action?(:edit)
|
|
|
|
"Settings - " + title
|
|
|
|
else
|
|
|
|
title
|
|
|
|
end
|
|
|
|
|
|
|
|
title
|
2014-06-25 06:30:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def group_filter_path(entity, options={})
|
|
|
|
exist_opts = {
|
2014-06-26 05:58:40 -04:00
|
|
|
status: params[:status]
|
2014-06-25 06:30:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
options = exist_opts.merge(options)
|
2013-11-13 03:35:10 -05:00
|
|
|
|
2014-06-25 06:30:57 -04:00
|
|
|
path = request.path
|
|
|
|
path << "?#{options.to_param}"
|
|
|
|
path
|
2013-11-13 03:35:10 -05:00
|
|
|
end
|
2013-01-07 13:48:57 -05:00
|
|
|
end
|