[vhffs-dev] [1503] Added loading feedback on links

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1503
Author:   beuss
Date:     2009-08-02 23:52:19 +0200 (Sun, 02 Aug 2009)

Log Message:
-----------
Added loading feedback on links

Modified Paths:
--------------
    trunk/vhffs-panel/js/vhffs/Common.js
    trunk/vhffs-public/templates/layouts/public.tt
    trunk/vhffs-themes/light-grey/img/loading.gif
    trunk/vhffs-themes/light-grey/main.css


Modified: trunk/vhffs-panel/js/vhffs/Common.js
===================================================================
--- trunk/vhffs-panel/js/vhffs/Common.js	2009-08-02 16:57:53 UTC (rev 1502)
+++ trunk/vhffs-panel/js/vhffs/Common.js	2009-08-02 21:52:19 UTC (rev 1503)
@@ -41,12 +41,14 @@
 		dojo.forEach(dojo.query('a.ajax', rootNode), function(link) {
 			dojo.connect(link, 'onclick', function(e) {
 				dojo.stopEvent(e);
+				vhffs.Common.showLoading();
 				var href = dojo.attr(link, 'href');
 				if(href != '#') {
 					dojo.back.addToHistory(new vhffs.Common.pageState(href, contentTarget));
 					dojo.xhrGet({
 						url: href,
 						load: function(response) {
+							vhffs.Common.hideLoading();
 							vhffs.Common.loadContent(contentTarget, response);
 						}
 					});
@@ -56,6 +58,16 @@
 			dojo.removeClass(link, 'ajax');
 		});
 	},
+
+	showLoading: function() {
+		var bodyCoords = dojo.coords(dojo.doc.body);
+		dojo.style(dojo.byId('loading'), 
+			{ display: 'block', top: (- bodyCoords.y + 10) + 'px', left: ((bodyCoords.w - 32) / 2) + 'px' });
+	},
+
+	hideLoading: function() {
+		dojo.style(dojo.byId('loading'), { display: 'none' });
+	},
 	
 	loadContent: function(contentTarget, xhrResponse) {
 		var parsed = vhffs.Common.extractScripts(xhrResponse);

Modified: trunk/vhffs-public/templates/layouts/public.tt
===================================================================
--- trunk/vhffs-public/templates/layouts/public.tt	2009-08-02 16:57:53 UTC (rev 1502)
+++ trunk/vhffs-public/templates/layouts/public.tt	2009-08-02 21:52:19 UTC (rev 1503)
@@ -23,6 +23,9 @@
 <body>
 <div id="background-container">
   <div class="page-container-public">
+    <div id="loading" style="display:none">
+      <img src="/themes/[% theme %]/img/loading.gif">
+    </div>
     <div id="header">
 	[% INCLUDE parts/header.tt %]
 	</div>

Modified: trunk/vhffs-themes/light-grey/img/loading.gif
===================================================================
(Binary files differ)

Modified: trunk/vhffs-themes/light-grey/main.css
===================================================================
--- trunk/vhffs-themes/light-grey/main.css	2009-08-02 16:57:53 UTC (rev 1502)
+++ trunk/vhffs-themes/light-grey/main.css	2009-08-02 21:52:19 UTC (rev 1503)
@@ -481,6 +481,13 @@
 	text-decoration: none;
 }
 
+div#loading {
+	position: absolute;
+	top: 1em;
+	left: 369px;
+	z-index: 1000;
+}
+
 .content1-container {
 	clear: both;
 	float: left;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/