Skip to content

Commit

Permalink
update M2O parse + update single file list value
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed May 7, 2017
1 parent 5fa1d42 commit d276677
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 6 additions & 3 deletions app/core/entries/EntriesModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,13 @@ define(function(require, exports, module) {
data = _.isObject(attributes[id]) ? attributes[id] : {id: attributes[id]};
}

var collectionRelated = EntriesManager.getInstance(tableRelated);
var ModelRelated = collectionRelated.model;
// only parse the value is not already a model
if (!(attributes[id] instanceof Backbone.Model)) {
var collectionRelated = EntriesManager.getInstance(tableRelated);
var ModelRelated = collectionRelated.model;

attributes[id] = new ModelRelated(data.data, {collection: collectionRelated});
attributes[id] = new ModelRelated(data.data, {collection: collectionRelated});
}

break;
}
Expand Down
5 changes: 0 additions & 5 deletions app/core/interfaces/single_file/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ define([
list: function (options) {
var model = options.value;

// @TODO: Have this not be hardcoded
if (!model.get('type') && model.get(options.schema.id) instanceof Backbone.Model) {
model = model.get(options.schema.id);
}

var orientation = (parseInt(model.get('width'), 10) > parseInt(model.get('height'), 10)) ? 'landscape' : 'portrait';
var type = (model.get('type')) ? model.get('type').substring(0, model.get('type').indexOf('/')) : '';
var subtype = model.getSubType(true);
Expand Down

0 comments on commit d276677

Please sign in to comment.