From: Tomas Sedovic <[email protected]>

---
 src/app/controllers/dashboard_controller.rb |    6 +-----
 src/app/views/dashboard/_dashboard_nav.haml |   27 +++++++++++++--------------
 src/app/views/layouts/aggregator.haml       |    1 -
 src/app/views/layouts/dashboard.haml        |   16 +++++++++++++++-
 4 files changed, 29 insertions(+), 21 deletions(-)
 delete 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 5b0e837..ef89d95 100644
--- a/src/app/controllers/dashboard_controller.rb
+++ b/src/app/controllers/dashboard_controller.rb
@@ -34,11 +34,7 @@ class DashboardController < ApplicationController
   def index
     @hide_getting_started = 
cookies["#...@current_user.login}_hide_getting_started"]
     @current_users_pool = Pool.find(:first, :conditions => ['name = ?', 
@current_user.login])
-    if ajax?
-      render :action => :summary
-    else
-      render :action => :index
-    end
+    render :action => :summary
   end
 
   def hide_getting_started
diff --git a/src/app/views/dashboard/_dashboard_nav.haml 
b/src/app/views/dashboard/_dashboard_nav.haml
index edccde8..b75690c 100644
--- a/src/app/views/dashboard/_dashboard_nav.haml
+++ b/src/app/views/dashboard/_dashboard_nav.haml
@@ -1,14 +1,13 @@
-#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" }
+- menu = [ { :text => "Summary", :action => "index" }, |
+  { :text => "Alerts", :action => "alerts" }, |
+  { :text => "Service Quality", :action => "service_quality" }, |
+  { :text => "Quota Usage", :action => "quota_usage" }, |
+  { :text => "Billing", :action => "billing" }, |
+  { :text => "Help Tickets", :action => "help_tickets" }, ] |
+
+#dashboard-tabs{ :class => "ui-tabs ui-widget ui-widget-content ui-corner-all" 
}
+  %ul{ :class => "ui-tabs ui-widget ui-widget-content ui-corner-all 
ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header" }
+    - menu.each do |item|
+      - selection_style = "ui-tabs-selected ui-state-active" if item[:action] 
== controller.action_name
+      %li{ :class => "#{selection_style} ui-state-default ui-corner-top" }
+        = link_to item[:text], { :controller => "dashboard", :action => 
item[:action] }
diff --git a/src/app/views/dashboard/index.haml 
b/src/app/views/dashboard/index.haml
deleted file mode 100644
index e69de29..0000000
diff --git a/src/app/views/layouts/aggregator.haml 
b/src/app/views/layouts/aggregator.haml
index 20fabfc..9b62dd3 100644
--- a/src/app/views/layouts/aggregator.haml
+++ b/src/app/views/layouts/aggregator.haml
@@ -56,7 +56,6 @@
                     });
                     return false;})},function(){});
                     $('ul.instance_action_list 
li:first-child').addClass('first');
-         $("#dashboard-tabs").tabs();
       });
     = yield :scripts
   %body
diff --git a/src/app/views/layouts/dashboard.haml 
b/src/app/views/layouts/dashboard.haml
index eed4643..3b4e7c3 100644
--- a/src/app/views/layouts/dashboard.haml
+++ b/src/app/views/layouts/dashboard.haml
@@ -1,4 +1,18 @@
+- content_for :scripts do
+  :javascript
+    $(document).ready(function() {
+      $("#dashboard-tabs > ul > li > a").each(function(index) {
+        var link = $(this).attr("href") + "?ajax=true";
+        $(this).attr("href", link);
+      });
+      $("#dashboard-tabs").tabs();
+
+      // when JS is enabled, hide the Dashboard content -- it'll be loaded
+      // by jquery UI tab using ajax
+      $("#dashboard-content").hide();
+    });
 - content_for :content do
   = render :partial => 'dashboard_nav'
-  = yield
+  #dashboard-content
+    = yield
 = render :file => 'layouts/aggregator'
-- 
1.6.6.1

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to