OpenSlides/openslides/topics/static/js/topics/base.js
Norman Jäckel cab53f0434 Moved custom slides to own app topics for better app structure.
Renamed model to Topic. Added migrations file. Fixed #2402.
2016-09-21 15:00:23 +02:00

54 lines
1.4 KiB
JavaScript

(function () {
'use strict';
angular.module('OpenSlidesApp.topics', [])
.factory('Topic', [
'DS',
'jsDataModel',
'gettext',
function(DS, jsDataModel, gettext) {
var name = 'topics/topic';
return DS.defineResource({
name: name,
useClass: jsDataModel,
verboseName: gettext('Topic'),
methods: {
getResourceName: function () {
return name;
},
getAgendaTitle: function () {
return this.title;
},
// link name which is shown in search result
getSearchResultName: function () {
return this.getAgendaTitle();
},
// subtitle of search result
getSearchResultSubtitle: function () {
return 'Topic';
},
},
relations: {
belongsTo: {
'agenda/item': {
localKey: 'agenda_item_id',
localField: 'agenda_item',
}
},
hasMany: {
'mediafiles/mediafile': {
localField: 'attachments',
localKeys: 'attachments_id',
}
}
}
});
}
])
.run(['Topic', function(Topic) {}]);
}());