From: Tomas Sedovic <[email protected]>
Implemented using JQuery UI Tabs. The plugin loads the tab content using ajax
calls.
Added HTML parameter "ajax=true" that renders any dashboard page without the
layout (for the Ajax calls). The version with layouts is used for the browsers
with disabled JS.
---
src/app/controllers/dashboard_controller.rb | 16 ++++++++++++++--
src/app/views/dashboard/_dashboard_nav.haml | 27 ++++++++++++++-------------
src/app/views/layouts/aggregator.haml | 1 +
src/public/stylesheets/dcloud.css | 8 ++++++++
4 files changed, 37 insertions(+), 15 deletions(-)
create mode 100644 src/app/views/dashboard/index.haml
diff --git a/src/app/controllers/dashboard_controller.rb
b/src/app/controllers/dashboard_controller.rb
index c1dbb8f..5b0e837 100644
--- a/src/app/controllers/dashboard_controller.rb
+++ b/src/app/controllers/dashboard_controller.rb
@@ -20,13 +20,25 @@
# Likewise, all the methods added will be available for all controllers.
class DashboardController < ApplicationController
- layout "dashboard"
+ layout :layout
before_filter :require_user
+ def layout
+ return "dashboard" unless ajax?
+ end
+
+ def ajax?
+ return params[:ajax] == "true"
+ end
+
def index
@hide_getting_started =
cookies["#...@current_user.login}_hide_getting_started"]
@current_users_pool = Pool.find(:first, :conditions => ['name = ?',
@current_user.login])
- render :action => :summary
+ if ajax?
+ render :action => :summary
+ else
+ render :action => :index
+ end
end
def hide_getting_started
diff --git a/src/app/views/dashboard/_dashboard_nav.haml
b/src/app/views/dashboard/_dashboard_nav.haml
index 851b678..edccde8 100644
--- a/src/app/views/dashboard/_dashboard_nav.haml
+++ b/src/app/views/dashboard/_dashboard_nav.haml
@@ -1,13 +1,14 @@
-%ul
- %li
- =link_to "Summary", dashboard_url + "/summary"
- %li
- = link_to "Alerts", dashboard_url + "/alerts"
- %li
- = link_to "Service Quality", dashboard_url + "/service_quality"
- %li
- = link_to "Quota Usage", dashboard_url + "/quota_usage"
- %li
- = link_to "Billing", dashboard_url + "/billing"
- %li
- = link_to "Help Tickets", dashboard_url + "/help_tickets"
+#dashboard-tabs
+ %ul
+ %li
+ = link_to "Summary", { :controller => "dashboard", :action => "index",
:ajax => "true" }
+ %li
+ = link_to "Alerts", { :controller => "dashboard", :action => "alerts",
:ajax => "true" }
+ %li
+ = link_to "Service Quality", { :controller => "dashboard", :action =>
"service_quality", :ajax => "true" }
+ %li
+ = link_to "Quota Usage", { :controller => "dashboard", :action =>
"quota_usage", :ajax => "true" }
+ %li
+ = link_to "Billing", { :controller => "dashboard", :action => "billing",
:ajax => "true" }
+ %li
+ = link_to "Help Tickets", { :controller => "dashboard", :action =>
"help_tickets", :ajax => "true" }
diff --git a/src/app/views/dashboard/index.haml
b/src/app/views/dashboard/index.haml
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/views/layouts/aggregator.haml
b/src/app/views/layouts/aggregator.haml
index 9b62dd3..20fabfc 100644
--- a/src/app/views/layouts/aggregator.haml
+++ b/src/app/views/layouts/aggregator.haml
@@ -56,6 +56,7 @@
});
return false;})},function(){});
$('ul.instance_action_list
li:first-child').addClass('first');
+ $("#dashboard-tabs").tabs();
});
= yield :scripts
%body
diff --git a/src/public/stylesheets/dcloud.css
b/src/public/stylesheets/dcloud.css
index 9c18a50..1621778 100644
--- a/src/public/stylesheets/dcloud.css
+++ b/src/public/stylesheets/dcloud.css
@@ -277,3 +277,11 @@ a.button_link {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
+
+#dashboard-tabs {
+ border: none;
+}
+
+#dashboard-tabs ul {
+ float: none;
+}
--
1.6.6.1
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel