some js cleanup.
This commit is contained in:
parent
e29c07c4a5
commit
c7776f74e1
|
@ -115,6 +115,7 @@ module.exports = function(grunt) {
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||||
|
grunt.loadNpmTasks('grunt-wrap');
|
||||||
|
|
||||||
// Default task(s).
|
// Default task(s).
|
||||||
grunt.registerTask('default', ['copy','less:bootstrap','handlebars', 'watch']);
|
grunt.registerTask('default', ['copy','less:bootstrap','handlebars', 'watch']);
|
||||||
|
|
|
@ -1,135 +1,134 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection', 'Shared/NotificationCollection', 'AddSeries/Existing/UnmappedFolderModel', 'AddSeries/SearchResultCollection', 'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection, notificationCollection) {
|
'app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection', 'Shared/NotificationCollection', 'AddSeries/Existing/UnmappedFolderModel', 'AddSeries/SearchResultCollection', 'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection, notificationCollection) {
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
||||||
template:'AddSeries/Existing/FolderMatchResultViewTemplatate',
|
template: 'AddSeries/Existing/FolderMatchResultViewTemplatate',
|
||||||
|
|
||||||
events:{
|
events: {
|
||||||
'click .x-btn-add':'addSeries'
|
'click .x-btn-add': 'addSeries'
|
||||||
},
|
},
|
||||||
|
|
||||||
addSeries:function () {
|
addSeries: function () {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var seriesId = this.model.get('tvDbId');
|
var seriesId = this.model.get('tvDbId');
|
||||||
var title = this.model.get('title');
|
var title = this.model.get('title');
|
||||||
var quality = this.options.qualityProfile.val();
|
var quality = this.options.qualityProfile.val();
|
||||||
var path = this.options.folder.path;
|
var path = this.options.folder.path;
|
||||||
|
|
||||||
var model = new NzbDrone.Series.SeriesModel({
|
var model = new NzbDrone.Series.SeriesModel({
|
||||||
tvDbId: seriesId,
|
tvDbId : seriesId,
|
||||||
title:title,
|
title : title,
|
||||||
qualityProfileId:quality,
|
qualityProfileId: quality,
|
||||||
path:path
|
path : path
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var seriesCollection = new NzbDrone.Series.SeriesCollection();
|
var seriesCollection = new NzbDrone.Series.SeriesCollection();
|
||||||
seriesCollection.add(model);
|
seriesCollection.add(model);
|
||||||
|
|
||||||
model.save(undefined, {
|
model.save(undefined, {
|
||||||
success:function () {
|
success: function () {
|
||||||
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
||||||
tvDbId: seriesId,
|
tvDbId : seriesId,
|
||||||
title:'Added',
|
title : 'Added',
|
||||||
message:title,
|
message: title,
|
||||||
level:'success'
|
level : 'success'
|
||||||
});
|
});
|
||||||
|
|
||||||
notificationCollection.push(notificationModel);
|
notificationCollection.push(notificationModel);
|
||||||
self.close();
|
self.close();
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
|
||||||
|
|
||||||
template:'AddSeries/Existing/UnmappedFolderCompositeViewTemplatate',
|
|
||||||
itemViewContainer:'.x-folder-name-match-results',
|
|
||||||
itemView:NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
|
||||||
|
|
||||||
events:{
|
|
||||||
'click .x-btn-search':'search'
|
|
||||||
},
|
|
||||||
|
|
||||||
ui:{
|
|
||||||
searchButton:'.x-btn-search',
|
|
||||||
searchText:'.x-txt-search',
|
|
||||||
profileList:'.x-lst-quality-profile'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize:function () {
|
|
||||||
this.collection = new NzbDrone.AddSeries.SearchResultCollection();
|
|
||||||
},
|
|
||||||
|
|
||||||
search:function () {
|
|
||||||
|
|
||||||
var icon = this.ui.searchButton.find('icon');
|
|
||||||
|
|
||||||
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
|
||||||
|
|
||||||
this.collection.fetch({
|
|
||||||
data:{ term:this.ui.searchText.val() },
|
|
||||||
success:function () {
|
|
||||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
||||||
|
|
||||||
},
|
|
||||||
fail:function () {
|
|
||||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
itemViewOptions:function () {
|
|
||||||
return {
|
|
||||||
qualityProfile:this.ui.profileList,
|
|
||||||
rootFolder: this.model.get('rootFolder'),
|
|
||||||
folder: this.model.get('folder')
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
|
||||||
|
|
||||||
template:"AddSeries/Existing/RootFolderCompositeViewTemplate",
|
|
||||||
itemViewContainer:".x-existing-folder-container",
|
|
||||||
itemView:NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView,
|
|
||||||
|
|
||||||
initialize:function () {
|
|
||||||
|
|
||||||
if (!this.model) {
|
|
||||||
throw "model is required.";
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection();
|
|
||||||
this.refreshItems();
|
|
||||||
this.listenTo(qualityProfileCollection, 'reset', this.refreshItems, this);
|
|
||||||
},
|
|
||||||
|
|
||||||
refreshItems:function () {
|
|
||||||
this.collection.importItems(this.model);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
|
||||||
|
|
||||||
itemView:NzbDrone.AddSeries.Existing.RootFolderCompositeView,
|
|
||||||
|
|
||||||
initialize:function () {
|
|
||||||
this.collection = rootFolders;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
||||||
|
|
||||||
|
template : 'AddSeries/Existing/UnmappedFolderCompositeViewTemplatate',
|
||||||
|
itemViewContainer: '.x-folder-name-match-results',
|
||||||
|
itemView : NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'click .x-btn-search': 'search'
|
||||||
|
},
|
||||||
|
|
||||||
|
ui: {
|
||||||
|
searchButton: '.x-btn-search',
|
||||||
|
searchText : '.x-txt-search',
|
||||||
|
profileList : '.x-lst-quality-profile'
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize: function () {
|
||||||
|
this.collection = new NzbDrone.AddSeries.SearchResultCollection();
|
||||||
|
},
|
||||||
|
|
||||||
|
search: function () {
|
||||||
|
|
||||||
|
var icon = this.ui.searchButton.find('icon');
|
||||||
|
|
||||||
|
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
||||||
|
|
||||||
|
this.collection.fetch({
|
||||||
|
data : { term: this.ui.searchText.val() },
|
||||||
|
success: function () {
|
||||||
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||||
|
|
||||||
|
},
|
||||||
|
fail : function () {
|
||||||
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
itemViewOptions: function () {
|
||||||
|
return {
|
||||||
|
qualityProfile: this.ui.profileList,
|
||||||
|
rootFolder : this.model.get('rootFolder'),
|
||||||
|
folder : this.model.get('folder')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
||||||
|
|
||||||
|
template : "AddSeries/Existing/RootFolderCompositeViewTemplate",
|
||||||
|
itemViewContainer: ".x-existing-folder-container",
|
||||||
|
itemView : NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView,
|
||||||
|
|
||||||
|
initialize: function () {
|
||||||
|
|
||||||
|
if (!this.model) {
|
||||||
|
throw "model is required.";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection();
|
||||||
|
this.refreshItems();
|
||||||
|
this.listenTo(qualityProfileCollection, 'reset', this.refreshItems, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
refreshItems: function () {
|
||||||
|
this.collection.importItems(this.model);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
||||||
|
|
||||||
|
itemView: NzbDrone.AddSeries.Existing.RootFolderCompositeView,
|
||||||
|
|
||||||
|
initialize: function () {
|
||||||
|
this.collection = rootFolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfiles) {
|
||||||
define(['app','Quality/QualityProfileCollection'], function (app, qualityProfiles) {
|
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
|
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
|
||||||
|
|
||||||
defaults :{
|
defaults: {
|
||||||
quality: qualityProfiles
|
quality: qualityProfiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/SearchResultView', 'Shared/SpinnerView'], function () {
|
"use strict";
|
||||||
|
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/SearchResultView', 'Shared/SpinnerView'], function () {
|
||||||
NzbDrone.AddSeries.New.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
NzbDrone.AddSeries.New.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||||
template: 'AddSeries/New/AddNewSeriesTemplate',
|
template: 'AddSeries/New/AddNewSeriesTemplate',
|
||||||
route: 'Series/add/new',
|
route: 'Series/add/new',
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollection', 'AddSeries/SearchResultModel', 'Series/SeriesCollection'], function (app, notificationCollection) {
|
define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollection', 'AddSeries/SearchResultModel', 'Series/SeriesCollection'], function (app, notificationCollection) {
|
||||||
|
|
||||||
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
define(['app', 'AddSeries/RootFolders/RootFolderModel'], function () {
|
"use strict";
|
||||||
|
define(['app', 'AddSeries/RootFolders/RootFolderModel'], function () {
|
||||||
|
|
||||||
var rootFolderCollection = Backbone.Collection.extend({
|
var rootFolderCollection = Backbone.Collection.extend({
|
||||||
url: NzbDrone.Constants.ApiRoot + '/rootfolder',
|
url: NzbDrone.Constants.ApiRoot + '/rootfolder',
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
"use strict";
|
||||||
define(['app'], function () {
|
define(['app'], function () {
|
||||||
NzbDrone.AddSeries.RootFolders.RootFolderModel = Backbone.Model.extend({
|
NzbDrone.AddSeries.RootFolders.RootFolderModel = Backbone.Model.extend({
|
||||||
mutators: {
|
mutators: {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
'use strict;'
|
"use strict";
|
||||||
|
|
||||||
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplete'], function (app,rootFolders) {
|
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplete'], function (app,rootFolders) {
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.AddSeries.RootFolderItemView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.AddSeries.RootFolderItemView = Backbone.Marionette.ItemView.extend({
|
||||||
|
|
||||||
template: 'AddSeries/RootFolders/RootFolderItemTemplate',
|
template: 'AddSeries/RootFolders/RootFolderItemTemplate',
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
"grunt-contrib-less": "*",
|
"grunt-contrib-less": "*",
|
||||||
"grunt-contrib-concat": "*",
|
"grunt-contrib-concat": "*",
|
||||||
"grunt-contrib-copy": "*",
|
"grunt-contrib-copy": "*",
|
||||||
|
"grunt-wrap": "*",
|
||||||
"grunt-curl": "*"
|
"grunt-curl": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue