2013-01-07 13:48:57 -05:00
|
|
|
module GroupsHelper
|
2016-03-01 10:22:29 -05:00
|
|
|
def can_change_group_visibility_level?(group)
|
|
|
|
can?(current_user, :change_visibility_level, group)
|
|
|
|
end
|
|
|
|
|
2015-03-12 16:56:53 -04:00
|
|
|
def group_icon(group)
|
|
|
|
if group.is_a?(String)
|
|
|
|
group = Group.find_by(path: group)
|
|
|
|
end
|
|
|
|
|
2016-03-03 14:52:38 -05:00
|
|
|
if group && group.avatar.present?
|
2015-03-12 16:56:53 -04:00
|
|
|
group.avatar.url
|
|
|
|
else
|
2016-05-31 08:02:12 -04:00
|
|
|
image_path('no_group_avatar.png')
|
2015-03-12 16:56:53 -04:00
|
|
|
end
|
|
|
|
end
|
2015-09-07 07:18:11 -04:00
|
|
|
|
2015-09-17 06:16:24 -04:00
|
|
|
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
|
|
|
|
|
2015-09-07 07:18:11 -04:00
|
|
|
content_tag :span do
|
2015-09-17 06:16:24 -04:00
|
|
|
full_title
|
2015-09-07 07:18:11 -04:00
|
|
|
end
|
|
|
|
end
|
2013-01-07 13:48:57 -05:00
|
|
|
end
|