From 533ce3898ee66ea9a2447db9fba608ba9c88dec7 Mon Sep 17 00:00:00 2001 From: Daryl Hedley Date: Tue, 12 May 2015 16:49:53 +0100 Subject: [PATCH 1/2] Some other fixes to tags not allowing images to save --- frontend/src/core/project/models/projectModel.js | 6 +++++- frontend/src/core/scaffold/views/scaffoldAssetView.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/core/project/models/projectModel.js b/frontend/src/core/project/models/projectModel.js index 014ad929bb..2b0e5f2704 100644 --- a/frontend/src/core/project/models/projectModel.js +++ b/frontend/src/core/project/models/projectModel.js @@ -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', @@ -15,6 +16,9 @@ define(function(require) { _type: 'course' }, + initialize : function(options) { + }, + getHeroImageURI: function () { return '/api/asset/serve/' + this.get('heroImage'); }, diff --git a/frontend/src/core/scaffold/views/scaffoldAssetView.js b/frontend/src/core/scaffold/views/scaffoldAssetView.js index cf4eb4e6e9..3fbddc1979 100644 --- a/frontend/src/core/scaffold/views/scaffoldAssetView.js +++ b/frontend/src/core/scaffold/views/scaffoldAssetView.js @@ -274,6 +274,7 @@ define(function(require) { if (alternativeAttribute) { attributesToSave[alternativeAttribute] = Origin.scaffold.getCurrentModel().attributes; } else { + currentModel.unset('tags'); attributesToSave = null; } From 42f87df0e9446fe65fd5de3b7d4dc2a5a949f92c Mon Sep 17 00:00:00 2001 From: Daryl Hedley Date: Tue, 12 May 2015 17:09:06 +0100 Subject: [PATCH 2/2] Fixes to hero image not saving properly --- frontend/src/core/project/less/project.less | 6 ++++++ frontend/src/core/project/views/projectDetailView.js | 1 + frontend/src/core/scaffold/views/scaffoldAssetView.js | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/core/project/less/project.less b/frontend/src/core/project/less/project.less index 4c64d9df24..19dcc9f8ee 100644 --- a/frontend/src/core/project/less/project.less +++ b/frontend/src/core/project/less/project.less @@ -167,6 +167,12 @@ } } +.project-detail-hide-hero { + .field-hero-image { + display:none; + } +} + .project-settings-inner { padding: 7px 6px; diff --git a/frontend/src/core/project/views/projectDetailView.js b/frontend/src/core/project/views/projectDetailView.js index ef57c11ff0..457dd75f33 100644 --- a/frontend/src/core/project/views/projectDetailView.js +++ b/frontend/src/core/project/views/projectDetailView.js @@ -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', []); } diff --git a/frontend/src/core/scaffold/views/scaffoldAssetView.js b/frontend/src/core/scaffold/views/scaffoldAssetView.js index 3fbddc1979..999af1d1d9 100644 --- a/frontend/src/core/scaffold/views/scaffoldAssetView.js +++ b/frontend/src/core/scaffold/views/scaffoldAssetView.js @@ -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'); @@ -148,7 +148,7 @@ define(function(require) { if ('heroImage' === this.key){ this.setValue(data.assetId); - this.saveModel(true); + this.saveModel(false); return; } // Setup courseasset