Skip to content

Commit

Permalink
Merge pull request #676 from adaptlearning/issue/#674
Browse files Browse the repository at this point in the history
Some other fixes to tags not allowing images to save
  • Loading branch information
brian-learningpool committed May 12, 2015
2 parents df25a8f + 42f87df commit e07f2bf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions frontend/src/core/project/less/project.less
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@
}
}

.project-detail-hide-hero {
.field-hero-image {
display:none;
}
}

.project-settings-inner {
padding: 7px 6px;

Expand Down
6 changes: 5 additions & 1 deletion frontend/src/core/project/models/projectModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ define(function(require) {

var Backbone = require('backbone');
var Origin = require('coreJS/app/origin');
var EditorModel = require('editorGlobal/models/editorModel');

var ProjectModel = Backbone.Model.extend({
var ProjectModel = EditorModel.extend({

idAttribute: '_id',

Expand All @@ -15,6 +16,9 @@ define(function(require) {
_type: 'course'
},

initialize : function(options) {
},

getHeroImageURI: function () {
return '/api/asset/serve/' + this.get('heroImage');
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/core/project/views/projectDetailView.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ define(function(require) {

if (this.model.isNew()) {
this.isNew = true;
this.$el.addClass('project-detail-hide-hero');
// Initialise the 'tags' property for a new course
this.model.set('tags', []);
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/core/scaffold/views/scaffoldAssetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ define(function(require) {

checkValueHasChanged: function() {
if ('heroImage' === this.key){
this.saveModel(true);
this.saveModel(false);
return;
}
var contentTypeId = Origin.scaffold.getCurrentModel().get('_id');
Expand Down Expand Up @@ -148,7 +148,7 @@ define(function(require) {

if ('heroImage' === this.key){
this.setValue(data.assetId);
this.saveModel(true);
this.saveModel(false);
return;
}
// Setup courseasset
Expand Down Expand Up @@ -274,6 +274,7 @@ define(function(require) {
if (alternativeAttribute) {
attributesToSave[alternativeAttribute] = Origin.scaffold.getCurrentModel().attributes;
} else {
currentModel.unset('tags');
attributesToSave = null;
}

Expand Down

0 comments on commit e07f2bf

Please sign in to comment.