finished add series,

still has a few rough edges but should be functional.
pull/3113/head
Keivan Beigi 12 years ago
parent ea929974f3
commit 465dc725c8

@ -0,0 +1,16 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Tags("")]
[Migration(2)]
public class Remove_tvrage_imdb_unique_constraint : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Execute.Sql("DROP INDEX IX_Series_TvRageId;");
Execute.Sql("DROP INDEX IX_Series_ImdbId;");
}
}
}

@ -202,6 +202,7 @@
<Compile Include="Datastore\IWriteModels.cs" />
<Compile Include="Datastore\LazyList.cs" />
<Compile Include="Datastore\MappingExtensions.cs" />
<Compile Include="Datastore\Migration\002_Remove_tvrage_imdb_unique_constraint.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationOptions.cs" />

@ -2,6 +2,7 @@
<dictionary name="Keivan.Beigi">
<words>
<w>bnzbd</w>
<w>clickable</w>
<w>mouseenter</w>
<w>mouseleave</w>
</words>

@ -19,20 +19,26 @@ define([
'click .x-import': '_importSeries'
},
onRender: function () {
initialize: function () {
this.rootFolderLayout = new NzbDrone.AddSeries.RootFolders.Layout();
this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
},
/* rootFolderCollection.fetch({success: function () {
self.importExisting.show(new NzbDrone.AddSeries.Existing.RootDirListView({model: rootFolderCollection.at(0)}));
}});*/
_folderSelected: function (options) {
NzbDrone.modalRegion.closeModal();
this.workspace.show(new NzbDrone.AddSeries.Existing.ListView({model: options.model}));
},
onRender: function () {
qualityProfileCollection.fetch();
rootFolderCollection.fetch();
this.workspace.show(new NzbDrone.AddSeries.AddSeriesView());
},
_importSeries: function () {
NzbDrone.modalRegion.show(new NzbDrone.AddSeries.RootFolders.Layout());
NzbDrone.modalRegion.show(this.rootFolderLayout);
}
});
});

@ -1,9 +1,9 @@
"use strict";
define(['app',
'AddSeries/RootFolders/RootFolderCollection',
'AddSeries/SearchResultView',
'Shared/SpinnerView',
'AddSeries/Collection'], function () {
'AddSeries/RootFolders/RootFolderCollection',
'AddSeries/SearchResultView',
'Shared/SpinnerView',
'AddSeries/Collection'], function () {
NzbDrone.AddSeries.AddSeriesView = Backbone.Marionette.Layout.extend({
template: 'AddSeries/AddSeriesTemplate',
@ -16,18 +16,7 @@ define(['app',
},
initialize: function () {
this.collection = new NzbDrone.AddSeries.Collection();
NzbDrone.AddSeries.New.AddNewSeriesContext = this;
NzbDrone.vent.on(NzbDrone.Events.SeriesAdded, function (options) {
if (!options.existing) {
NzbDrone.AddSeries.New.AddNewSeriesContext.ui.seriesSearch.val('');
//Todo: Figure out why this is inconsistent
options.series.collection.reset();
}
});
},
onRender: function () {

@ -5,7 +5,7 @@ define([
'AddSeries/Existing/UnmappedFolderModel',
'AddSeries/Collection',
'AddSeries/SearchResultView',
'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection) {
'Series/SeriesModel'], function () {
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
@ -31,9 +31,9 @@ define([
this.collection = new NzbDrone.AddSeries.Collection();
this.collection.bind('reset', this.collectionReset, this);
this.on("itemview:seriesAdded", function () {
this.on("item:removed", function () {
this.close();
});
}, this);
},
onRender: function () {
@ -53,7 +53,7 @@ define([
this.searchCollection.fetch({
data : { term: this.ui.searchText.val() },
success: function (collection) {
success: function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
deferred.resolve();
self.collection.add(self.searchCollection.shift());
@ -101,7 +101,7 @@ define([
return {
qualityProfile: this.ui.profileList,
rootFolder : this.model.get('rootFolder'),
folder : this.model.get('folder'),
folder : this.model.get('folder').path,
isExisting : true
};
}

@ -1,5 +1,5 @@
<td name="path" class="span10"/>
<td class="span3">
<td name="path" class="span10 x-folder clickable"/>
<td class="span3 x-folder clickable">
<span name="freeSpaceString"></span>
</td>
<td class="span1 nz-row-action">

@ -8,14 +8,18 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
tagName : 'tr',
events: {
'click .x-remove': 'removeFolder'
'click .x-remove': 'removeFolder',
'click .x-folder': 'folderSelected'
},
removeFolder: function () {
this.model.destroy({ wait: true });
this.model.collection.remove(this.model);
}
},
folderSelected: function () {
this.trigger('folderSelected', this.model);
}
});
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
@ -40,14 +44,22 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
'click .x-add': 'addFolder'
},
initialize: function () {
this.collection = rootFolders;
this.rootfolderListView = new NzbDrone.AddSeries.RootDirListView({ collection: rootFolders });
this.rootfolderListView.on('itemview:folderSelected', this._onFolderSelected, this);
},
onRender: function () {
this.collection = rootFolders;
this.currentDirs.show(new NzbDrone.AddSeries.RootDirListView({ collection: this.collection }));
this.currentDirs.show(this.rootfolderListView);
this.ui.pathInput.autoComplete('/directories');
},
_onFolderSelected: function (options) {
this.trigger('folderSelected', options);
},
addFolder: function () {
var newDir = new NzbDrone.AddSeries.RootFolders.RootFolderModel(
@ -55,25 +67,12 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
Path: this.ui.pathInput.val()
});
var self = this;
this.collection.create(newDir, {
rootFolders.create(newDir, {
wait: true, success: function () {
self.collection.fetch();
rootFolders.fetch();
}
});
},
search: function (context) {
var term = context.ui.seriesSearch.val();
if (term === "") {
context.collection.reset();
} else {
console.log(term);
context.collection.fetch({ data: { term: term } });
}
}
});

@ -17,9 +17,13 @@ define(['app', 'Series/SeriesCollection', 'AddSeries/RootFolders/RootFolderTempl
},
initialize: function () {
if (this.isExisting) {
this.modal.set('isExisting', true);
if (!this.model) {
throw 'model is required';
}
this.model.set('isExisting', this.options.isExisting);
this.model.set('path', this.options.folder);
},
onRender: function () {
@ -41,12 +45,14 @@ define(['app', 'Series/SeriesCollection', 'AddSeries/RootFolders/RootFolderTempl
this.model.save(undefined, {
url : NzbDrone.Series.SeriesCollection.prototype.url,
success: function () {
self.close();
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
NzbDrone.Shared.Messenger.show({
message: 'Added: ' + self.model.get('title')
});
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model });
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { series: self.model });
self.model.collection.remove(self.model);
},
fail : function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');

@ -47,12 +47,3 @@ Marionette.ItemView.prototype.render = function () {
return result;
};
Marionette.CollectionView.prototype.render = function () {
if (this.model) {
NzbDrone.ModelBinder.bind(this.model, this.el);
}
return oldItemCollectionViewRender.apply(this, arguments);
};

@ -22,6 +22,12 @@ define(function () {
//https://github.com/twitter/bootstrap/issues/4663
this.$el.attr('tabindex', '-1');
this.$el.modal({'show': true, 'keyboard': true});
},
closeModal: function () {
this.$el.modal('hide');
this.close();
}
});

Loading…
Cancel
Save