diff options
Diffstat (limited to 'pyload/web/app/scripts')
7 files changed, 23 insertions, 20 deletions
diff --git a/pyload/web/app/scripts/utils/dialogs.js b/pyload/web/app/scripts/utils/dialogs.js index 4933b7ed2..3ceffc9c3 100644 --- a/pyload/web/app/scripts/utils/dialogs.js +++ b/pyload/web/app/scripts/utils/dialogs.js @@ -5,10 +5,9 @@ define(['jquery', 'underscore', 'views/abstract/modalView'], function($, _, Moda // Shows the confirm dialog for given context // on success executes func with context _.confirm = function(template, func, context) { - template = 'text!tpl/' + template; + template = 'hbs!tpl/' + template; _.requireOnce([template], function(html) { - var template = _.compile(html); - var dialog = new Modal(template, _.bind(func, context)); + var dialog = new Modal(html, _.bind(func, context)); dialog.show(); }); diff --git a/pyload/web/app/scripts/views/abstract/modalView.js b/pyload/web/app/scripts/views/abstract/modalView.js index 9d1d72869..65bc0a3c8 100644 --- a/pyload/web/app/scripts/views/abstract/modalView.js +++ b/pyload/web/app/scripts/views/abstract/modalView.js @@ -25,11 +25,10 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone, this.onHideDestroy = true; } else - require(['text!tpl/default/modal.html'], function(template) { + require(['hbs!tpl/dialogs/modal'], function(template) { self.template = template; }); } - }, // TODO: whole modal stuff is not very elegant diff --git a/pyload/web/app/scripts/views/dashboard/dashboardView.js b/pyload/web/app/scripts/views/dashboard/dashboardView.js index f305ac2f4..a7779230b 100644 --- a/pyload/web/app/scripts/views/dashboard/dashboardView.js +++ b/pyload/web/app/scripts/views/dashboard/dashboardView.js @@ -5,9 +5,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', // Renders whole dashboard return Backbone.Marionette.ItemView.extend({ - // TODO: refactor - active: $('.breadcrumb .active'), - template: template, events: { @@ -106,7 +103,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', pack.fetch({silent: true, success: function() { console.log('Package ' + pack.get('pid') + ' loaded'); - self.active.text(pack.get('name')); self.contentReady(pack.get('files')); }, failure: function() { self.failure(); diff --git a/pyload/web/app/scripts/views/dashboard/filterView.js b/pyload/web/app/scripts/views/dashboard/filterView.js index ceb2a9a6e..79257547c 100644 --- a/pyload/web/app/scripts/views/dashboard/filterView.js +++ b/pyload/web/app/scripts/views/dashboard/filterView.js @@ -26,7 +26,8 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac ui: { 'search': '.search-query', 'stateMenu': '.dropdown-toggle .state', - 'select': '.btn-check' + 'select': '.btn-check', + 'name': '.breadcrumb .active' }, template: template, @@ -36,11 +37,12 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac this.state = Api.DownloadState.All; // Apply the filter before the content is shown - App.vent.on('dashboard:contentReady', _.bind(this.apply_filter, this)); + this.listenTo(App.vent, 'dashboard:contentReady', this.apply_filter); + this.listenTo(App.vent, 'dashboard:updated', this.updateName); }, onRender: function() { - // use our modified method + // use our modified method $.fn.typeahead.Constructor.prototype.show = show; this.ui.search.typeahead({ minLength: 2, @@ -127,6 +129,11 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac return true; }, + updateName: function() { + // TODO +// this.ui.name.text(App.dashboard.package.get('name')); + }, + toggle_selection: function() { App.vent.trigger('selection:toggle'); }, diff --git a/pyload/web/app/scripts/views/dashboard/selectionView.js b/pyload/web/app/scripts/views/dashboard/selectionView.js index f25bf3cca..25b7998df 100644 --- a/pyload/web/app/scripts/views/dashboard/selectionView.js +++ b/pyload/web/app/scripts/views/dashboard/selectionView.js @@ -100,7 +100,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/dashboard/select'], }, trash: function() { - _.confirm('default/confirmDialog.html', function() { + _.confirm('dialogs/confirmDelete', function() { var pids = []; // TODO: delete many at once diff --git a/pyload/web/app/scripts/views/notificationView.js b/pyload/web/app/scripts/views/notificationView.js index abfcd8079..93d07a0f3 100644 --- a/pyload/web/app/scripts/views/notificationView.js +++ b/pyload/web/app/scripts/views/notificationView.js @@ -1,9 +1,9 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList', 'hbs!tpl/notification'], - function($, Backbone, _, App, InteractionList, queryModal, template) { + function($, Backbone, _, App, InteractionList, template) { 'use strict'; // Renders context actions for selection packages and files - return Backbone.View.extend({ + return Backbone.Marionette.ItemView.extend({ // Only view for this area so it's hardcoded el: '#notification-area', @@ -23,8 +23,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList' initialize: function() { this.tasks = new InteractionList(); - this.$el.calculateHeight().height(0); - App.vent.on('interaction:added', _.bind(this.onAdd, this)); App.vent.on('interaction:deleted', _.bind(this.onDelete, this)); @@ -42,6 +40,10 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList' this.tasks.remove(task); }, + onRender: function() { + this.$el.calculateHeight().height(0); + }, + render: function() { // only render when it will be visible diff --git a/pyload/web/app/scripts/views/queryModal.js b/pyload/web/app/scripts/views/queryModal.js index 7c6439b49..c748e1657 100644 --- a/pyload/web/app/scripts/views/queryModal.js +++ b/pyload/web/app/scripts/views/queryModal.js @@ -1,14 +1,13 @@ -define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inputLoader', 'text!tpl/default/queryDialog.html'], +define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inputLoader', 'hbs!tpl/dialogs/interactionTask'], function($, _, App, modalView, load_input, template) { 'use strict'; return modalView.extend({ - // TODO: submit on enter reloads the page sometimes events: { 'click .btn-success': 'submit', 'submit form': 'submit' }, - template: _.compile(template), + template: template, // the notificationView parent: null, @@ -56,6 +55,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inpu }}); this.input.clear(); + return false; }, onShow: function() { |