1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-10 21:12:56 +01:00
Radarr/UI/AddSeries/New/SearchResultView.js

54 lines
1.5 KiB
JavaScript
Raw Normal View History

'use strict';
define(['app', 'Series/SeriesCollection'], function (app) {
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
2013-05-04 01:09:09 +02:00
template: "AddSeries/SearchResultTemplate",
ui: {
qualityProfile: '.x-quality-profile',
rootFolder : '.x-root-folder',
addButton : '.x-add'
},
events: {
'click .x-add': 'addSeries'
},
onRender: function () {
this.listenTo(this.model, 'change', this.render);
},
addSeries: function () {
var quality = this.ui.qualityProfile.val();
2013-04-11 06:30:51 +02:00
var rootFolderId = this.ui.rootFolder.val();
2013-03-31 23:45:16 +02:00
this.model.set('qualityProfileId', quality);
2013-04-11 06:30:51 +02:00
this.model.set('rootFolderId', rootFolderId);
var self = this;
2013-03-31 23:45:16 +02:00
this.model.save(undefined, {
2013-05-04 01:09:09 +02:00
url : NzbDrone.Series.SeriesCollection.prototype.url,
success: function () {
NzbDrone.Shared.Messenger.show({
message: 'Added: ' + self.model.get('title')
});
2013-04-12 17:08:09 +02:00
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model });
}
});
}
});
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({
2013-01-27 03:14:42 +01:00
itemView : NzbDrone.AddSeries.New.SearchItemView,
initialize: function () {
this.listenTo(this.collection, 'reset', this.render);
}
2013-02-22 07:18:36 +01:00
});
2013-01-27 03:14:42 +01:00
});