diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-07-09 20:55:43 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-07-09 20:55:43 +0200 |
commit | 9682ba3b7adcac116b0f2fbf8d1a9b620f767fba (patch) | |
tree | e1e2c6519cbe80c6fa5236722f9ceb1c4b4315c2 /pyload/web/app | |
parent | adapted to pyload-common repo (diff) | |
download | pyload-9682ba3b7adcac116b0f2fbf8d1a9b620f767fba.tar.xz |
little fixes for actionbar and selection
Diffstat (limited to 'pyload/web/app')
4 files changed, 19 insertions, 9 deletions
diff --git a/pyload/web/app/scripts/controller.js b/pyload/web/app/scripts/controller.js index 05237914d..60f604e5b 100644 --- a/pyload/web/app/scripts/controller.js +++ b/pyload/web/app/scripts/controller.js @@ -1,6 +1,7 @@ define([ 'app', 'backbone', + 'underscore', // Views 'views/headerView', @@ -12,7 +13,7 @@ define([ 'views/settings/settingsView', 'views/accounts/accountListView' ], function( - App, Backbone, HeaderView, NotificationView, DashboardView, SelectionView, FilterView, LoginView, SettingsView, AccountListView) { + App, Backbone, _, HeaderView, NotificationView, DashboardView, SelectionView, FilterView, LoginView, SettingsView, AccountListView) { 'use strict'; // TODO some views does not need to be loaded instantly @@ -30,8 +31,12 @@ define([ this.header(); App.actionbar.show(new FilterView()); - // TODO: not completly visible after reattaching - App.selection.attachView(new SelectionView()); + + // TODO: not completely visible after reattaching + // now visible every time + if (_.isUndefined(App.selection.currentView) || _.isNull(App.selection.currentView)) + App.selection.attachView(new SelectionView()); + App.content.show(new DashboardView()); }, diff --git a/pyload/web/app/scripts/views/dashboard/filterView.js b/pyload/web/app/scripts/views/dashboard/filterView.js index 64bc56724..ceb2a9a6e 100644 --- a/pyload/web/app/scripts/views/dashboard/filterView.js +++ b/pyload/web/app/scripts/views/dashboard/filterView.js @@ -17,6 +17,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac return Backbone.Marionette.ItemView.extend({ events: { + 'click .li-check': 'toggle_selection', 'click .filter-type': 'filter_type', 'click .filter-state': 'switch_filter', 'submit .form-search': 'search' @@ -24,7 +25,8 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac ui: { 'search': '.search-query', - 'stateMenu': '.dropdown-toggle .state' + 'stateMenu': '.dropdown-toggle .state', + 'select': '.btn-check' }, template: template, @@ -125,6 +127,10 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac return true; }, + toggle_selection: function() { + App.vent.trigger('selection:toggle'); + }, + filter_type: function(e) { } diff --git a/pyload/web/app/scripts/views/dashboard/selectionView.js b/pyload/web/app/scripts/views/dashboard/selectionView.js index 8685fd849..f25bf3cca 100644 --- a/pyload/web/app/scripts/views/dashboard/selectionView.js +++ b/pyload/web/app/scripts/views/dashboard/selectionView.js @@ -28,9 +28,8 @@ define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/dashboard/select'], App.vent.on('dashboard:filtered', render); App.vent.on('package:selection', render); App.vent.on('file:selection', render); + App.vent.on('selection:toggle', _.bind(this.select_toggle, this)); - this.actionBar = $('.actionbar .btn-check'); - this.actionBar.parent().click(_.bind(this.select_toggle, this)); // API events, maybe better to rely on internal ones? App.vent.on('package:deleted', render); @@ -71,11 +70,11 @@ define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/dashboard/select'], // TODO: accessing ui directly, should be events if (files > 0) { - this.actionBar.addClass('icon-check').removeClass('icon-check-empty'); + App.actionbar.currentView.ui.select.addClass('icon-check').removeClass('icon-check-empty'); App.dashboard.ui.packages.addClass('ui-files-selected'); } else { - this.actionBar.addClass('icon-check-empty').removeClass('icon-check'); + App.actionbar.currentView.ui.select.addClass('icon-check-empty').removeClass('icon-check'); App.dashboard.ui.packages.removeClass('ui-files-selected'); } diff --git a/pyload/web/app/templates/default/dashboard/actionbar.html b/pyload/web/app/templates/default/dashboard/actionbar.html index 815d4593c..a8b2ebecd 100644 --- a/pyload/web/app/templates/default/dashboard/actionbar.html +++ b/pyload/web/app/templates/default/dashboard/actionbar.html @@ -16,7 +16,7 @@ </div> </form> </li> - <li style="float: right"> + <li style="float: right" class="li-check"> <a href="#"><i class="icon-check-empty btn-check"></i></a> </li> <li class="dropdown" style="float: right;"> |