forked from adaptlearning/adapt_authoring
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editor performance improvements (adaptlearning#1798)
* Rename model attributes * Remove unnecessary collections from editor data * Update attribute references * Remove unused functions * Update models to use actual collection item names * Refactor editor menu code to allow for async loading * Stop re-rendering if item already selected * Remove references to unused model attributes * Improve comments * Stop code executing for each item * Refactor get functions * Remove unused bits * Fix various issues * Remove unused imports * Refactor to only call listenTo once * Update ContentModel to return children as array Due to issue with Backbone.Collections and multiple model types * Remove unused cut functionality * Remove unused code * Update component render to work with async code * Handle re-rendering in parent * Make re-render async * Fix model accessor * Remove unused imports * Simplify component delete code * Stop fetchSiblings from returning self * Add data-id to all editorOriginViews for convenience * Removed unused ‘ancestors’ code * Fix page getter * Refactor new block code * Refactor layout code * Make destroy async to ensure we catch any errors * Refactor for brevity * Refactor block rendering for readability * Refactor new article code * Remove sibling fetch * Fix server copy/paste * Remove unused var * Remove unused route * Remove unused sync classes * Allow for proper async rendering in page views * Fix whitespace * Refactor for readability * Remove logs * Remove asset URL helpers As they’re now async… * Fix courseassets * Fix async course validation * Remove noisy warning * Remove log * Fix scope issue * Fix issue with external assets * Move stuff around * Remove spaghetti logic from scaffoldAsset template * Remove log * Remove log * Stop unnecessary 404 errors * Fix courseassets clean-up * Improve helper to allow for iterators which modify the original list * Improve performance * Make content fetches run in parallel * Make helper parallel * Improve page editor rendering time * Remove mandatory fetch from contentModel.initialize * Make sure model is fetched before rendering * Remove unused import * Move async rendering to EditorPageBlockView * Remove client clipboard data Clipboard data now automatically deleted by back-end * Fix issue with hidden blocks * Fix issues * Make content fetches run in parallel * Make helper parallel * Improve page editor rendering time * Remove mandatory fetch from contentModel.initialize * Make sure model is fetched before rendering * Remove unused import * Move async rendering to EditorPageBlockView * Remove client clipboard data Clipboard data now automatically deleted by back-end * Fix issue with hidden blocks * Add mid-render style to editor page blocks * Fix preview with popup blockers * Stop page re-rendering on paste * Remove logs * Handle destroy async * Fix menu layer rendering for new/removed COs * Make rendering series * Fix menu item state restoration * Fix merge issues * Don’t break for components with no supportedLayout * Move async fetch code to index so scaffold can render correctly Added a multi-fetch convenience method * Refactor for readability * Fix var reference * Update error messages
- Loading branch information
Showing
37 changed files
with
1,354 additions
and
1,515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// LICENCE https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE | ||
define(function(require) { | ||
var Backbone = require('backbone'); | ||
var Origin = require('core/origin'); | ||
var Helpers = require('core/helpers'); | ||
|
||
var ContentCollection = Backbone.Collection.extend({ | ||
initialize : function(models, options) { | ||
this._type = options._type; | ||
this.model = Helpers.contentModelMap(this._type); | ||
this._courseId = options._courseId; | ||
this._parentId = options._parentId; | ||
this.url = options.url || 'api/content/' + options._type + this.buildQuery(); | ||
|
||
this.on('reset', this.loadedData, this); | ||
}, | ||
|
||
buildQuery: function() { | ||
var query = ''; | ||
if(this._courseId) { | ||
query += '_courseId=' + this._courseId | ||
} | ||
if(this._parentId) { | ||
query += '_parentId=' + this._parentId | ||
} | ||
return query ? '?' + query : ''; | ||
}, | ||
|
||
loadedData: function() { | ||
Origin.trigger('contentCollection:dataLoaded', this._type); | ||
} | ||
}); | ||
|
||
return ContentCollection; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.