From 1e1b64539144006c59c7b705700fc7f34c7a26b1 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 20 Feb 2013 12:00:22 +0100 Subject: more animation for dashboard --- module/web/static/css/default/dashboard.less | 5 +- module/web/static/css/default/style.less | 11 +- module/web/static/js/default.js | 10 +- module/web/static/js/models/Package.js | 1 + module/web/static/js/utils/animations.js | 36 ++----- module/web/static/js/views/abstract/itemView.js | 3 +- module/web/static/js/views/actionbarView.js | 28 +++++ module/web/static/js/views/dashboardView.js | 133 ++++++++++++++++++++++++ module/web/static/js/views/packageTreeView.js | 115 -------------------- module/web/static/js/views/packageView.js | 21 +--- module/web/static/js/views/selectionView.js | 59 ++++++++++- module/web/templates/default/dashboard.html | 12 ++- 12 files changed, 256 insertions(+), 178 deletions(-) create mode 100644 module/web/static/js/views/actionbarView.js create mode 100644 module/web/static/js/views/dashboardView.js delete mode 100644 module/web/static/js/views/packageTreeView.js (limited to 'module/web') diff --git a/module/web/static/css/default/dashboard.less b/module/web/static/css/default/dashboard.less index a582e7326..4d504fdc3 100644 --- a/module/web/static/css/default/dashboard.less +++ b/module/web/static/css/default/dashboard.less @@ -58,6 +58,8 @@ position: absolute; height: @frame-bottom; line-height: @frame-bottom; + font-size: 12px; + text-align: center; border-radius: 0; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; @@ -66,6 +68,7 @@ right: 0; margin-bottom: 0; background-image: none; + color: @light; background-color: @yellow; } @@ -176,7 +179,7 @@ width: 50%; font-weight: bold; - i { + .icon-file { cursor: move; } diff --git a/module/web/static/css/default/style.less b/module/web/static/css/default/style.less index 7db464c92..3e2a42abf 100644 --- a/module/web/static/css/default/style.less +++ b/module/web/static/css/default/style.less @@ -333,8 +333,15 @@ header .logo { left: 50%; bottom: -28px; min-width: 15%; -// color: @dark; -// background-color: @light; + + i { + cursor: pointer; + + &:hover { + color: @yellow; + } + } + } /* diff --git a/module/web/static/js/default.js b/module/web/static/js/default.js index bb9701935..afe624ff9 100644 --- a/module/web/static/js/default.js +++ b/module/web/static/js/default.js @@ -1,15 +1,15 @@ -define('default', ['require', 'jquery', 'app', 'views/headerView', 'views/packageTreeView'], - function(require, $, App, HeaderView, TreeView) { +define('default', ['require', 'jquery', 'app', 'views/headerView', 'views/dashboardView'], + function(require, $, App, HeaderView, DashboardView) { App.init = function() { App.header = new HeaderView(); App.header.render(); }; - App.initPackageTree = function() { + App.initDashboard = function() { $(function() { - App.treeView = new TreeView(); - App.treeView.init(); + App.dashboard = new DashboardView(); + App.dashboard.init(); }); }; diff --git a/module/web/static/js/models/Package.js b/module/web/static/js/models/Package.js index 7539b0673..24f04519e 100644 --- a/module/web/static/js/models/Package.js +++ b/module/web/static/js/models/Package.js @@ -17,6 +17,7 @@ define(['jquery', 'backbone', 'underscore', 'collections/FileList', 'require'], added: -1, tags: null, status: -1, + shared: false, packageorder: -1, stats: null, fids: null, diff --git a/module/web/static/js/utils/animations.js b/module/web/static/js/utils/animations.js index 245614ea7..798f69358 100644 --- a/module/web/static/js/utils/animations.js +++ b/module/web/static/js/utils/animations.js @@ -28,13 +28,17 @@ define(['jquery', 'underscore', 'transit'], function(jQuery, _) { // Shortcut to have a animation when element is added jQuery.fn.appendWithAnimation = function(element, animation) { var o = jQuery(this[0]); + element = jQuery(element); + if (animation === true) - o.hide(); + element.hide(); o.append(element); if (animation === true) - o.fadeIn(); + element.fadeIn(); + + element.calculateHeight(); return this; }; @@ -69,34 +73,6 @@ define(['jquery', 'underscore', 'transit'], function(jQuery, _) { return this; }; - // TODO: sloppy chaining - // - // in functions not possible without previous out - - jQuery.fn.zapIn = function(speed, easing, callback) { - var height = this.data('height') || '100%'; - this.transition({ - height: height, - scale: [1, 1], - opacity: 'show' - }, speed, easing, callback); - - }; - - jQuery.fn.zapOut = function(speed, easing, callback) { - if (!this.data('height')) { - var height = this.height(); - this.css({height: height}); - this.data('height', height); - } - this.transition({ - height: '0px', - scale: [1, 0], - opacity: 'hide' - }, speed, easing, callback); - - }; - jQuery.fn._transit = jQuery.fn.transit; // Overriding transit plugin to support hide and show diff --git a/module/web/static/js/views/abstract/itemView.js b/module/web/static/js/views/abstract/itemView.js index 7740abe5e..1c14e7dc3 100644 --- a/module/web/static/js/views/abstract/itemView.js +++ b/module/web/static/js/views/abstract/itemView.js @@ -24,8 +24,7 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { this.$el.slideDown(); }, - - delete: function(e) { + deleteItem: function(e) { if(e) e.stopPropagation(); this.model.destroy(); diff --git a/module/web/static/js/views/actionbarView.js b/module/web/static/js/views/actionbarView.js new file mode 100644 index 000000000..bdfb9ef7b --- /dev/null +++ b/module/web/static/js/views/actionbarView.js @@ -0,0 +1,28 @@ +define(['jquery', 'backbone', 'underscore', 'app'], + function($, Backbone, _, App) { + + // Renders the actionbar for the dashboard + return Backbone.View.extend({ + el: 'ul.actionbar', + + events: { + }, + + initialize: function() { + + this.$('.search-query').typeahead({ + minLength: 2, + source: this.getAutocompletion + }); + + }, + + render: function() { + }, + + getAutocompletion: function() { + return ["static", "autocompletion", "demo", "with", "some", "keywords", + "a very long proposal for autocompletion"]; + } + }); + }); \ No newline at end of file diff --git a/module/web/static/js/views/dashboardView.js b/module/web/static/js/views/dashboardView.js new file mode 100644 index 000000000..7f2b9809a --- /dev/null +++ b/module/web/static/js/views/dashboardView.js @@ -0,0 +1,133 @@ +define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', + 'views/packageView', 'views/fileView', 'views/selectionView', 'views/actionbarView'], + function($, Backbone, _, App, TreeCollection, packageView, fileView, selectionView, actionbarView) { + + // Renders whole dashboard + return Backbone.View.extend({ + + el: '#content', + + events: { + 'click #show_active': 'filter' + }, + + //