Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for core _globals._extensions properties #2692

Merged
merged 4 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/src/modules/scaffold/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ define([ 'core/origin', './models/schemasModel' ], function(Origin, SchemasModel

// remove unrequired globals from the course
function trimGlobals(schema) {
var corePlugins = [{ targetAttribute: '_drawer' }, { targetAttribute: '_navigation' }]; // HACK to make sure core 'extensions' are included
var globals = schema._globals.properties;
trimDisabledPlugins(globals._extensions, _.values(configModel.get('_enabledExtensions')));
trimDisabledPlugins(globals._extensions, corePlugins.concat(_.values(configModel.get('_enabledExtensions'))));
trimDisabledPlugins(globals._menu, editorData.menutypes.where({ name: configModel.get('_menu') }));
trimDisabledPlugins(globals._theme, editorData.themetypes.where({ name: configModel.get('_theme') }));
// trim off the empty globals objects
Expand Down
14 changes: 14 additions & 0 deletions lib/contentmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,20 @@ ContentManager.prototype.setupRoutes = function () {
logger.log('error', err);
return next(err);
}
// HACK to include core extensions globals schema and add titles

const coreExtensionGlobalProperties = that._contentSchemas.course.properties._globals.properties?._extensions?.properties;

if(coreExtensionGlobalProperties) {
const coreExtensionsGlobals = {
properties: coreExtensionGlobalProperties,
title: "Extensions"
}
Object.assign(schemas.course._globals.properties._extensions, coreExtensionsGlobals);
}

schemas.course._globals.properties._components.title = "Components";

res.status(200).json(schemas);
});
});
Expand Down