Skip to content

Commit

Permalink
Volume manager: represent each volume with model class
Browse files Browse the repository at this point in the history
  • Loading branch information
tomka committed Oct 17, 2018
1 parent 6f6b643 commit 00f9dd7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
22 changes: 16 additions & 6 deletions django/applications/catmaid/static/js/widgets/volumewidget.js
Expand Up @@ -156,23 +156,33 @@
container.appendChild(tableContainer);
this.datatable = $(table).DataTable({
lengthMenu: [CATMAID.pageLengthOptions, CATMAID.pageLengthLabels],
ajax: {
url: CATMAID.makeURL(project.id + "/volumes/"),
dataSrc: ""
ajax: function(data, callback, settings) {

CATMAID.fetch(project.id + "/volumes/")
.then(function(volumeData) {
let volumes = volumeData.map(function(volume) {
return new CATMAID.Volume(volume);
});
callback({
draw: data.draw,
data: volumes
});
})
.catch(CATMAID.handleError);
},
columns: [
{data: "name"},
{data: "title"},
{data: "id"},
{data: "comment"},
{
data: "user",
data: "user_id",
render: function(data, type, row, meta) {
return CATMAID.User.safe_get(data).login;
}
},
{data: "creation_time"},
{
data: "editor",
data: "editor_id",
render: function(data, type, row, meta) {
return CATMAID.User.safe_get(data).login;
}
Expand Down
8 changes: 8 additions & 0 deletions django/applications/catmaid/static/libs/catmaid/volumes.js
Expand Up @@ -12,6 +12,14 @@
CATMAID.Volume = function(options) {
options = options || {};
this.id = options.id || null;
this.project_id = options.project || null;
this.user_id = options.user || null;
this.editor_id = options.editor || null;
this.title = options.name || '';
this.comment = options.comment || '';
this.edition_time = options.edition_time || null;
this.creation_time = options.creation_time || null;
this.selected = options.selected || false;
};

CATMAID.Volume.prototype = {};
Expand Down

0 comments on commit 00f9dd7

Please sign in to comment.