Skip to content

Commit

Permalink
Show icons for image templates using source paths...
Browse files Browse the repository at this point in the history
... instead of public paths

Access to the Image Templates page is restricted to authenticated users.
  • Loading branch information
eduardoj committed Jan 31, 2024
1 parent c9ab73d commit 2ef4f10
Show file tree
Hide file tree
Showing 112 changed files with 3,172 additions and 6,643 deletions.
2 changes: 1 addition & 1 deletion src/api/app/helpers/webui/webui_helper.rb
Expand Up @@ -74,7 +74,7 @@ def check_first(first)

def image_template_icon(template)
default_icon = image_url('drive-optical-48.png')
icon = template.public_source_path('_icon') if template.has_icon?
icon = template.source_path('_icon') if template.has_icon?

Check warning on line 77 in src/api/app/helpers/webui/webui_helper.rb

View check run for this annotation

Codecov / codecov/patch

src/api/app/helpers/webui/webui_helper.rb#L77

Added line #L77 was not covered by tests
capture_haml do
content_tag(:object, data: icon || default_icon, type: 'image/png', title: template.title, width: 32, height: 32) do
content_tag(:img, src: default_icon, alt: template.title, width: 32, height: 32)
Expand Down
4 changes: 0 additions & 4 deletions src/api/app/models/package.rb
Expand Up @@ -470,10 +470,6 @@ def source_path(file = nil, opts = {})
Package.source_path(project.name, name, file, opts)
end

def public_source_path(file = nil, opts = {})
"/public#{source_path(file, opts)}"
end

def source_file(file, opts = {})
Backend::Connection.get(source_path(file, opts)).body
end
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2ef4f10

Please sign in to comment.