From: Jan Provaznik <jprovazn(a)redhat.com>
https://www.aeolusproject.org/redmine/issues/2420
Tabs which are not accessible from anywhere are now linked from "Content"
section (catalogs, realms, hw profiles). Not saying this is ideal but
allows users to navigate to this sections for now.
What is not still accessible is "Settings" tab - maybe it could be separate
section?
---
src/app/controllers/application_controller.rb | 9 +++++++++
src/app/controllers/catalogs_controller.rb | 5 +++++
.../controllers/hardware_profiles_controller.rb | 11 ++++++++---
src/app/controllers/realms_controller.rb | 5 +++++
src/app/views/catalogs/_list.haml | 7 ++++---
src/app/views/catalogs/index.haml | 3 +--
src/app/views/catalogs/new.haml | 14 ++++++++------
src/app/views/hardware_profiles/_list.haml | 2 +-
src/app/views/hardware_profiles/index.haml | 3 +--
src/app/views/hardware_profiles/new.haml | 16 +++++++++-------
src/app/views/layouts/_admin_content_tabs.haml | 14 ++++++++++++++
src/app/views/realms/index.haml | 3 +--
src/config/navigation.rb | 4 ++--
13 files changed, 68 insertions(+), 28 deletions(-)
create mode 100644 src/app/views/layouts/_admin_content_tabs.haml
diff --git a/src/app/controllers/application_controller.rb
b/src/app/controllers/application_controller.rb
index 8f8934c..b2d7453 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -232,4 +232,13 @@ class ApplicationController < ActionController::Base
session[:breadcrumbs] = breadcrumbs
end
+ def set_admin_content_tabs(tab)
+ @tabs = [{:name => 'Catalogs', :url => catalogs_url, :id =>
'catalogs'},
+ {:name => 'Realms', :url => realms_url, :id =>
'realms'},
+ {:name => 'Hardware', :url => hardware_profiles_url, :id =>
'hardware_profiles'},
+ ]
+ unless @details_tab = @tabs.find {|t| t[:id] == tab}
+ raise "Tab '#{tab}' doesn't exist"
+ end
+ end
end
diff --git a/src/app/controllers/catalogs_controller.rb
b/src/app/controllers/catalogs_controller.rb
index e299f98..59b0eca 100644
--- a/src/app/controllers/catalogs_controller.rb
+++ b/src/app/controllers/catalogs_controller.rb
@@ -24,6 +24,11 @@ class CatalogsController < ApplicationController
@catalogs = Catalog.list_for_user(current_user, Privilege::VIEW)
save_breadcrumb(catalogs_path(:viewstate => @viewstate ? @viewstate.id : nil))
set_header
+ set_admin_content_tabs 'catalogs'
+ respond_to do |format|
+ format.html
+ format.js { render :partial => 'list' }
+ end
end
def new
diff --git a/src/app/controllers/hardware_profiles_controller.rb
b/src/app/controllers/hardware_profiles_controller.rb
index b478873..8df760f 100644
--- a/src/app/controllers/hardware_profiles_controller.rb
+++ b/src/app/controllers/hardware_profiles_controller.rb
@@ -27,12 +27,17 @@ class HardwareProfilesController < ApplicationController
clear_breadcrumbs
save_breadcrumb(hardware_profiles_path)
@params = params
+ set_admin_content_tabs 'hardware_profiles'
respond_to do |format|
format.html
format.js do
- build_hardware_profile(params[:hardware_profile])
- matching_provider_hardware_profiles
- render :partial => 'matching_provider_hardware_profiles' and return
+ if params[:hardware_profile]
+ build_hardware_profile(params[:hardware_profile])
+ matching_provider_hardware_profiles
+ render :partial => 'matching_provider_hardware_profiles'
+ else
+ render :partial => 'list'
+ end
end
end
end
diff --git a/src/app/controllers/realms_controller.rb
b/src/app/controllers/realms_controller.rb
index 8e707b6..0e9e64e 100644
--- a/src/app/controllers/realms_controller.rb
+++ b/src/app/controllers/realms_controller.rb
@@ -23,6 +23,11 @@ class RealmsController < ApplicationController
def index
clear_breadcrumbs
save_breadcrumb(realms_path)
+ set_admin_content_tabs 'realms'
+ respond_to do |format|
+ format.html
+ format.js { render :partial => 'list' }
+ end
end
def new
diff --git a/src/app/views/catalogs/_list.haml b/src/app/views/catalogs/_list.haml
index 3e1a6cf..9b0555d 100644
--- a/src/app/views/catalogs/_list.haml
+++ b/src/app/views/catalogs/_list.haml
@@ -1,11 +1,12 @@
%section.admin-content-section.catalogs
- %header
- %h2 Catalogs List
- %span.label.badge.dark.count= @catalogs.length
+ /%header
+ / %h2 Catalogs List
+ / %span.label.badge.dark.count= @catalogs.length
.content
- content_for :form_header do
%li= restful_submit_tag "Delete", "destroy",
multi_destroy_catalogs_path, 'DELETE', :id => 'delete_button', :class
=> 'button danger'
+ %li= link_to "New Catalog", new_catalog_path, :id =>
'new_catalog_button', :class => 'button pill'
= filter_table(@header, @catalogs) do |catalog|
%tr{:class => cycle('nostripe','stripe')}
diff --git a/src/app/views/catalogs/index.haml b/src/app/views/catalogs/index.haml
index 3fae6b6..947fd74 100644
--- a/src/app/views/catalogs/index.haml
+++ b/src/app/views/catalogs/index.haml
@@ -1,3 +1,2 @@
= render :partial => 'layouts/admin_nav'
-= render :partial => 'section_header'
-= render :partial => 'list'
+= render :partial => 'layouts/admin_content_tabs'
diff --git a/src/app/views/catalogs/new.haml b/src/app/views/catalogs/new.haml
index be583cf..1b24fa7 100644
--- a/src/app/views/catalogs/new.haml
+++ b/src/app/views/catalogs/new.haml
@@ -1,10 +1,12 @@
= render :partial => 'layouts/admin_nav'
-= render :partial => 'section_header'
-%section.admin-content-section.provider_accounts
+%header.admin-page-header
%header
- %h2 Add New Catalog
+ %h1 Add New Catalog
+ #obj_actions
+ Return to:
+ = link_to "Catalogs", catalogs_path, :class => 'rounded-link'
- .content
- = form_for @catalog, :url => catalogs_path, :html => {:class =>
'generic'} do |f|
- = render :partial => "form", :locals => { :form => f }
+%section.admin-content-section
+ = form_for @catalog, :url => catalogs_path, :html => {:class =>
'generic'} do |f|
+ = render :partial => "form", :locals => { :form => f }
diff --git a/src/app/views/hardware_profiles/_list.haml
b/src/app/views/hardware_profiles/_list.haml
index d40d837..013cb8b 100644
--- a/src/app/views/hardware_profiles/_list.haml
+++ b/src/app/views/hardware_profiles/_list.haml
@@ -1,7 +1,7 @@
.content
- content_for :form_header do
%li= restful_submit_tag "Delete Selected", "destroy",
multi_destroy_hardware_profiles_path, 'DELETE', :id => 'delete_button',
:class => 'button pill danger'
- %li= link_to "New Hardware", new_hardware_profile_path, :id =>
'new_hardware_profile', :class => 'button pill'
+ %li= link_to "New Hardware", new_hardware_profile_path, :id =>
'new_hardware_profile_button', :class => 'button pill'
= filter_table(hardware_profiles_header, @hardware_profiles) do |hwp|
%tr{:class => cycle('nostripe','stripe')}
diff --git a/src/app/views/hardware_profiles/index.haml
b/src/app/views/hardware_profiles/index.haml
index 3fae6b6..947fd74 100644
--- a/src/app/views/hardware_profiles/index.haml
+++ b/src/app/views/hardware_profiles/index.haml
@@ -1,3 +1,2 @@
= render :partial => 'layouts/admin_nav'
-= render :partial => 'section_header'
-= render :partial => 'list'
+= render :partial => 'layouts/admin_content_tabs'
diff --git a/src/app/views/hardware_profiles/new.haml
b/src/app/views/hardware_profiles/new.haml
index 5d5f3f4..795a706 100644
--- a/src/app/views/hardware_profiles/new.haml
+++ b/src/app/views/hardware_profiles/new.haml
@@ -1,12 +1,14 @@
= render :partial => 'layouts/admin_nav'
-= render :partial => 'section_header'
-%section.admin-content-section
+%header.admin-page-header
%header
- %h2 New Hardware Profile
+ %h1 New Hardware Profile
+ #obj_actions
+ Return to:
+ = link_to "Hardware Profiles", hardware_profiles_path, :class =>
'rounded-link'
- .content
- = form_for @hardware_profile, :url => hardware_profiles_path, :html => {
:multipart => true } do |hwp_form|
- = render :partial => "form", :locals => { :hwp_form => hwp_form
}
+%section.admin-content-section
+ = form_for @hardware_profile, :url => hardware_profiles_path, :html => {
:multipart => true } do |hwp_form|
+ = render :partial => "form", :locals => { :hwp_form => hwp_form }
- = render :partial => 'matching_provider_hardware_profiles' if
params[:commit] == 'Check Matches'
+ = render :partial => 'matching_provider_hardware_profiles' if
params[:commit] == 'Check Matches'
diff --git a/src/app/views/layouts/_admin_content_tabs.haml
b/src/app/views/layouts/_admin_content_tabs.haml
new file mode 100644
index 0000000..57d551a
--- /dev/null
+++ b/src/app/views/layouts/_admin_content_tabs.haml
@@ -0,0 +1,14 @@
+%section.admin-content-section
+ %header#tab-container-1
+ %h2
+ %nav.faceted
+ %ul#tab-container-1-nav
+ - @tabs.each do |tab|
+ %li
+ %a{ :href => tab[:url], :id => "details_#{tab[:id]}", :class
=> "#{'active' if @details_tab[:id] == tab[:id]} show"}
+ = tab[:name]
+ -if tab[:count]
+ %span.label.badge.count.dark=tab[:count]
+ .content.collapsible.toggle-view.pools#tab
+ %ul.deployable-cards
+ = render :partial => 'list'
diff --git a/src/app/views/realms/index.haml b/src/app/views/realms/index.haml
index 3fae6b6..947fd74 100644
--- a/src/app/views/realms/index.haml
+++ b/src/app/views/realms/index.haml
@@ -1,3 +1,2 @@
= render :partial => 'layouts/admin_nav'
-= render :partial => 'section_header'
-= render :partial => 'list'
+= render :partial => 'layouts/admin_content_tabs'
diff --git a/src/config/navigation.rb b/src/config/navigation.rb
index 0d5bad3..8edc32a 100644
--- a/src/config/navigation.rb
+++ b/src/config/navigation.rb
@@ -24,8 +24,8 @@ SimpleNavigation::Configuration.run do |navigation|
first_level.item :administer, t(:administer), users_path, :class =>
'administer' do |second_level|
second_level.item :users_and_groups, "Users & Groups", users_path,
:link => { :class => 'users' }, :highlights_on =>
/\/users|\/roles|\/account/
second_level.item :environments, "Environments", pool_families_path,
:link => { :class => 'environments' }, :highlights_on =>
/\/pool_families/
- second_level.item :content, "Content", catalogs_path, :link => {
:class => 'content' }, :highlights_on => /\/catalogs|\/catalog_entries/
- second_level.item :cloud_providers, "Cloud Providers", providers_path,
:link => { :class => 'providers' }, :highlights_on =>
/\/providers|\/realms|\/realm_mappingsi|\/hardware_profiles/
+ second_level.item :content, "Content", catalogs_path, :link => {
:class => 'content' }, :highlights_on =>
/\/catalogs|\/catalog_entries|\/realms|\/hardware_profiles|\/realm_mappings/
+ second_level.item :cloud_providers, "Cloud Providers", providers_path,
:link => { :class => 'providers' }, :highlights_on => /\/providers/
end
end
end
--
1.7.6