summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2017-09-22 15:49:56 +0200
committerTim Zallmann <tzallmann@gitlab.com>2017-10-04 14:26:33 +0200
commit79c80de99d511d084cff072bd90192ffe8ba4cda (patch)
treee2bcf7d07fdefabb30b899e64f41ee766fcb771a /app/helpers
parent4a0f720a502ac02423cb9db20727ba386de3e1f1 (diff)
downloadgitlab-ce-79c80de99d511d084cff072bd90192ffe8ba4cda.tar.gz
Making private project avatars use local paths + Some Group Icons
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb7
-rw-r--r--app/helpers/groups_helper.rb9
-rw-r--r--app/helpers/lazy_image_tag_helper.rb6
3 files changed, 18 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8d02d5de5c3..cfdb95e2498 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -41,7 +41,12 @@ module ApplicationHelper
end
if project.avatar_url
- image_tag project.avatar_url, options
+ if project.private?
+ options[:use_original_source] = true
+ image_tag project.avatar_url(use_asset_path: false), options
+ else
+ image_tag project.avatar_url, options
+ end
else # generated icon
project_identicon(project, options)
end
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 82bceddf1f0..091d98a2c94 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -12,7 +12,7 @@ module GroupsHelper
group = Group.find_by_full_path(group)
end
- group.try(:avatar_url) || ActionController::Base.helpers.image_path('no_group_avatar.png')
+ group.try(:avatar_url, use_asset_path: false) || ActionController::Base.helpers.image_path('no_group_avatar.png')
end
def group_title(group, name = nil, url = nil)
@@ -89,7 +89,12 @@ module GroupsHelper
link_to(group_path(group), class: "group-path #{'breadcrumb-item-text' unless for_dropdown} js-breadcrumb-item-text #{'hidable' if hidable}") do
output =
if (group.try(:avatar_url) || show_avatar) && !Rails.env.test?
- image_tag(group_icon(group), class: "avatar-tile", width: 15, height: 15)
+ if group.private?
+ puts "GROUP IS PRIVATE : " + group_icon(group)
+ image_tag(group_icon(group), class: "avatar-tile", width: 15, height: 15, use_original_source: true)
+ else
+ image_tag(group_icon(group), class: "avatar-tile", width: 15, height: 15)
+ end
else
""
end
diff --git a/app/helpers/lazy_image_tag_helper.rb b/app/helpers/lazy_image_tag_helper.rb
index 2c5619ac41b..aea1fcc7e91 100644
--- a/app/helpers/lazy_image_tag_helper.rb
+++ b/app/helpers/lazy_image_tag_helper.rb
@@ -9,7 +9,11 @@ module LazyImageTagHelper
unless options.delete(:lazy) == false
options[:data] ||= {}
- options[:data][:src] = path_to_image(source)
+ unless options.delete(:use_original_source) == true
+ options[:data][:src] = path_to_image(source)
+ else
+ options[:data][:src] = source
+ end
options[:class] ||= ""
options[:class] << " lazy"