2014-09-02 18:07:02 +05:30
|
|
|
module GroupsHelper
|
2016-06-02 11:05:42 +05:30
|
|
|
def can_change_group_visibility_level?(group)
|
|
|
|
can?(current_user, :change_visibility_level, group)
|
|
|
|
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
|
2016-06-16 23:09:34 +05:30
|
|
|
image_path('no_group_avatar.png')
|
2015-09-25 12:07:36 +05:30
|
|
|
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
|