From dbdb9bf3a9632d574be845b725758a6bfde7d135 Mon Sep 17 00:00:00 2001 From: Chuck Lorenz Date: Tue, 18 Apr 2017 06:21:55 -0500 Subject: [PATCH 1/2] Update header format --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dcfc5b5664..f3c7a4c083 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Interested? [See what Adapt can do.](https://community.adaptlearning.org/demo2/i * Supports all core extensions and components * Allows uploading and linking of course assets -##Full Documentation +## Full Documentation [Visit the wiki](https://github.com/adaptlearning/adapt_authoring/wiki) for full documentation, including [installation](https://github.com/adaptlearning/adapt_authoring/wiki/Installing-the-Authoring-Tool), course authoring, developer guides, and other information. ## Communication @@ -38,4 +38,4 @@ See [Contributing to the Adapt authoring tool](https://github.com/adaptlearning/ + To provide feedback, please use the [GitHub Issues](https://github.com/adaptlearning/adapt_authoring/issues). ## License -adapt learning logo Adapt is licensed under the [GNU General Public License, Version 3](https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE). \ No newline at end of file +adapt learning logo Adapt is licensed under the [GNU General Public License, Version 3](https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE). From ebd3396533d350c6a8dc7cd553ed0da4d2c1e070 Mon Sep 17 00:00:00 2001 From: danielstorey Date: Tue, 2 May 2017 13:37:41 +0100 Subject: [PATCH 2/2] fixes #1611 (#1612) * Fix component layout options * Fix component layout options * Fix component layout options * Check remaining available positions in block as well as _supportedLayout --- .../page/views/editorComponentListView.js | 26 +++++----- .../editor/page/views/editorComponentView.js | 48 ++++++++++++------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/frontend/src/core/editor/page/views/editorComponentListView.js b/frontend/src/core/editor/page/views/editorComponentListView.js index af12ce97de..d4f32dd751 100644 --- a/frontend/src/core/editor/page/views/editorComponentListView.js +++ b/frontend/src/core/editor/page/views/editorComponentListView.js @@ -77,30 +77,32 @@ define(function(require) { renderComponentList: function() { Origin.trigger('editorComponentListView:removeSubviews'); // _.each(this.collection, function(componentType) { + this.collection.each(function(componentType) { var properties = componentType.get('properties'); - if (properties && properties.hasOwnProperty('._supportedLayout')) { - var supportedLayout = properties.hasOwnProperty('._supportedLayout').enum; + if (properties && properties.hasOwnProperty('_supportedLayout')) { + var supportedLayout = properties._supportedLayout.enum; + var availablePositions = _.clone(this.availablePositions); // Prune the available positions if (_.indexOf(supportedLayout, 'half-width') == -1) { - this.availablePositions.left = false; - this.availablePositions.right = false; + availablePositions.left = false; + availablePositions.right = false; } if (_.indexOf(supportedLayout, 'full-width') == -1) { - this.availablePositions.full = false; + availablePositions.full = false; } } this.$('.editor-component-list-sidebar-list').append(new EditorComponentListItemView({ - model: componentType, - availablePositions: this.availablePositions, - _parentId: this.model.get('_parentId'), - $parentElement: this.$parentElement, - parentView: this.parentView, - searchTerms: componentType.get('displayName').toLowerCase() - }).$el); + model: componentType, + availablePositions: availablePositions, + _parentId: this.model.get('_parentId'), + $parentElement: this.$parentElement, + parentView: this.parentView, + searchTerms: componentType.get('displayName').toLowerCase() + }).$el); }, this); }, diff --git a/frontend/src/core/editor/page/views/editorComponentView.js b/frontend/src/core/editor/page/views/editorComponentView.js index d5ebbe24ee..abfc4d1e98 100644 --- a/frontend/src/core/editor/page/views/editorComponentView.js +++ b/frontend/src/core/editor/page/views/editorComponentView.js @@ -29,7 +29,7 @@ define(function(require){ this.on('contextMenu:component:edit', this.loadComponentEdit); this.on('contextMenu:component:copy', this.onCopy); - this.on('contextMenu:component:copyID', this.onCopyID), + this.on('contextMenu:component:copyID', this.onCopyID); this.on('contextMenu:component:cut', this.onCut); this.on('contextMenu:component:delete', this.deleteComponentPrompt); }, @@ -145,28 +145,40 @@ define(function(require){ }, evaluateLayout: function() { + + var componentType = _.find(Origin.editor.data.componentTypes.models, function(type){ + return type.get('component') == this.model.get('_component'); + }, this); + + var supportedLayout = componentType.get("properties")._supportedLayout; + var isFullWidthSupported = _.indexOf(supportedLayout.enum, "full-width") > -1; + var isHalfWidthSupported = _.indexOf(supportedLayout.enum, "half-width") > -1; + var movePositions = { left: false, right: false, full: false }; - var siblings = this.model.getSiblings(); - var showFull = !siblings.length; - var type = this.model.get('_layout'); - switch (type) { - case 'left': - movePositions.right = true; - movePositions.full = showFull; - break; - case 'right': - movePositions.left = true; - movePositions.full = showFull; - break; - case 'full': - movePositions.left = true; - movePositions.right = true; - break + if (isHalfWidthSupported) { + var siblings = this.model.getSiblings(); + var showFull = !siblings.length && isFullWidthSupported; + var type = this.model.get('_layout'); + + switch (type) { + case 'left': + movePositions.right = true; + movePositions.full = showFull; + break; + case 'right': + movePositions.left = true; + movePositions.full = showFull; + break; + case 'full': + movePositions.left = true; + movePositions.right = true; + break + } } this.model.set('_movePositions', movePositions); @@ -262,4 +274,4 @@ define(function(require){ return EditorComponentView; -}); +}); \ No newline at end of file