Download:
child 11:84505e73e061
parent 9:8a7155aff782
10:363ae86d0822
Anton Shestakov <engored@ya.ru>, Thu, 27 Dec 2012 02:42:10 +0900
Simple transition for workspace change.

2 файлов изменено, 16 вставок(+), 1 удалений(-) [+]
static/js/ui.js file | annotate | diff | comparison | revisions
templates/index.html file | annotate | diff | comparison | revisions
--- a/static/js/ui.js Thu Dec 27 00:47:02 2012 +0900
+++ b/static/js/ui.js Thu Dec 27 02:42:10 2012 +0900
@@ -23,6 +23,11 @@
});
fruitbar.xhrs = [];
+ fruitbar.xhrs.done = function() {
+ return _(this).all(function(xhr) {
+ return xhr.readyState == 4;
+ });
+ };
fruitbar.xhrs.abort = function() {
_(this).each(function(xhr) {
xhr.abort();
@@ -32,12 +37,22 @@
};
fruitbar.on('workspace', function(workspace) {
+ $('body').stop().animate({opacity: 0});
+
this.xhrs.abort();
this.tasks.url = '/' + encodeURIComponent(workspace) + '/tasks/';
this.projects.url = '/' + encodeURIComponent(workspace) + '/projects/';
this.xhrs.push(this.tasks.fetch(), this.projects.fetch());
+
+ _(this.xhrs).each(function(fetch, index, xhrs) {
+ fetch.then(function() {
+ if (xhrs.done()) {
+ $('body').stop().animate({opacity: 1});
+ }
+ });
+ });
});
fruitbar.once('workspace', function() {
--- a/templates/index.html Thu Dec 27 00:47:02 2012 +0900
+++ b/templates/index.html Thu Dec 27 02:42:10 2012 +0900
@@ -27,7 +27,7 @@
});
</script>
</head>
- <body>
+ <body style="opacity: 0;">
<div class="container">
<div class="row">
<div class="span2">