From 6e55f5254ba4a8d962a3f3f80ad8fbf8ede34b72 Mon Sep 17 00:00:00 2001 From: Yann Tavernier Date: Wed, 17 Feb 2021 16:17:03 +0100 Subject: [PATCH] feat: global markdown template pages --- src/assets/logo_markdown_template.svg | 10 ++++ src/assets/logo_markdown_template_old2.svg | 6 +++ src/assets/logo_markdown_templateold.svg | 24 +++++++++ .../documentation-management.component.ts | 17 +++++- .../documentation-management.html | 18 +++++-- .../documentation/edit-page.component.ts | 15 +++++- src/components/documentation/edit-page.html | 27 +++++----- .../documentation/new-page.component.ts | 53 ++++++++++++++++++- src/components/documentation/new-page.html | 45 +++++++++++----- src/components/documentation/page/_page.scss | 9 ++++ .../page/page-editormarkdown.component.ts | 10 ++++ .../page/page-editormarkdown.html | 2 +- .../documentation/page/page.component.ts | 5 ++ src/components/documentation/page/page.html | 5 +- src/index.scss | 4 ++ src/services/documentation.service.ts | 29 +++++++--- src/services/environment.service.ts | 18 +++---- 17 files changed, 240 insertions(+), 57 deletions(-) create mode 100644 src/assets/logo_markdown_template.svg create mode 100644 src/assets/logo_markdown_template_old2.svg create mode 100644 src/assets/logo_markdown_templateold.svg diff --git a/src/assets/logo_markdown_template.svg b/src/assets/logo_markdown_template.svg new file mode 100644 index 0000000000..865a71372e --- /dev/null +++ b/src/assets/logo_markdown_template.svg @@ -0,0 +1,10 @@ + + + + + + diff --git a/src/assets/logo_markdown_template_old2.svg b/src/assets/logo_markdown_template_old2.svg new file mode 100644 index 0000000000..9175aef11e --- /dev/null +++ b/src/assets/logo_markdown_template_old2.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/assets/logo_markdown_templateold.svg b/src/assets/logo_markdown_templateold.svg new file mode 100644 index 0000000000..d173cbec65 --- /dev/null +++ b/src/assets/logo_markdown_templateold.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/documentation/documentation-management.component.ts b/src/components/documentation/documentation-management.component.ts index d5c2efe4b6..a6430ce965 100644 --- a/src/components/documentation/documentation-management.component.ts +++ b/src/components/documentation/documentation-management.component.ts @@ -15,7 +15,12 @@ */ import NotificationService from '../../services/notification.service'; -import DocumentationService, {DocumentationQuery, FolderSituation, SystemFolderName} from '../../services/documentation.service'; +import DocumentationService, { + DocumentationQuery, + FolderSituation, + PageType, + SystemFolderName +} from '../../services/documentation.service'; import {StateService} from '@uirouter/core'; import _ = require('lodash'); import {IScope} from 'angular'; @@ -53,12 +58,20 @@ const DocumentationManagementComponent: ng.IComponentOptions = { this.systemFoldersById = _.keyBy(this.systemFolders, 'id'); this.currentFolder = this.getFolder(this.rootDir); - this.supportedTypes = DocumentationService.supportedTypes(this.getFolderSituation(this.rootDir)); + this.supportedTypes = DocumentationService + .supportedTypes(this.getFolderSituation(this.rootDir)) + .filter(type => !this.apiId || type !== PageType.MARKDOWN_TEMPLATE); this.breadcrumb = this.generateBreadcrumb(); $scope.renameFolder = false; $scope.translateFolder = false; }; + this.isFolder = (type: string): boolean => PageType.FOLDER === type; + this.isLink = (type: string): boolean => PageType.LINK === type; + this.isSwagger = (type: string): boolean => PageType.SWAGGER === type; + this.isMarkdown = (type: string): boolean => PageType.MARKDOWN === type; + this.isMarkdownTemplate = (type: string): boolean => PageType.MARKDOWN_TEMPLATE === type; + this.getFolderSituation = (folderId: string) => { if (!folderId) { return FolderSituation.ROOT; diff --git a/src/components/documentation/documentation-management.html b/src/components/documentation/documentation-management.html index a89e250b8e..cc6ba77b60 100644 --- a/src/components/documentation/documentation-management.html +++ b/src/components/documentation/documentation-management.html @@ -110,7 +110,7 @@

- +
- - Publish this page + + {{$ctrl.isMarkdownTemplate(page.type) ? 'Make template available' : 'Publish this page'}} + - - Unpublish this page + + {{$ctrl.isMarkdownTemplate(page.type) ? 'Make template unavailable' : 'Unpublish this page'}} + diff --git a/src/components/documentation/edit-page.component.ts b/src/components/documentation/edit-page.component.ts index e1b7b45588..6341c48bb3 100644 --- a/src/components/documentation/edit-page.component.ts +++ b/src/components/documentation/edit-page.component.ts @@ -15,7 +15,11 @@ */ import NotificationService from '../../services/notification.service'; -import DocumentationService, { FolderSituation, SystemFolderName } from '../../services/documentation.service'; +import DocumentationService, { + FolderSituation, + PageType, + SystemFolderName +} from '../../services/documentation.service'; import { StateService } from '@uirouter/core'; import { IScope } from 'angular'; import UserService from '../../services/user.service'; @@ -126,6 +130,13 @@ const EditPageComponent: ng.IComponentOptions = { }; + this.isFolder = (): boolean => PageType.FOLDER === this.page.type; + this.isLink = (): boolean => PageType.LINK === this.page.type; + this.isSwagger = (): boolean => PageType.SWAGGER === this.page.type; + this.isMarkdown = (): boolean => PageType.MARKDOWN === this.page.type; + this.isMarkdownTemplate = (): boolean => PageType.MARKDOWN_TEMPLATE === this.page.type; + + this.usedAsGeneralConditions = () => { return this.page.generalConditions; }; @@ -143,7 +154,7 @@ const EditPageComponent: ng.IComponentOptions = { parentId: this.page.id, configuration: {} }; - if (this.page.type === 'MARKDOWN' || this.page.type === 'SWAGGER') { + if (this.isMarkdown() || this.isSwagger() || this.isMarkdownTemplate()) { this.currentTranslation.configuration.inheritContent = 'true'; } }; diff --git a/src/components/documentation/edit-page.html b/src/components/documentation/edit-page.html index e07a823774..76dc1e7c05 100644 --- a/src/components/documentation/edit-page.html +++ b/src/components/documentation/edit-page.html @@ -20,7 +20,7 @@

{{$ctrl.page.name}}

- + Inherited @@ -35,7 +35,7 @@

{{$ctrl.page.name}}

class="md-raised md-primary" ng-click="$ctrl.toggleRename()" aria-label="Rename" - ng-if="'LINK' !== $ctrl.page.type || ('LINK' === $ctrl.page.type && (!$ctrl.page.configuration.inherit || $ctrl.page.configuration.inherit === 'false')) "> + ng-if="!$ctrl.isLink() || ($ctrl.isLink() && (!$ctrl.page.configuration.inherit || $ctrl.page.configuration.inherit === 'false')) "> Rename {{$ctrl.page.name}}

-
+

@@ -250,7 +250,7 @@

-
+

@@ -266,7 +266,7 @@

-
+