OSDN Git Service

ajax-loader for dashboard
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Mon, 12 Dec 2011 22:08:15 +0000 (00:08 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Mon, 12 Dec 2011 22:08:15 +0000 (00:08 +0200)
app/assets/images/ajax-loader-facebook.gif [new file with mode: 0644]
app/assets/javascripts/loader.js [new file with mode: 0644]
app/assets/stylesheets/projects.css.scss
app/views/dashboard/_menu.html.haml

diff --git a/app/assets/images/ajax-loader-facebook.gif b/app/assets/images/ajax-loader-facebook.gif
new file mode 100644 (file)
index 0000000..6350e5f
Binary files /dev/null and b/app/assets/images/ajax-loader-facebook.gif differ
diff --git a/app/assets/javascripts/loader.js b/app/assets/javascripts/loader.js
new file mode 100644 (file)
index 0000000..6fa0b52
--- /dev/null
@@ -0,0 +1,11 @@
+var Loader = { 
+  img_src: "/assets/ajax-loader.gif", 
+
+  html: 
+    function(width) { 
+      img = $("<img>");
+      img.attr("width", width);
+      img.attr("src", this.img_src);
+      return img;
+    }
+}
index dd897ed..f923deb 100644 (file)
@@ -581,3 +581,9 @@ h4.middle-panel {
     }
   }
 }
+
+.dashboard-loader { 
+  float:right;
+  margin-right:30px;
+  display:none;
+}
index 2cb45fa..0d04899 100644 (file)
@@ -2,12 +2,20 @@
   = link_to "Activities", dashboard_path, :remote => true, :class => "button-small dash-button #{"active" if current_page?(dashboard_path) || current_page?(root_path) }", :id => "activities_slide"
   = link_to "Issues", dashboard_issues_path, :remote => true, :class => "button-small dash-button #{"active" if current_page?(dashboard_issues_path)}", :id => "issues_slide"
   = link_to "Merge Requests", dashboard_merge_requests_path, :remote => true, :class => "button-small dash-button #{"active" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide"
-
+  %img{:src => "/assets/ajax-loader-facebook.gif", :class => "dashboard-loader"}
 
 :javascript 
   $(function(){
     $(".dash-button").live("click", function() { 
       $(".dash-button").removeClass("active");
       $(this).addClass("active");
-    })
+    });
+
+    $(".dash-button").live("ajax:before", function() { 
+      $(".dashboard-loader").show();
+    });
+
+    $(".dash-button").live("ajax:complete", function() { 
+      $(".dashboard-loader").hide();
+    });
   });