1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-10 04:52:42 +01:00

add existing is almost done.

This commit is contained in:
Keivan Beigi 2013-01-31 19:15:19 -08:00 committed by kay.one
parent 023eaca678
commit 4176e7e9e4
12 changed files with 98 additions and 57 deletions

View File

@ -187,7 +187,6 @@
<Content Include="_backboneApp\AddSeries\Existing\UnmappedFolderCompositeViewTemplatate.html" /> <Content Include="_backboneApp\AddSeries\Existing\UnmappedFolderCompositeViewTemplatate.html" />
<Content Include="_backboneApp\AddSeries\New\SearchResultView.js" /> <Content Include="_backboneApp\AddSeries\New\SearchResultView.js" />
<Content Include="_backboneApp\AddSeries\Existing\ImportSeriesView.js" /> <Content Include="_backboneApp\AddSeries\Existing\ImportSeriesView.js" />
<Content Include="_backboneApp\AddSeries\Existing\RootFoldersCompositeView.html" />
<Content Include="_backboneApp\AddSeries\Existing\UnmappedFolderModel.js" /> <Content Include="_backboneApp\AddSeries\Existing\UnmappedFolderModel.js" />
<Content Include="_backboneApp\AddSeries\Existing\RootFolderCompositeViewTemplate.html" /> <Content Include="_backboneApp\AddSeries\Existing\RootFolderCompositeViewTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootDirTemplate.html" /> <Content Include="_backboneApp\AddSeries\RootFolders\RootDirTemplate.html" />

View File

@ -1,5 +1,5 @@
<div class="row"> <div class="line row folder-match-result-view">
<a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign pull-left"></a> <a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign"></a>
<div>{{seriesName}} {{seriesYear}}</div> <span>{{seriesName}} {{seriesYear}}</span>
<div class="btn btn-success x-add pull-right icon-plus"></div> <span class="icon-plus pull-right btn btn-success"></span>
</div> </div>

View File

@ -21,14 +21,30 @@ NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.Co
'click .x-search': 'search' 'click .x-search': 'search'
}, },
ui: {
searchButton: '.x-search'
},
initialize: function () { initialize: function () {
this.collection = new NzbDrone.AddSeries.SearchResultCollection(); this.collection = new NzbDrone.AddSeries.SearchResultCollection();
}, },
search: function () { search: function () {
var icon = this.ui.searchButton.find('icon');
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
this.collection.fetch({ this.collection.fetch({
data: $.param({ term: 'simpsons' }) data: $.param({ term: this.model.get('folder') }),
success: function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
},
fail:function() {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
}
}); });
} }

View File

@ -1,20 +1,4 @@
<div class="accordion result-list span12 offset4 "> <div class="accordion result-list span12 offset4 existing-root-folder-view">
<h2>{{path}}</h2> <h1>{{path}}</h1>
<div class="x-existing-folder-container" />
<div class="x-existing-folder-container">
</div>
<!-- {{#each unmappedFolders}}
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" href="#{{../id}}_{{@index}}">{{this}}</a>
</div>
<div id="{{../id}}_{{@index}}" class="accordion-body collapse">
<div class="accordion-inner">
{{this}}
</div>
</div>
</div>
{{/each}}-->
</div> </div>

View File

@ -1,15 +0,0 @@
<div class="accordion result-list span12 offset4 ">
<h2>{{path}}</h2>
{{#each unmappedFolders}}
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" href="#{{../id}}_{{@index}}">{{this}}</a>
</div>
<div id="{{../id}}_{{@index}}" class="accordion-body collapse">
<div class="accordion-inner">
{{this}}
</div>
</div>
</div>
{{/each}}
</div>

View File

@ -1,7 +1,14 @@
<div> <div class="row unmapped-folder-view">
{{folder}} <div class="span11">
<div class="btn x-search"></div> <div class="row folder-header">
<div class="x-folder-name-match-results"> {{folder}}
<div class="btn btn-primary x-search pull-right">
<icon class="icon-search "></icon>
</div>
</div>
<div class="row">
<div class="x-folder-name-match-results span10 offset1" />
</div>
</div> </div>
</div> </div>

View File

@ -49,13 +49,15 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
search: function (context) { search: function (context) {
context.abortExistingRequest();
var term = context.ui.seriesSearch.val(); var term = context.ui.seriesSearch.val();
context.collection.reset(); context.collection.reset();
if (term !== '') { if (term !== '') {
context.searchResult.show(new NzbDrone.Shared.SpinnerView()); context.searchResult.show(new NzbDrone.Shared.SpinnerView());
context.collection.fetch({ context.currentSearchRequest = context.collection.fetch({
data: $.param({ term: term }), data: $.param({ term: term }),
success: function (model) { success: function (model) {
context.resultUpdated(model, context); context.resultUpdated(model, context);
@ -67,6 +69,13 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
} }
}, },
abortExistingRequest : function () {
if (this.currentSearchRequest && this.currentSearchRequest.readyState > 0 && this.currentSearchRequest.readyState < 4) {
console.log('aborting previous pending search request.');
this.currentSearchRequest.abort();
}
},
resultUpdated: function (options, context) { resultUpdated: function (options, context) {
_.each(options.models, function (model) { _.each(options.models, function (model) {

View File

@ -52,3 +52,20 @@
.search-item select { .search-item select {
font-size: 16px; font-size: 16px;
} }
/*Existing*/
.unmapped-folder-view {
background: #fcf8e3;
margin-top: 20px;
padding: 20px;
}
.unmapped-folder-view .folder-header {
font-size: 30px;
font-weight:300
}
.existing-root-folder-view, h1 {
padding: 10px 0px 20px 0px;
}

View File

@ -44,7 +44,7 @@
// Typography // Typography
// ------------------------- // -------------------------
@sansFontFamily: "Segoe UI","Segoe WP", "Helvetica Neue", Helvetica, Arial, sans-serif; @sansFontFamily: "open sans", "Segoe UI","Segoe WP", "Helvetica Neue", Helvetica, Arial, sans-serif;
@serifFontFamily: Georgia, "Times New Roman", Times, serif; @serifFontFamily: Georgia, "Times New Roman", Times, serif;
@monoFontFamily: Monaco, Menlo, Consolas, "Courier New", monospace; @monoFontFamily: Monaco, Menlo, Consolas, "Courier New", monospace;

View File

@ -67,3 +67,17 @@ body {
#notification-region i { #notification-region i {
padding-right: 10px; padding-right: 10px;
} }
.line {
height: 4em;
line-height: 4em;
}
.line > [class^="icon-"], .line > [class*=" icon-"] {
margin-top: 1em;
height: 1em;
line-height: 1em;
}

View File

@ -3,7 +3,9 @@ NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
mutators: { mutators: {
pre: function () { pre: function () {
return this.get('message').lines().lenght > 1; if (this.get('message')) {
return this.get('message').lines().lenght > 1;
}
}, },
iconClass: function () { iconClass: function () {

View File

@ -51,24 +51,32 @@ window.onerror = function (msg, url, line) {
model.set('level', 'error'); model.set('level', 'error');
NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(model); NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(model);
} catch (error) { } catch (error) {
alert('Couldn\'t report JS error. ' + error);
console.log("An error occurred while reporting error. " + error);
console.log(msg);
alert('Couldn\'t report JS error. ' + msg);
} }
var suppressErrorAlert = false; return false; //don't suppress default alerts and logs.
return suppressErrorAlert;
}; };
$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) { $(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
//don't report 200 error codes
if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) { if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) {
return; return undefined;
} }
//doesn't report aborted requests
if (xmlHttpRequest.statusText === 'abort') {
return undefined;
}
var model = new NzbDrone.Shared.NotificationModel(); var model = new NzbDrone.Shared.NotificationModel();
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText); model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
model.set('message', xmlHttpRequest.responseText); model.set('message', xmlHttpRequest.responseText);
model.set('level', 'error'); model.set('level', 'error');
NzbDrone.Shared.NotificationCollectionView.Instance.collection.push(model); NzbDrone.Shared.NotificationCollectionView.Instance.collection.push(model);
var suppressErrorAlert = false; return false;
return suppressErrorAlert;
}); });