From b0de0dcfd30d567464ee573cbd5c7e263784ee87 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 11 Jan 2021 20:28:39 +0100 Subject: [PATCH] Repaginate working --- ... commands-007-docs repaginate command.json | 44 +++++++++++++++++++ .../Docs-Topics/vaina-001-vaina 1.json | 15 ------- .../Docs-Topics/vaina-002-vaina 2.json | 15 ------- .../Docs-Topics/vaina-003-vaina 3.json | 15 ------- .../Docs-Topics/vaina-004-vaina 4.json | 15 ------- .../Docs-Topics/vaina-005-vaina 5.json | 15 ------- .../Docs-Topics/vaina-006-vaina 2.5.json | 15 ------- .../UI/Spaces/Docs-Space/CommandInterface.js | 24 ++++------ 8 files changed, 53 insertions(+), 105 deletions(-) create mode 100644 Projects/Superalgos/Schemas/Docs-Topics/docs commands-007-docs repaginate command.json delete mode 100644 Projects/Superalgos/Schemas/Docs-Topics/vaina-001-vaina 1.json delete mode 100644 Projects/Superalgos/Schemas/Docs-Topics/vaina-002-vaina 2.json delete mode 100644 Projects/Superalgos/Schemas/Docs-Topics/vaina-003-vaina 3.json delete mode 100644 Projects/Superalgos/Schemas/Docs-Topics/vaina-004-vaina 4.json delete mode 100644 Projects/Superalgos/Schemas/Docs-Topics/vaina-005-vaina 5.json delete mode 100644 Projects/Superalgos/Schemas/Docs-Topics/vaina-006-vaina 2.5.json diff --git a/Projects/Superalgos/Schemas/Docs-Topics/docs commands-007-docs repaginate command.json b/Projects/Superalgos/Schemas/Docs-Topics/docs commands-007-docs repaginate command.json new file mode 100644 index 000000000..0058cce8f --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/docs commands-007-docs repaginate command.json @@ -0,0 +1,44 @@ +{ + "topic": "Docs Commands", + "pageNumber": "7", + "type": "Docs Repaginate Command", + "definition": { + "text": "When you add a Docs Topic Page or a Docs Tutorial Page, you define the page number for it, that is will ultimately defines the position of the page within that topic or tutorial table of contents. The technique to add a page in-between other pages is to use decimal values. After that you can use the Repaginate command in order to recalculate all page numbers and leave the whole set with integer numbers.", + "updated": 1610392867410 + }, + "paragraphs": [ + { + "style": "Title", + "text": "Syntax", + "updated": 1610393031768 + }, + { + "style": "Javascript", + "text": "docs.repaginate Category from Project: Topic or Tutorial name." + }, + { + "style": "Title", + "text": "Properties" + }, + { + "style": "List", + "text": "Category: It must be either Topic or Tutorial." + }, + { + "style": "List", + "text": "Project: Any existing already integrated project." + }, + { + "style": "List", + "text": "Topic or Tutorial name: The name given tu the Topic or Tutorial that you want to repaginate." + }, + { + "style": "Title", + "text": "Example" + }, + { + "style": "Javascript", + "text": "docs.repaginate Topic from Superalgos: Docs Commands" + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-001-vaina 1.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-001-vaina 1.json deleted file mode 100644 index faefa0791..000000000 --- a/Projects/Superalgos/Schemas/Docs-Topics/vaina-001-vaina 1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "topic": "Vaina", - "pageNumber": 1, - "type": "Vaina 1", - "definition": { - "text": "Write here a summary for this topic page." - }, - "paragraphs": [ - { - "style": "Text", - "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 1", - "updated": 1610381133258 - } - ] -} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-002-vaina 2.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-002-vaina 2.json deleted file mode 100644 index fb2c461f4..000000000 --- a/Projects/Superalgos/Schemas/Docs-Topics/vaina-002-vaina 2.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "topic": "Vaina", - "pageNumber": 2, - "type": "Vaina 2", - "definition": { - "text": "Write here a summary for this topic page." - }, - "paragraphs": [ - { - "style": "Text", - "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 2", - "updated": 1610381139634 - } - ] -} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-003-vaina 3.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-003-vaina 3.json deleted file mode 100644 index 4e8e85a64..000000000 --- a/Projects/Superalgos/Schemas/Docs-Topics/vaina-003-vaina 3.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "topic": "Vaina", - "pageNumber": 3, - "type": "Vaina 3", - "definition": { - "text": "Write here a summary for this topic page." - }, - "paragraphs": [ - { - "style": "Text", - "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 3", - "updated": 1610381169574 - } - ] -} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-004-vaina 4.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-004-vaina 4.json deleted file mode 100644 index b49dd0a5e..000000000 --- a/Projects/Superalgos/Schemas/Docs-Topics/vaina-004-vaina 4.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "topic": "Vaina", - "pageNumber": 4, - "type": "Vaina 4", - "definition": { - "text": "Write here a summary for this topic page." - }, - "paragraphs": [ - { - "style": "Text", - "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 4", - "updated": 1610381177981 - } - ] -} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-005-vaina 5.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-005-vaina 5.json deleted file mode 100644 index 2167e21b0..000000000 --- a/Projects/Superalgos/Schemas/Docs-Topics/vaina-005-vaina 5.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "topic": "Vaina", - "pageNumber": 5, - "type": "Vaina 5", - "definition": { - "text": "Write here a summary for this topic page." - }, - "paragraphs": [ - { - "style": "Text", - "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 5", - "updated": 1610381184235 - } - ] -} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-006-vaina 2.5.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-006-vaina 2.5.json deleted file mode 100644 index ccbf6d0d6..000000000 --- a/Projects/Superalgos/Schemas/Docs-Topics/vaina-006-vaina 2.5.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "topic": "Vaina", - "pageNumber": 6, - "type": "Vaina 2.5", - "definition": { - "text": "Write here a summary for this topic page." - }, - "paragraphs": [ - { - "style": "Text", - "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 2.5", - "updated": 1610381151723 - } - ] -} \ No newline at end of file diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js b/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js index 913406141..99a19161b 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js @@ -544,28 +544,22 @@ function newSuperalgosDocsCommmandInterface() { return } - let docsSchema - switch (category) { - case 'Topic': { - docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema - break - } - case 'Tutorial': { - docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsTutorialSchema - break - } - } + let orderedArray = UI.projects.superalgos.utilities.docs.buildOrderedPageIndex( + project, + category, + query + ) let pageNumber = 1 - for (let i = 0; i < docsSchema.length; i++) { - schemaDocument = docsSchema[i] + for (let i = 0; i < orderedArray.length; i++) { + schemaDocument = orderedArray[i] switch (category) { case 'Topic': { if (schemaDocument.topic === query) { schemaDocument.pageNumber = pageNumber pageNumber++ schemaDocument.updated = true - } + } break } case 'Tutorial': { @@ -573,7 +567,7 @@ function newSuperalgosDocsCommmandInterface() { schemaDocument.pageNumber = pageNumber pageNumber++ schemaDocument.updated = true - } + } break } }