plugins-functionality #43
|
@ -143,33 +143,30 @@ export class PluginsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
let self = this;
|
let self = this;
|
||||||
this.pluginTemplates.forEach(_ => {
|
this.pluginTemplates.forEach(_ => {
|
||||||
console.log("pl template", _.code, _.custom)
|
|
||||||
let plugin: Plugin = null;
|
let plugin: Plugin = null;
|
||||||
for (let pl of plugins) {
|
if(!_.custom) {
|
||||||
if (pl.templateId == _._id) {
|
|
||||||
plugin = pl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!plugin && !_.custom) {
|
|
||||||
plugin = new Plugin(this.selectedPageId, this.selectedCommunityPid, _);
|
|
||||||
this.plugins.push(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plugin) {
|
|
||||||
console.log("plugin found", plugin.custom)
|
for (let pl of plugins) {
|
||||||
if (plugin.custom) {
|
if (pl.templateId == _._id) {
|
||||||
console.log(plugin, _)
|
plugin = pl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!plugin) {
|
||||||
|
plugin = new Plugin(this.selectedPageId, this.selectedCommunityPid, _);
|
||||||
|
this.plugins.push(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin) {
|
||||||
|
plugin.object = PluginUtils.initializeObjectAndCompare(_.code, plugin.object)
|
||||||
|
this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _, openPreview: false});
|
||||||
}
|
}
|
||||||
plugin.object = PluginUtils.initializeObjectAndCompare(_.code, plugin.object)
|
|
||||||
this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _, openPreview: false});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/* console.log("________", )
|
|
||||||
//add custom plugins in the list
|
//add custom plugins in the list
|
||||||
this.plugins.forEach(_ => {
|
this.plugins.forEach(_ => {
|
||||||
|
|
||||||
if(_.custom){
|
if(_.custom){
|
||||||
console.log("custom plugin", _.templateCode)
|
|
||||||
let customTemplate = null;
|
let customTemplate = null;
|
||||||
this.pluginTemplates.forEach(template => {
|
this.pluginTemplates.forEach(template => {
|
||||||
if (_.templateId == template._id) {
|
if (_.templateId == template._id) {
|
||||||
|
@ -177,13 +174,10 @@ export class PluginsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(customTemplate){
|
if(customTemplate){
|
||||||
console.log("template found!")
|
|
||||||
this.pluginsByPlacement.get(customTemplate.placement).push({plugin: _, template: customTemplate, openPreview: false});
|
this.pluginsByPlacement.get(customTemplate.placement).push({plugin: _, template: customTemplate, openPreview: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
let availablePlacements = [];
|
let availablePlacements = [];
|
||||||
for (let placement of this.pluginUtils.placementsOptions) {
|
for (let placement of this.pluginUtils.placementsOptions) {
|
||||||
if (this.pluginsByPlacement.get(placement.value).length > 0) {
|
if (this.pluginsByPlacement.get(placement.value).length > 0) {
|
||||||
|
|
Loading…
Reference in New Issue