From 3dc94ba8eb74caa6f4eae29970fe261f51e1942e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 Dec 2011 00:08:15 +0200 Subject: [PATCH] ajax-loader for dashboard --- app/assets/images/ajax-loader-facebook.gif | Bin 0 -> 723 bytes app/assets/javascripts/loader.js | 11 +++++++++++ app/assets/stylesheets/projects.css.scss | 6 ++++++ app/views/dashboard/_menu.html.haml | 12 ++++++++++-- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/ajax-loader-facebook.gif create mode 100644 app/assets/javascripts/loader.js diff --git a/app/assets/images/ajax-loader-facebook.gif b/app/assets/images/ajax-loader-facebook.gif new file mode 100644 index 0000000000000000000000000000000000000000..6350e5f45b6ca1b85adf013a46d2f258b2f1928e GIT binary patch literal 723 zcmZ?wbhEHb6kyE<)vMU#?3B#H;E1HBPoDv~r_Y?5Hgn$UbsG!IYA;{8 zx^wrw36p28SiL^Kxcb7y%g>)b-@bECSaeE!N{(+(%+X^fV-mCcLSjoQ8=BgB(sN1z z!r~cVK=D7fpKD04vtxj(k)8oFBT!uNpOkY^YGO%hib8p2NrpmVR$@g?eqxGVW?ou8 zgW^vXPHvzo9gqniM>4SLDk$`&WX@Z%fa}pIrgaVi%@$`&3ocjRyS-yRANv!*_AQSb zPVndzue-+Ox^|iqHWO455+zs@=B>z-X`i_7z^y|o-&|VW`~1z`*SjP1HRiB3S_^hc zFk#bZ2DG|6QRi`o3a643Px6waMH(li&u{5{Z6tMII`e_1z0n^}cndb3y?A+tu;0u> zq1;*`)BFwzU^B`TXw(u8SHTdb-p3|MDxMc#+4KvaFRgrTJ&Sia^NAL_qz&%BMElQ7 zEVg8ks$6}odzaSSAVq8@89~D1+NOwSE`gJGcw9;f3UxiXCH9e3+}mll8Pg8O2fk2d z>^<@91Z(mK7e88+X z-B+c5h6z)=E`yob=>_{91aV+wj;TDVWavt?S6F c!d97Iak>m9Y|fGEmtYMblFhINB@r+H0L=sflK=n! literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/loader.js b/app/assets/javascripts/loader.js new file mode 100644 index 00000000000..6fa0b525814 --- /dev/null +++ b/app/assets/javascripts/loader.js @@ -0,0 +1,11 @@ +var Loader = { + img_src: "/assets/ajax-loader.gif", + + html: + function(width) { + img = $(""); + img.attr("width", width); + img.attr("src", this.img_src); + return img; + } +} diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index dd897ed39bb..f923deb2126 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -581,3 +581,9 @@ h4.middle-panel { } } } + +.dashboard-loader { + float:right; + margin-right:30px; + display:none; +} diff --git a/app/views/dashboard/_menu.html.haml b/app/views/dashboard/_menu.html.haml index 2cb45fa7e61..0d04899c37d 100644 --- a/app/views/dashboard/_menu.html.haml +++ b/app/views/dashboard/_menu.html.haml @@ -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(); + }); });