Tutorial Migration Working

This commit is contained in:
Luis Fernando Molina committed 2021-01-08 09:46:29 +01:00
1 parent 1c4ebd8826
commit 562046d5b1
2 files changed
+44 -19

No files matched your search

@@ -197,8 +197,18 @@ function newSuperalgosDocsDocumentPage() {
definitionText = definitionText + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(docsSchemaDocument.definition)
/* We will test if we can draw an image here or not*/
let testElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(project, type)
let testElement
if (docsSchemaDocument.definition.icon !== undefined) {
testElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(docsSchemaDocument.definition.icon.project, docsSchemaDocument.definition.icon.name)
} else {
testElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(project, type)
}
/*
For nodes we always render a Definition Table, since we assume
each node will have an icon. For the rest only if we could load an
image we use a table, otherwise we will render the definitaion as a Summary.
*/
if ((category === 'Topic' || category === 'Tutorial' || category === 'Concept' || category === 'Book') && testElement === undefined) {
HTML = HTML + '<div id="definition-summary-editable-paragraph" class="docs-summary"><b>Summary:</b> ' + UI.projects.superalgos.utilities.docs.addToolTips(definitionText, UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) + '</div>'
} else {
@@ -208,7 +218,8 @@ function newSuperalgosDocsDocumentPage() {
div: 'definition-image-div-' + definitionImagesArray.length,
project: project,
category: category,
type: type
type: type,
icon: docsSchemaDocument.definition.icon // if exists, this will override the default that is taking the image from the doc project / type.
}
definitionImagesArray.push(imageItem)
@@ -386,7 +397,7 @@ function newSuperalgosDocsDocumentPage() {
}
key = 'error-paragraph-' + autoGeneratedParagraphIndex
renderParagraph(paragraph, key)
autoGeneratedParagraphIndex++
autoGeneratedParagraphIndex++
}
break
}
@@ -513,7 +524,7 @@ function newSuperalgosDocsDocumentPage() {
let category = splittedChapterText[2]
let chapterName = splittedChapterText[3]
let introText = splittedChapterText[4]
if (project === undefined || category === undefined || chapterNumber === undefined || chapterName === undefined) {
return 'Chapter paragraph style Syntax Error. Some of the required parameters are undefined. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
}
@@ -526,13 +537,13 @@ function newSuperalgosDocsDocumentPage() {
return 'Category must be either Topic or Tutorial. Found: <i>' + category + '</i>'
}
switch(category) {
switch (category) {
case 'Topic': {
buildOrderedTopicPageIndex(chapterName)
if (orderedTopicPageIndexArray.length === 0) {
return 'Chapter paragraph style Syntax Error. The Topic <i>' + chapterName + '</i> could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
}
}
break
}
case 'Tutorial': {
@@ -540,7 +551,7 @@ function newSuperalgosDocsDocumentPage() {
if (orderedTutorialPageIndexArray.length === 0) {
return 'Chapter paragraph style Syntax Error. The Tutorial <i>' + chapterName + '</i> could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
}
}
break
}
}
@@ -562,8 +573,8 @@ function newSuperalgosDocsDocumentPage() {
renderParagraph(paragraph, key)
autoGeneratedParagraphIndex++
}
switch(category) {
switch (category) {
case 'Topic': {
generateTopicMultiPageIndex()
break
@@ -603,7 +614,13 @@ function newSuperalgosDocsDocumentPage() {
let imageName = appSchemaDocument.type.toLowerCase().replaceAll(' ', '-')
imageElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(imageItem.project, imageName)
} else {
imageElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(imageItem.project, imageItem.type)
if (imageItem.icon === undefined) {
/* This is the default behavious */
imageElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(imageItem.project, imageItem.type)
} else {
/* Here we take the image from the icon specification */
imageElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(imageItem.icon.project, imageItem.icon.name)
}
}
imageElement.width = "150"
@@ -1538,7 +1555,7 @@ function newSuperalgosDocsDocumentPage() {
innerHTML = paragraph.text
break
}
case 'Chapter': {
case 'Chapter': {
styleClass = 'class="docs-chapter"'
prefix = ''
role = ''
@@ -271,14 +271,15 @@ function newSuperalgosTutorialSpace() {
/*
This forces the tutorial to close the documentation panel and to keep it closed.
*/
UI.projects.superalgos.spaces.docsSpace.sidePanelTab.close()
UI.projects.superalgos.spaces.docsSpace.sidePanelTab.open() // TODO
// UI.projects.superalgos.spaces.docsSpace.sidePanelTab.close()
return
}
UI.projects.superalgos.spaces.docsSpace.sidePanelTab.open()
if (newDocumentationURL === currentDocumentationURL) { return }
currentDocumentationURL = newDocumentationURL
console.log('Trying to navigate to: ' + currentDocumentationURL + ' at ' + config.subTitle)
console.log('Trying to navigate to: ' + currentDocumentationURL + ' at ' + config.subTitle)
// TODO UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo('Superalgos', 'Node', currentDocumentationURL)
}
}
@@ -307,7 +308,7 @@ function newSuperalgosTutorialSpace() {
This forces the tutorial to open the workspaces panel and to keep it closed.
*/
if (workspacesCounter === 5) {
UI.projects.superalgos.spaces.sideSpace.sidePanelTab.open()
UI.projects.superalgos.spaces.sideSpace.sidePanelTab.close() // TODO .open()
}
return
}
@@ -330,7 +331,7 @@ function newSuperalgosTutorialSpace() {
/*
This forces the tutorial to close the charting space and to keep it closed.
*/
UI.projects.superalgos.spaces.cockpitSpace.toTop()
UI.projects.superalgos.spaces.cockpitSpace.toTop() // TODO .toTop()
return
}
case "toMiddle": {
@@ -338,14 +339,14 @@ function newSuperalgosTutorialSpace() {
This forces the tutorial to share the screen half with the designer and half
with the charting space and force it in that way.
*/
UI.projects.superalgos.spaces.cockpitSpace.toMiddle()
UI.projects.superalgos.spaces.cockpitSpace.toTop() // TODO toMiddle()
return
}
case "toBottom": {
/*
This forces the tutorial to fully open the charting space and to keep it open.
*/
UI.projects.superalgos.spaces.cockpitSpace.toBottom()
UI.projects.superalgos.spaces.cockpitSpace.toTop() // TODO
return
}
}
@@ -663,6 +664,7 @@ function newSuperalgosTutorialSpace() {
return
}
nodeConfig.position = 'Left' // TODO
switch (nodeConfig.position) {
case 'Left': {
tutorialPosition = {
@@ -1125,7 +1127,13 @@ function newSuperalgosTutorialSpace() {
tutorial: TUTORIAL_NAME,
pageNumber: PAGE_NUMBER,
type: currentNode.type + ' - ' + nodeConfig.subTitle,
definition: { text: "Write here a summary for this tutorial page." },
definition: {
icon: {
project: 'Superalgos',
name: nodeConfig.image
},
text: "Write here a summary for this tutorial page."
},
paragraphs: [
]
@@ -1241,7 +1249,7 @@ function newSuperalgosTutorialSpace() {
SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema.push(template)
SCHEMAS_BY_PROJECT.get(project).map.docsTutorialSchema.set(template.type, template)
//UI.projects.superalgos.spaces.docsSpace.navigateTo(project, 'Tutorial', template.type)
UI.projects.superalgos.spaces.docsSpace.navigateTo(project, 'Tutorial', template.type)
function clean(text) {
let result = text