client side code webstorm code cleanup.

This commit is contained in:
kay.one 2013-03-29 16:28:58 -07:00
commit 445ea4f344
94 changed files with 4355 additions and 4243 deletions

View file

@ -12,21 +12,21 @@ define([
template: 'AddSeries/addSeriesLayoutTemplate',
regions: {
addNew: '#add-new',
addNew : '#add-new',
importExisting: '#import-existing',
rootFolders: '#root-folders'
rootFolders : '#root-folders'
},
ui: {
addNewTab: '.x-add-new-tab',
addNewTab : '.x-add-new-tab',
importExistingTab: '.x-import-existing-tab',
rootFoldersTab: '.x-root-folders-tab'
rootFoldersTab : '.x-root-folders-tab'
},
events: {
'click .x-add-new-tab': 'showAddNew',
'click .x-add-new-tab' : 'showAddNew',
'click .x-import-existing-tab': 'showImport',
'click .x-root-folders-tab': 'showRootFolders'
'click .x-root-folders-tab' : 'showRootFolders'
},
showAddNew: function (e) {

View file

@ -1,5 +1,5 @@
<div class="line row folder-match-result-view">
<div class="span6">
{{title}} {{seriesYear}}
</div>

View file

@ -1,6 +1,7 @@
<div class="row">
<div class="accordion result-list span12 existing-root-folder-view">
<h1>{{path}}</h1>
<div class="x-existing-folder-container" />
<div class="x-existing-folder-container"/>
</div>
</div>

View file

@ -7,11 +7,12 @@
<option value="{{id}}">{{attributes.name}}</option>
{{/each}}
</select>
<div class="btn btn-primary x-btn-search pull-right">
<icon class="icon-search "></icon>
</div>
<div class="row">
<div class="x-folder-name-match-results folder-name-matches span11" />
<div class="x-folder-name-match-results folder-name-matches span11"/>
</div>
</div>

View file

@ -6,6 +6,6 @@
</div>
</div>
<div class="row">
<div id="search-result" class="result-list span12" />
<div id="search-result" class="result-list span12"/>
</div>
</div>

View file

@ -2,7 +2,7 @@
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/SearchResultView', 'Shared/SpinnerView'], function () {
NzbDrone.AddSeries.New.AddNewSeriesView = Backbone.Marionette.Layout.extend({
template: 'AddSeries/New/AddNewSeriesTemplate',
route: 'Series/add/new',
route : 'Series/add/new',
ui: {
seriesSearch: '.search input'
@ -41,7 +41,7 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/Sear
context.searchResult.show(new NzbDrone.Shared.SpinnerView());
context.currentSearchRequest = context.collection.fetch({
data: { term: term },
data : { term: term },
success: function () {
context.searchResult.show(context.resultView);
}

View file

@ -7,14 +7,15 @@
<div class="accordion-inner">
<select class="span7 x-root-folder">
{{#each rootFolders.models}}
<option value="{{id}}">{{attributes.path}}</option>
<option value="{{id}}">{{attributes.path}}</option>
{{/each}}
</select>
<select class="span2 x-quality-profile">
{{#each qualityProfiles.models}}
<option value="{{id}}">{{attributes.name}}</option>
<option value="{{id}}">{{attributes.name}}</option>
{{/each}}
</select>
<div class="btn btn-success pull-right icon-plus x-add">
</div>
</div>

View file

@ -3,13 +3,13 @@ define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollectio
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
template: "AddSeries/New/SearchResultTemplate",
template : "AddSeries/New/SearchResultTemplate",
className: 'search-item',
ui: {
qualityProfile: '.x-quality-profile',
rootFolder: '.x-root-folder',
addButton: '.x-add'
rootFolder : '.x-root-folder',
addButton : '.x-add'
},
events: {
@ -32,10 +32,10 @@ define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollectio
var path = rootPath + "\\" + title;
var model = new NzbDrone.Series.SeriesModel({
tvdbId: seriesId,
title: title,
tvdbId : seriesId,
title : title,
qualityProfileId: quality,
path: path
path : path
});
var self = this;
@ -46,9 +46,9 @@ define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollectio
model.save(undefined, {
success: function () {
var notificationModel = new NzbDrone.Shared.NotificationModel({
title: 'Added',
title : 'Added',
message: title,
level: 'success'
level : 'success'
});
notificationCollection.push(notificationModel);
@ -60,8 +60,8 @@ define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollectio
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({
itemView: NzbDrone.AddSeries.New.SearchItemView,
className: 'accordion',
itemView : NzbDrone.AddSeries.New.SearchItemView,
className : 'accordion',
initialize: function () {
this.listenTo(this.collection, 'reset', this.render);
}

View file

@ -2,7 +2,7 @@
define(['app', 'AddSeries/RootFolders/RootFolderModel'], function () {
var rootFolderCollection = Backbone.Collection.extend({
url: NzbDrone.Constants.ApiRoot + '/rootfolder',
url : NzbDrone.Constants.ApiRoot + '/rootfolder',
model: NzbDrone.AddSeries.RootFolders.RootFolderModel
});

View file

@ -2,7 +2,8 @@
<div class="input-prepend input-append nz-input-large x-path span10">
<i class="add-on icon-folder-open"></i>
<input class="input-block-level" type="text" placeholder="Path of the folder to add ...">
<div class="btn icon-plus btn-success x-add" />
<div class="btn icon-plus btn-success x-add"/>
</div>
<div class="span12 result-list" id="current-dirs" />
<div class="span12 result-list" id="current-dirs"/>
</div>

View file

@ -1,11 +1,11 @@
"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({
template: 'AddSeries/RootFolders/RootFolderItemTemplate',
tagName: 'tr',
tagName : 'tr',
events: {
'click .x-remove': 'removeFolder'
@ -25,13 +25,13 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
itemView: NzbDrone.AddSeries.RootFolderItemView,
tagName: 'table',
tagName : 'table',
className: 'table table-hover'
});
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
template: 'AddSeries/RootFolders/RootFolderTemplate',
route: 'series/add/rootdir',
route : 'series/add/rootdir',
ui: {
pathInput: '.x-path input'
@ -56,9 +56,9 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
addFolder: function () {
var newDir = new NzbDrone.AddSeries.RootFolders.RootFolderModel(
{
Path: this.ui.pathInput.val()
});
{
Path: this.ui.pathInput.val()
});
var self = this;

View file

@ -1,7 +1,7 @@
"use strict";
define(['app', 'AddSeries/SearchResultModel'], function () {
NzbDrone.AddSeries.SearchResultCollection = Backbone.Collection.extend({
url: NzbDrone.Constants.ApiRoot + '/series/lookup',
url : NzbDrone.Constants.ApiRoot + '/series/lookup',
model: NzbDrone.AddSeries.SearchResultModel
});
});

View file

@ -1,25 +1,25 @@
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection'],
function (app, rootFolderCollection, qualityProfileCollection) {
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
mutators: {
seriesYear: function () {
var date = Date.utc.create(this.get('firstAired')).format('({yyyy})');
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
mutators: {
seriesYear: function () {
var date = Date.utc.create(this.get('firstAired')).format('({yyyy})');
//don't append year, if the series name already has the name appended.
if (this.get('title').endsWith(date)) {
return "";
} else {
return date;
//don't append year, if the series name already has the name appended.
if (this.get('title').endsWith(date)) {
return "";
} else {
return date;
}
}
}
},
},
defaults: {
qualityProfiles: qualityProfileCollection,
rootFolders: rootFolderCollection
}
defaults: {
qualityProfiles: qualityProfileCollection,
rootFolders : rootFolderCollection
}
});
});
});

View file

@ -4,7 +4,7 @@
<ul class="nav nav-tabs" id="myTab">
<li><a href="#add-new" class="x-add-new-tab">Add New Series</a></li>
<li><a href="#import-existing" class="x-import-existing-tab">Import Existing Series</a></li>
<li><a href="#root-folders" class ="x-root-folders-tab">TV Folders</a></li>
<li><a href="#root-folders" class="x-root-folders-tab">TV Folders</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="add-new">Add new series.</div>