diff options
Diffstat (limited to 'module/web/app/scripts/views')
19 files changed, 53 insertions, 38 deletions
diff --git a/module/web/app/scripts/views/abstract/itemView.js b/module/web/app/scripts/views/abstract/itemView.js index 394044ec4..c37118a4c 100644 --- a/module/web/app/scripts/views/abstract/itemView.js +++ b/module/web/app/scripts/views/abstract/itemView.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { + 'use strict'; // A view that is meant for temporary displaying // All events must be unbound in onDestroy diff --git a/module/web/app/scripts/views/abstract/modalView.js b/module/web/app/scripts/views/abstract/modalView.js index 170681f06..9d1d72869 100644 --- a/module/web/app/scripts/views/abstract/modalView.js +++ b/module/web/app/scripts/views/abstract/modalView.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone, _) { + 'use strict'; return Backbone.View.extend({ @@ -41,7 +42,7 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone, this.$el.css({opacity: 0, scale: 0.7}); var self = this; - $("body").append(this.el); + $('body').append(this.el); this.dialog = this.$el.omniWindow({ overlay: { selector: '#modal-overlay', diff --git a/module/web/app/scripts/views/accounts/accountModal.js b/module/web/app/scripts/views/accounts/accountModal.js index e5315c26c..6c2b226df 100644 --- a/module/web/app/scripts/views/accounts/accountModal.js +++ b/module/web/app/scripts/views/accounts/accountModal.js @@ -1,5 +1,6 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dialogs/addAccount', 'helpers/pluginIcon', 'select2'], function($, _, App, modalView, template, pluginIcon) { + 'use strict'; return modalView.extend({ events: { @@ -47,7 +48,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dial }, format: function(data) { - return '<img class="logo-select" src="' + pluginIcon(data) + '"> ' + data; + return '<img class="logo-select" src="' + pluginIcon(data) + '"> ' + data; }, add: function(e) { diff --git a/module/web/app/scripts/views/dashboard/dashboardView.js b/module/web/app/scripts/views/dashboard/dashboardView.js index 0ae9110d7..e7adba475 100644 --- a/module/web/app/scripts/views/dashboard/dashboardView.js +++ b/module/web/app/scripts/views/dashboard/dashboardView.js @@ -1,6 +1,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', './packageView', './fileView', 'hbs!tpl/dashboard/layout', 'select2'], - function($, Backbone, _, App, TreeCollection, packageView, fileView, template) { + function($, Backbone, _, App, TreeCollection, PackageView, FileView, template) { + 'use strict'; // Renders whole dashboard return Backbone.Marionette.ItemView.extend({ @@ -58,7 +59,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', }); }}); - this.$('.input').select2({tags: ["a", "b", "sdf"]}); + this.$('.input').select2({tags: ['a', 'b', 'sdf']}); }, update: function() { @@ -87,12 +88,12 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', // TODO sorting ?! // Append a package to the list, index, animate it appendPackage: function(pack, i, animation) { - var el = new packageView({model: pack}).render().el; + var el = new PackageView({model: pack}).render().el; $(this.ui.packages).appendWithAnimation(el, animation); }, appendFile: function(file, i, animation) { - var el = new fileView({model: file}).render().el; + var el = new FileView({model: file}).render().el; $(this.ui.files).appendWithAnimation(el, animation); }, diff --git a/module/web/app/scripts/views/dashboard/fileView.js b/module/web/app/scripts/views/dashboard/fileView.js index c0eec7adf..4e5884ed8 100644 --- a/module/web/app/scripts/views/dashboard/fileView.js +++ b/module/web/app/scripts/views/dashboard/fileView.js @@ -1,5 +1,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abstract/itemView', 'helpers/formatTime', 'hbs!tpl/dashboard/file'], function($, Backbone, _, App, Api, ItemView, formatTime, template) { + 'use strict'; // Renders single file item return ItemView.extend({ @@ -91,7 +92,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abst bar.html(' ' + formatTime(this.model.get('eta'))); } else if (this.model.get('download').status === Api.DownloadStatus.Waiting) { this.$('.second').html( - "<i class='icon-time'></i> " + formatTime(this.model.get('eta'))); + '<i class="icon-time"></i> ' + formatTime(this.model.get('eta'))); } else // Every else state can be renderred normally this.render(); diff --git a/module/web/app/scripts/views/dashboard/filterView.js b/module/web/app/scripts/views/dashboard/filterView.js index bcbda64c8..64bc56724 100644 --- a/module/web/app/scripts/views/dashboard/filterView.js +++ b/module/web/app/scripts/views/dashboard/filterView.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Package', 'hbs!tpl/dashboard/actionbar'], + /*jslint -W040: false*/ function($, Backbone, _, App, Api, Package, template) { 'use strict'; diff --git a/module/web/app/scripts/views/dashboard/packageView.js b/module/web/app/scripts/views/dashboard/packageView.js index 6e09cbb96..2738fcbea 100644 --- a/module/web/app/scripts/views/dashboard/packageView.js +++ b/module/web/app/scripts/views/dashboard/packageView.js @@ -1,5 +1,6 @@ define(['jquery', 'app', 'views/abstract/itemView', 'underscore', 'hbs!tpl/dashboard/package'], function($, App, itemView, _, template) { + 'use strict'; // Renders a single package item return itemView.extend({ diff --git a/module/web/app/scripts/views/dashboard/selectionView.js b/module/web/app/scripts/views/dashboard/selectionView.js index a070aa9a0..8685fd849 100644 --- a/module/web/app/scripts/views/dashboard/selectionView.js +++ b/module/web/app/scripts/views/dashboard/selectionView.js @@ -96,7 +96,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/dashboard/select'], }, pause: function() { - alert("Not implemented yet"); + alert('Not implemented yet'); this.deselect(); }, diff --git a/module/web/app/scripts/views/headerView.js b/module/web/app/scripts/views/headerView.js index bbb999186..512c7259b 100644 --- a/module/web/app/scripts/views/headerView.js +++ b/module/web/app/scripts/views/headerView.js @@ -1,7 +1,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'collections/ProgressList', 'views/progressView', 'views/notificationView', 'helpers/formatSize', 'hbs!tpl/header/layout', 'hbs!tpl/header/status', 'hbs!tpl/header/progressbar' , 'flot'], - function($, _, Backbone, App, ServerStatus, ProgressList, ProgressView, notificationView, formatSize, + function($, _, Backbone, App, ServerStatus, ProgressList, ProgressView, NotificationView, formatSize, template, templateStatus, templateHeader) { 'use strict'; // Renders the header with all information @@ -41,7 +41,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle initialize: function() { var self = this; - this.notificationView = new notificationView(); + this.notificationView = new NotificationView(); this.status = new ServerStatus(); this.listenTo(this.status, 'change', this.update); @@ -60,7 +60,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle ws.onmessage = _.bind(this.onData, this); ws.onerror = function(error) { console.log(error); - alert("WebSocket error" + error); + alert('WebSocket error' + error); }; this.ws = ws; @@ -79,16 +79,16 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle series: { lines: { show: true, lineWidth: 2 }, shadowSize: 0, - color: "#fee247" + color: '#fee247' }, xaxis: { ticks: [] }, yaxis: { ticks: [], min: 1, autoscaleMargin: 0.1, tickFormatter: function(data) { return formatSize(data * 1024); - }, position: "right" }, + }, position: 'right' }, grid: { show: true, // borderColor: "#757575", - borderColor: "white", + borderColor: 'white', borderWidth: 1, labelMargin: 0, axisMargin: 0, @@ -152,9 +152,9 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle open_grabber: function() { var self = this; - _.requireOnce(['views/linkGrabberModal'], function(modalView) { + _.requireOnce(['views/linkGrabberModal'], function(ModalView) { if (self.grabber === null) - self.grabber = new modalView(); + self.grabber = new ModalView(); self.grabber.show(); }); @@ -164,7 +164,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle var data = JSON.parse(evt.data); if (data === null) return; - if (data['@class'] === "ServerStatus") { + if (data['@class'] === 'ServerStatus') { // TODO: load interaction when none available this.status.set(data); @@ -210,7 +210,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle if (file) { file.set({ progress: prog.getPercent(), - eta: prog.get('eta'), + eta: prog.get('eta') }, {silent: true}); file.trigger('change:progress'); diff --git a/module/web/app/scripts/views/input/inputLoader.js b/module/web/app/scripts/views/input/inputLoader.js index 5ccf07695..11665abb4 100644 --- a/module/web/app/scripts/views/input/inputLoader.js +++ b/module/web/app/scripts/views/input/inputLoader.js @@ -1,4 +1,5 @@ define(['./textInput'], function(textInput) { + 'use strict'; // selects appropriate input element return function(input, value, default_value, description) { diff --git a/module/web/app/scripts/views/input/inputView.js b/module/web/app/scripts/views/input/inputView.js index f2601c3eb..1fbe5042d 100644 --- a/module/web/app/scripts/views/input/inputView.js +++ b/module/web/app/scripts/views/input/inputView.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { + 'use strict'; // Renders input elements return Backbone.View.extend({ @@ -29,7 +30,7 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { // this.$el.data('title', "TODO: title"); this.$el.popover({ placement: 'right', - trigger: 'hover', + trigger: 'hover' // delay: { show: 500, hide: 100 } }); } diff --git a/module/web/app/scripts/views/input/textInput.js b/module/web/app/scripts/views/input/textInput.js index 3a6631a0b..0eebbf91e 100644 --- a/module/web/app/scripts/views/input/textInput.js +++ b/module/web/app/scripts/views/input/textInput.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', './inputView'], function($, Backbone, _, inputView) { + 'use strict'; return inputView.extend({ diff --git a/module/web/app/scripts/views/linkGrabberModal.js b/module/web/app/scripts/views/linkGrabberModal.js index 9be90ac3c..e6f59c134 100644 --- a/module/web/app/scripts/views/linkGrabberModal.js +++ b/module/web/app/scripts/views/linkGrabberModal.js @@ -1,5 +1,6 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dialogs/linkgrabber'], function($, _, App, modalView, template) { + 'use strict'; // Modal dialog for package adding - triggers package:added when package was added return modalView.extend({ @@ -16,7 +17,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dial }, addOnEnter: function(e) { - if (e.keyCode != 13) return; + if (e.keyCode !== 13) return; this.addPackage(e); }, @@ -26,7 +27,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dial { name: $('#inputPackageName').val(), // TODO: better parsing / tokenization - links: $('#inputLinks').val().split("\n") + links: $('#inputLinks').val().split('\n') }, { success: function() { diff --git a/module/web/app/scripts/views/notificationView.js b/module/web/app/scripts/views/notificationView.js index 1dc150c79..abfcd8079 100644 --- a/module/web/app/scripts/views/notificationView.js +++ b/module/web/app/scripts/views/notificationView.js @@ -63,9 +63,9 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList' openQuery: function() { var self = this; - _.requireOnce(['views/queryModal'], function(modalView) { + _.requireOnce(['views/queryModal'], function(ModalView) { if (self.modal === null) { - self.modal = new modalView(); + self.modal = new ModalView(); self.modal.parent = self; } diff --git a/module/web/app/scripts/views/progressView.js b/module/web/app/scripts/views/progressView.js index 6b77d1ba6..3a4bb2825 100644 --- a/module/web/app/scripts/views/progressView.js +++ b/module/web/app/scripts/views/progressView.js @@ -1,6 +1,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abstract/itemView', 'hbs!tpl/header/progress', 'helpers/pluginIcon'], function($, Backbone, _, App, Api, ItemView, template, pluginIcon) { + 'use strict'; // Renders single file item return ItemView.extend({ diff --git a/module/web/app/scripts/views/queryModal.js b/module/web/app/scripts/views/queryModal.js index 5477334a0..7c6439b49 100644 --- a/module/web/app/scripts/views/queryModal.js +++ b/module/web/app/scripts/views/queryModal.js @@ -1,5 +1,6 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inputLoader', 'text!tpl/default/queryDialog.html'], function($, _, App, modalView, load_input, template) { + 'use strict'; return modalView.extend({ // TODO: submit on enter reloads the page sometimes @@ -38,8 +39,8 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inpu onRender: function() { // instantiate the input var input = this.model.get('input'); - var inputView = load_input(input); - this.input = new inputView(input); + var InputView = load_input(input); + this.input = new InputView(input); // only renders after wards this.$('#inputField').append(this.input.render().el); }, diff --git a/module/web/app/scripts/views/settings/configSectionView.js b/module/web/app/scripts/views/settings/configSectionView.js index 5bbcf1826..e05701b2a 100644 --- a/module/web/app/scripts/views/settings/configSectionView.js +++ b/module/web/app/scripts/views/settings/configSectionView.js @@ -1,6 +1,7 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../input/inputLoader', 'hbs!tpl/settings/config', 'hbs!tpl/settings/configItem'], function($, _, Backbone, App, itemView, load_input, template, templateItem) { + 'use strict'; // Renders settings over view page return itemView.extend({ @@ -28,7 +29,7 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../i // initialize the popover this.$('.page-header a').popover({ - placement: 'left', + placement: 'left' // trigger: 'hover' }); @@ -37,8 +38,8 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../i _.each(this.model.get('items'), function(item) { var json = item.toJSON(); var el = $('<div>').html(self.templateItem(json)); - var inputView = load_input(item.get('input')); - var input = new inputView(json).render(); + var InputView = load_input(item.get('input')); + var input = new InputView(json).render(); item.set('inputView', input); self.listenTo(input, 'change', _.bind(self.render, self)); @@ -66,7 +67,7 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../i return this; }, - onDestroy: function(){ + onDestroy: function() { // TODO: correct cleanup after building up so many views and models }, @@ -74,7 +75,7 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../i e.stopPropagation(); // TODO: success / failure popups var self = this; - this.model.save({success: function(){ + this.model.save({success: function() { self.render(); App.settingsView.refresh(); }}); diff --git a/module/web/app/scripts/views/settings/pluginChooserModal.js b/module/web/app/scripts/views/settings/pluginChooserModal.js index c604452e6..91e9f11b3 100644 --- a/module/web/app/scripts/views/settings/pluginChooserModal.js +++ b/module/web/app/scripts/views/settings/pluginChooserModal.js @@ -1,6 +1,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dialogs/addPluginConfig', 'helpers/pluginIcon', 'select2'], function($, _, App, modalView, template, pluginIcon) { + 'use strict'; return modalView.extend({ events: { diff --git a/module/web/app/scripts/views/settings/settingsView.js b/module/web/app/scripts/views/settings/settingsView.js index 23701e83d..cad5ab075 100644 --- a/module/web/app/scripts/views/settings/settingsView.js +++ b/module/web/app/scripts/views/settings/settingsView.js @@ -47,11 +47,11 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ConfigHolder', './con refresh: function() { var self = this; - $.ajax(App.apiRequest("getCoreConfig", null, {success: function(data) { + $.ajax(App.apiRequest('getCoreConfig', null, {success: function(data) { self.coreConfig = data; self.renderMenu(); }})); - $.ajax(App.apiRequest("getPluginConfig", null, {success: function(data) { + $.ajax(App.apiRequest('getPluginConfig', null, {success: function(data) { self.pluginConfig = data; self.renderMenu(); }})); @@ -82,7 +82,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ConfigHolder', './con })); // mark the selected element - this.$('li[data-name="' + this.selected + '"]').addClass("active"); + this.$('li[data-name="' + this.selected + '"]').addClass('active'); }, openConfig: function(name) { @@ -151,11 +151,11 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ConfigHolder', './con var el = $(e.target).closest('li'); - this.selected = el.data("name"); + this.selected = el.data('name'); this.openConfig(this.selected); - this.ui.menu.find("li.active").removeClass("active"); - el.addClass("active"); + this.ui.menu.find('li.active').removeClass('active'); + el.addClass('active'); e.preventDefault(); }, @@ -172,9 +172,9 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ConfigHolder', './con deleteConfig: function(e) { e.stopPropagation(); var el = $(e.target).parent().parent(); - var name = el.data("name"); + var name = el.data('name'); var self = this; - $.ajax(App.apiRequest("deleteConfig", {plugin: name}, { success: function() { + $.ajax(App.apiRequest('deleteConfig', {plugin: name}, { success: function() { self.refresh(); }})); |