Skip to content

Commit

Permalink
[webui] Disable create button and use public route
Browse files Browse the repository at this point in the history
for icons.
The controller needs to be accessible for not logged in users otherwise interconnect won't work.
However, the create button needs to be disabled and retrieving the icons needs to happen
via the /public route, otherwise backend requires login to access the page.
Fixes #2619.
  • Loading branch information
ChrisBr committed Mar 7, 2017
1 parent dbf5499 commit 59773c2
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 252 deletions.
4 changes: 4 additions & 0 deletions src/api/app/models/package.rb
Expand Up @@ -433,6 +433,10 @@ 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 = {})
Suse::Backend.get(source_path(file, opts)).body
end
Expand Down
6 changes: 3 additions & 3 deletions src/api/app/views/webui/image_templates/index.html.haml
Expand Up @@ -15,7 +15,7 @@
%dd
%span.form-radio
- if template.has_icon?
%img{ alt: template.title, src: template.source_path('_icon') }
%img{ alt: template.title, src: template.public_source_path('_icon') }
- else
= sprite_tag('drive-optical-48')
%span.group
Expand All @@ -28,7 +28,7 @@
There are currently no base image templates available for project
= succeed '.' do
%strong= title_or_name(project)
- if first_template && User.current
- if first_template
.templates_form
= form_tag({ controller: :package, action: :branch }, method: :post, id: 'appliance_form') do
= hidden_field_tag 'linked_project', first_template.project
Expand All @@ -40,7 +40,7 @@
(Maximum of 200 characters, no blank, /, :, - or ; characters)
%br
= text_field_tag(:target_package, first_template, class: 'name_appliance_form', required: true)
= submit_tag('Create appliance', class: 'create_appliance')
= submit_tag('Create appliance', class: 'create_appliance', disabled: User.current.is_nobody? ? true: nil)
- elsif @projects.empty?
%p
There are no templates yet, sorry.

0 comments on commit 59773c2

Please sign in to comment.