Ordered Index done
This commit is contained in:
1 parent
c35f0d04a7
commit
10ba789cfc
2 files changed
+34
-11
No files matched your search
@@ -905,7 +905,7 @@ function newSuperalgosDocSpace() {
|
||||
function addTopic(project, topic, type, pageNumber) {
|
||||
let template = {
|
||||
topic: topic,
|
||||
pageNumber: pageNumber,
|
||||
pageNumber: pageNumber,
|
||||
type: type,
|
||||
definition: "Write here the definition of this Concept.",
|
||||
paragraphs: [
|
||||
@@ -920,7 +920,7 @@ function newSuperalgosDocSpace() {
|
||||
return
|
||||
}
|
||||
SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema.push(template)
|
||||
SCHEMAS_BY_PROJECT.get(project).map.docsTopicSchema.set(topic + ' ' + type, template)
|
||||
SCHEMAS_BY_PROJECT.get(project).map.docsTopicSchema.set(type, template)
|
||||
navigateTo('Topic', type, project)
|
||||
}
|
||||
}
|
||||
@@ -1408,24 +1408,47 @@ function newSuperalgosDocSpace() {
|
||||
renderParagraph(paragraph, key)
|
||||
paragraphIndex++
|
||||
|
||||
let orderedIndexArray = []
|
||||
let schemaArray = SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).array.docsTopicSchema
|
||||
for (let i = 0; i < schemaArray.length; i++) {
|
||||
let arrayItem = schemaArray[i]
|
||||
|
||||
if (arrayItem.topic === schemaDocument.topic) {
|
||||
|
||||
paragraph
|
||||
key = 'auto-generated-index-paragraph-' + paragraphIndex
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "" + arrayItem.pageNumber + '. ' + arrayItem.type + ""
|
||||
let itemAdded = false
|
||||
if (orderedIndexArray.length === 0) {
|
||||
orderedIndexArray.push(arrayItem)
|
||||
itemAdded = true
|
||||
} else {
|
||||
for (let j = 0; j < orderedIndexArray.length; j++) {
|
||||
let orderedArrayItem = orderedIndexArray[j]
|
||||
if (arrayItem.pageNumber < orderedArrayItem.pageNumber) {
|
||||
orderedIndexArray.splice(j, 0, arrayItem)
|
||||
itemAdded = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
paragraphIndex++
|
||||
HTML = HTML + '<p><a onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + 'Topic' + '\', \'' + arrayItem.type + '\', \'' + objectBeingRendered.project + '\')" class="docs-topic-index-link">' + paragraph.text + '</a></p>'
|
||||
if (itemAdded === false) {
|
||||
orderedIndexArray.push(arrayItem)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < orderedIndexArray.length; i++) {
|
||||
let arrayItem = orderedIndexArray[i]
|
||||
paragraph
|
||||
key = 'auto-generated-index-paragraph-' + paragraphIndex
|
||||
paragraph = {
|
||||
style: "Title",
|
||||
text: "" + arrayItem.pageNumber + '. ' + arrayItem.type + ""
|
||||
}
|
||||
paragraphIndex++
|
||||
HTML = HTML + '<p><a onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + 'Topic' + '\', \'' + arrayItem.type + '\', \'' + objectBeingRendered.project + '\')" class="docs-topic-index-link">' + paragraph.text + '</a></p>'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addContent() {
|
||||
HTML = HTML + '<div id="docs-content">'
|
||||
if (schemaDocument.paragraphs !== undefined) {
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ function newAppPostLoader() {
|
||||
|
||||
for (let j = 0; j < schemas.array.docsTopicSchema.length; j++) {
|
||||
let schemaDocument = schemas.array.docsTopicSchema[j]
|
||||
let key = schemaDocument.topic + ' ' + schemaDocument.type
|
||||
let key = schemaDocument.type
|
||||
schemas.map.docsTopicSchema.set(key, schemaDocument)
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user