1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-21 01:49:57 +02:00
Sonarr/UI/AddSeries/Collection.js

32 lines
802 B
JavaScript
Raw Normal View History

2013-06-30 22:57:26 +03:00
'use strict';
2013-06-21 04:43:58 +03:00
define(
[
'backbone',
'Series/SeriesModel'
], function (Backbone, SeriesModel) {
2013-06-21 04:43:58 +03:00
return Backbone.Collection.extend({
url : window.ApiRoot + '/series/lookup',
2013-06-21 04:43:58 +03:00
model: SeriesModel,
2013-05-13 07:24:04 +03:00
2013-06-30 22:57:26 +03:00
initialize: function (options) {
this.unmappedFolderModel = options.unmappedFolderModel;
},
2013-06-21 04:43:58 +03:00
parse: function (response) {
2013-06-30 22:57:26 +03:00
var self = this;
2013-06-21 04:43:58 +03:00
_.each(response, function (model) {
model.id = undefined;
2013-06-30 22:57:26 +03:00
if (self.unmappedFolderModel) {
model.path = self.unmappedFolderModel.get('folder').path;
}
2013-06-21 04:43:58 +03:00
});
2013-06-21 04:43:58 +03:00
return response;
}
});
2013-05-13 07:24:04 +03:00
});