Skip to content

Commit

Permalink
Issue #SB-5876 merge: Merge pull request #13 from project-sunbird/pra…
Browse files Browse the repository at this point in the history
…gma_changes

Pragma changes
  • Loading branch information
vinukumar-vs authored Sep 6, 2018
2 parents 8b31d4a + 064b8f3 commit 5b90c8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/scripts/contenteditor/base-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,5 +810,10 @@ org.ekstep.contenteditor.basePlugin = Class.extend({
* this method to return custom summary object.
* @memberof org.ekstep.contenteditor.basePlugin
*/
getSummary: function () {}
getSummary: function () {},
/**
* Returns the content pragma value. This is a no-op implementation. Child plugins should implement
* @memberof org.ekstep.contenteditor.basePlugin
*/
getPragmaValue: function () {}
})
7 changes: 7 additions & 0 deletions app/scripts/contenteditor/manager/stage-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,16 @@ org.ekstep.contenteditor.stageManager = new (Class.extend({
getStageIcons: function () {
return this.thumbnails
},
getPragma: function () {
return ecEditor._.uniq(this.pragma)
},
toECML: function () {
var instance = this
var content = { theme: { id: 'theme', version: '1.0', startStage: this.stages[0].id, stage: [], manifest: { media: [] }, 'plugin-manifest': { plugin: [] } } }
this.setNavigationalParams()
var mediaMap = {}
instance.summary = []
instance.pragma = null
_.forEach(this.stages, function (stage, index) {
instance.thumbnails[stage.id] = stage.thumbnail
var stageBody = stage.toECML()
Expand All @@ -237,6 +241,9 @@ org.ekstep.contenteditor.stageManager = new (Class.extend({
stageBody[id].push(plugin.toECML())
var summaryObj = plugin.getSummary()
if (summaryObj) instance.summary.push(summaryObj)
var pragma = plugin.getPragmaValue()
// if any plugin return pragma value we pushing to array
pragma && ((instance.pragma === null) ? instance.pragma = [pragma] : ecEditor._.uniq(instance.pragma.push(pragma)))
var pluginMedia = plugin.getMedia()
instance.addMediaToMediaMap(mediaMap, pluginMedia, plugin.manifest)
stageAssets = _.concat(stageAssets, _.keys(pluginMedia))
Expand Down

0 comments on commit 5b90c8c

Please sign in to comment.