Skip to content

Commit

Permalink
Revert "Filling page-wizard documentation and update style"
Browse files Browse the repository at this point in the history
This reverts commit e55e549.
  • Loading branch information
Kornelia Kobiela committed Jan 20, 2020
1 parent 84b532c commit 2dfbe37
Showing 1 changed file with 43 additions and 39 deletions.
82 changes: 43 additions & 39 deletions design-editor/src/panel/wizards/page-wizard-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ import pathUtils from '../../utils/path-utils';
const CompositeDisposable = editor.CompositeDisposable;
const notificationManager = editor.notifications;

const TEMPLATE_PATH = '/panel/wizards/page-wizard-element.html';
const TEMPLATE_PATH = '/panel/wizards/page-wizard-element.html',
DEFAULT_TEMPLATE_NAME = 'template.html';

/**
* Representing New Page wizard
*
*/
class PageWizard extends DressElement {
/**
* Create callback
* @constructor
*/
/**
* Create callback
*/
onCreated() {
if (!this.initialized) {
this._initialize();
Expand All @@ -49,9 +49,9 @@ class PageWizard extends DressElement {
this.$el.attr('tabindex', '-1');
}

/**
* Initialize variables and event listeners
*/
/**
* Init
*/
_initialize() {
this._appPath = appManager.getAppPath();
this._templateMetadata = {};
Expand Down Expand Up @@ -81,13 +81,14 @@ class PageWizard extends DressElement {
_parseCategories(templateMetadata) {
var data, metadata = templateMetadata._packages;

Object.keys(metadata).forEach((templateName) => {
data = $.extend(true, {}, metadata[templateName].options);
data.id = templateName;
Object.keys(metadata).forEach((templateName) => {
data = $.extend(true, {}, metadata[templateName].options);
data.id = templateName;
data.templateFileName = data.templateFileName || DEFAULT_TEMPLATE_NAME;

if (!this._templateMetadata[data.profile]) {
this._templateMetadata[data.profile] = [];
}
if (!this._templateMetadata[data.profile]) {
this._templateMetadata[data.profile] = [];
}

this._templateMetadata[data.profile].push(data);
});
Expand Down Expand Up @@ -192,30 +193,33 @@ class PageWizard extends DressElement {
);
}

/**
* Set information about newly generated page
*/
_setNewPageInfo() {
const templateConfig = this._getTemplateConfigByPath(this._thumbnailElement.templatePath, this._projectProfile);

if (templateConfig) {
const template = $.ajax({
url: path.join(templateConfig.path, templateConfig.templateFileName),
async: false
}).responseText,
pageName = this._pageNameInputElement.getValue(),
dir = this._pagePathInputElement.path;
this._newPageInfo = {
pageName: pageName,
workSpacePath: dir,
pagePath: path.join(dir, `${pageName}.html`),
templatePath: this._thumbnailElement.templatePath,
template: template
};
} else {
this._newPageInfo = {};
}
}
/**
* Set new page info
*/
_setNewPageInfo() {
var templateConfig = this._getTemplateConfigByPath(this._thumbnailElement.templatePath, this._projectProfile),
template,
pageName = '',
dir = '';

if (templateConfig) {
template = $.ajax({
url: path.join(templateConfig.path, templateConfig.templateFileName),
async: false
}).responseText;
pageName = this._pageNameInputElement.getValue();
dir = this._pagePathInputElement.path;
this._newPageInfo = {
pageName: pageName,
workSpacePath: dir,
pagePath: path.join(dir, pageName + '.html'),
templatePath: this._thumbnailElement.templatePath,
template: template
};
} else {
this._newPageInfo = {};
}
}

/**
* Validate data
Expand Down

0 comments on commit 2dfbe37

Please sign in to comment.