Skip to content

Commit

Permalink
[webui][api] Hide/show routes and link to image templates based on fe…
Browse files Browse the repository at this point in the history
…ature switch
  • Loading branch information
Moises Deniz Aleman committed Jan 26, 2017
1 parent f565e9c commit 10ea796
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/api/app/views/webui/main/index.html.erb
Expand Up @@ -22,7 +22,7 @@
<% unless @spider_bot -%>
<%= proceed_link 'utilities-system-monitor', 'Status Monitor', :controller => 'monitor', :action => 'index' %>
<% end -%>
<%= proceed_link 'drive-optical-32', 'New Image', image_templates_path if User.current.is_admin? %>
<%= proceed_link 'drive-optical-32', 'New Image', image_templates_path if Feature.active?(:image_templates) %>
</ul>
</div>

Expand All @@ -40,4 +40,3 @@
<%= render :partial => 'news' %>
<%= render :partial => 'latest_updates' if (@latest_updates and ::Configuration.anonymous) %>
</div>

12 changes: 8 additions & 4 deletions src/api/config/routes.rb
Expand Up @@ -64,7 +64,9 @@ def self.public_or_about_path?(request)
end
end

resources :image_templates, constraints: cons, only: [:index], controller: 'webui/image_templates'
Feature.with(:image_templates) do
resources :image_templates, constraints: cons, only: [:index], controller: 'webui/image_templates'
end

resources :download_repositories, constraints: cons, only: [:create, :update, :destroy], controller: 'webui/download_on_demand'

Expand Down Expand Up @@ -643,11 +645,13 @@ def self.public_or_about_path?(request)

get '/404' => 'main#notfound'

scope 'public' do
Feature.with(:image_templates) do
scope 'public' do
resources :image_templates, constraints: cons, only: [:index], controller: 'webui/image_templates'
end

resources :image_templates, constraints: cons, only: [:index], controller: 'webui/image_templates'
end

resources :image_templates, constraints: cons, only: [:index], controller: 'webui/image_templates'
end

controller :source do
Expand Down

0 comments on commit 10ea796

Please sign in to comment.