From 819e993ff32c845ee7d1f89a82f697666edd72f6 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 16 Feb 2017 22:23:44 +0100 Subject: [PATCH] Content pages integrated --- .../CQRS/Events/EventReceiver.cs | 6 ++- src/Squidex/app/features/schemas/module.ts | 8 ++++ .../pages/schema/schema-page.component.html | 3 ++ src/Squidex/app/features/settings/module.ts | 22 +++++++++++ .../pages/clients/clients-page.component.html | 3 ++ .../contributors-page.component.html | 5 ++- .../languages/languages-page.component.html | 3 ++ .../languages/languages-page.component.scss | 2 +- .../app/shared/components/help.component.html | 17 +++++++++ .../app/shared/components/help.component.scss | 6 +++ .../app/shared/components/help.component.ts | 27 ++++++++++++++ .../shared/components/history.component.html | 2 - src/Squidex/app/shared/declarations.ts | 2 + src/Squidex/app/shared/module.ts | 5 +++ .../app/shared/services/auth.service.ts | 1 + .../app/shared/services/help.service.ts | 37 +++++++++++++++++++ src/Squidex/app/theme/_panels.scss | 1 - 17 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 src/Squidex/app/shared/components/help.component.html create mode 100644 src/Squidex/app/shared/components/help.component.scss create mode 100644 src/Squidex/app/shared/components/help.component.ts create mode 100644 src/Squidex/app/shared/services/help.service.ts diff --git a/src/Squidex.Infrastructure/CQRS/Events/EventReceiver.cs b/src/Squidex.Infrastructure/CQRS/Events/EventReceiver.cs index f2c8cfc3b..2b6ec3f08 100644 --- a/src/Squidex.Infrastructure/CQRS/Events/EventReceiver.cs +++ b/src/Squidex.Infrastructure/CQRS/Events/EventReceiver.cs @@ -106,9 +106,9 @@ namespace Squidex.Infrastructure.CQRS.Events } await eventStore.GetEventsAsync(lastHandledEventNumber) - .SelectMany(async storedEvent => + .Select(storedEvent => { - await HandleEventAsync(eventConsumer, storedEvent, consumerName); + HandleEventAsync(eventConsumer, storedEvent, consumerName).Wait(); return storedEvent; }).DefaultIfEmpty(); @@ -156,6 +156,8 @@ namespace Squidex.Infrastructure.CQRS.Events { try { + logger.LogDebug("[{0}]: Handling event {1} ({2})", eventConsumer, @event.Payload, @event.Headers.EventId()); + await eventConsumer.On(@event); logger.LogDebug("[{0}]: Handled event {1} ({2})", eventConsumer, @event.Payload, @event.Headers.EventId()); diff --git a/src/Squidex/app/features/schemas/module.ts b/src/Squidex/app/features/schemas/module.ts index 833199393..ff6cdadbd 100644 --- a/src/Squidex/app/features/schemas/module.ts +++ b/src/Squidex/app/features/schemas/module.ts @@ -9,6 +9,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { + HelpComponent, HistoryComponent, ResolveSchemaGuard, SqxFrameworkModule, @@ -50,6 +51,13 @@ const routes: Routes = [ data: { channel: 'schemas.{schemaName}' } + }, + { + path: 'help', + component: HelpComponent, + data: { + helpPage: '04-guides/schemas' + } } ] }] diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html index 7e726462a..0ded9fb1a 100644 --- a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html +++ b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html @@ -59,6 +59,9 @@ + + + diff --git a/src/Squidex/app/features/settings/module.ts b/src/Squidex/app/features/settings/module.ts index afdbf430f..1fe9edda1 100644 --- a/src/Squidex/app/features/settings/module.ts +++ b/src/Squidex/app/features/settings/module.ts @@ -9,6 +9,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { + HelpComponent, HistoryComponent, SqxFrameworkModule, SqxSharedModule @@ -40,6 +41,13 @@ const routes: Routes = [ data: { channel: 'settings.clients' } + }, + { + path: 'help', + component: HelpComponent, + data: { + helpPage: '04-guides/clients' + } } ] }, { @@ -52,6 +60,13 @@ const routes: Routes = [ data: { channel: 'settings.contributors' } + }, + { + path: 'help', + component: HelpComponent, + data: { + helpPage: '04-guides/contributors' + } } ] }, { @@ -64,6 +79,13 @@ const routes: Routes = [ data: { channel: 'settings.languages' } + }, + { + path: 'help', + component: HelpComponent, + data: { + helpPage: '04-guides/languages' + } } ] } diff --git a/src/Squidex/app/features/settings/pages/clients/clients-page.component.html b/src/Squidex/app/features/settings/pages/clients/clients-page.component.html index 96be5b96e..16d74a829 100644 --- a/src/Squidex/app/features/settings/pages/clients/clients-page.component.html +++ b/src/Squidex/app/features/settings/pages/clients/clients-page.component.html @@ -40,6 +40,9 @@ + + + diff --git a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html index c3eb0137e..136fbab0c 100644 --- a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html +++ b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.html @@ -1,6 +1,6 @@ - +

Contributors

@@ -81,6 +81,9 @@ + + +
diff --git a/src/Squidex/app/features/settings/pages/languages/languages-page.component.html b/src/Squidex/app/features/settings/pages/languages/languages-page.component.html index 7a6b7c529..d643ce081 100644 --- a/src/Squidex/app/features/settings/pages/languages/languages-page.component.html +++ b/src/Squidex/app/features/settings/pages/languages/languages-page.component.html @@ -80,6 +80,9 @@ + + +
diff --git a/src/Squidex/app/features/settings/pages/languages/languages-page.component.scss b/src/Squidex/app/features/settings/pages/languages/languages-page.component.scss index c925f4f94..945e5d6b7 100644 --- a/src/Squidex/app/features/settings/pages/languages/languages-page.component.scss +++ b/src/Squidex/app/features/settings/pages/languages/languages-page.component.scss @@ -8,7 +8,7 @@ sqx-panel { .language { &-select { - max-width: 12rem; + width: 16rem; } &-name { diff --git a/src/Squidex/app/shared/components/help.component.html b/src/Squidex/app/shared/components/help.component.html new file mode 100644 index 000000000..3c3da9f8e --- /dev/null +++ b/src/Squidex/app/shared/components/help.component.html @@ -0,0 +1,17 @@ + +
+
+

Help

+
+ + + + +
+ +
+
+

+
+
+
\ No newline at end of file diff --git a/src/Squidex/app/shared/components/help.component.scss b/src/Squidex/app/shared/components/help.component.scss new file mode 100644 index 000000000..54a83699e --- /dev/null +++ b/src/Squidex/app/shared/components/help.component.scss @@ -0,0 +1,6 @@ +@import '_vars'; +@import '_mixins'; + +p { + font-size: .9rem; +} \ No newline at end of file diff --git a/src/Squidex/app/shared/components/help.component.ts b/src/Squidex/app/shared/components/help.component.ts new file mode 100644 index 000000000..c6ab6de2d --- /dev/null +++ b/src/Squidex/app/shared/components/help.component.ts @@ -0,0 +1,27 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Sebastian Stehle. All rights reserved + */ + +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { HelpService } from './../services/help.service'; + +@Component({ + selector: 'sqx-help', + styleUrls: ['./help.component.scss'], + templateUrl: './help.component.html' +}) +export class HelpComponent { + public helpSections = + this.helpService.getHelp(this.route.snapshot.data['helpPage']); + + constructor( + private readonly helpService: HelpService, + private readonly route: ActivatedRoute + ) { + } +} \ No newline at end of file diff --git a/src/Squidex/app/shared/components/history.component.html b/src/Squidex/app/shared/components/history.component.html index 5d87f4fbd..43edc2d46 100644 --- a/src/Squidex/app/shared/components/history.component.html +++ b/src/Squidex/app/shared/components/history.component.html @@ -1,5 +1,3 @@ - -
diff --git a/src/Squidex/app/shared/declarations.ts b/src/Squidex/app/shared/declarations.ts index 4f5797daa..8900815e5 100644 --- a/src/Squidex/app/shared/declarations.ts +++ b/src/Squidex/app/shared/declarations.ts @@ -8,6 +8,7 @@ export * from './components/app-component-base'; export * from './components/app-form.component'; export * from './components/dashboard-link.directive'; +export * from './components/help.component'; export * from './components/history.component'; export * from './components/language-selector.component'; @@ -27,6 +28,7 @@ export * from './services/apps.service'; export * from './services/auth.service'; export * from './services/contents.service'; export * from './services/event-consumers.service'; +export * from './services/help.service'; export * from './services/history.service'; export * from './services/languages.service'; export * from './services/schemas.service'; diff --git a/src/Squidex/app/shared/module.ts b/src/Squidex/app/shared/module.ts index 5c70aa68c..220534793 100644 --- a/src/Squidex/app/shared/module.ts +++ b/src/Squidex/app/shared/module.ts @@ -21,6 +21,8 @@ import { ContentsService, DashboardLinkDirective, EventConsumersService, + HelpComponent, + HelpService, HistoryComponent, HistoryService, LanguageSelectorComponent, @@ -43,12 +45,14 @@ import { declarations: [ AppFormComponent, DashboardLinkDirective, + HelpComponent, HistoryComponent, LanguageSelectorComponent ], exports: [ AppFormComponent, DashboardLinkDirective, + HelpComponent, HistoryComponent, LanguageSelectorComponent ] @@ -67,6 +71,7 @@ export class SqxSharedModule { AuthService, ContentsService, EventConsumersService, + HelpService, HistoryService, LanguageService, MustBeAuthenticatedGuard, diff --git a/src/Squidex/app/shared/services/auth.service.ts b/src/Squidex/app/shared/services/auth.service.ts index c77afb031..48826c28a 100644 --- a/src/Squidex/app/shared/services/auth.service.ts +++ b/src/Squidex/app/shared/services/auth.service.ts @@ -219,6 +219,7 @@ export class AuthService { } options.headers.append('Accept-Language', '*'); + options.headers.append('Pragma', 'no-cache'); if (this.currentUser && this.currentUser.user) { options.headers.append('Authorization', `${this.currentUser.user.token_type} ${this.currentUser.user.access_token}`); diff --git a/src/Squidex/app/shared/services/help.service.ts b/src/Squidex/app/shared/services/help.service.ts new file mode 100644 index 000000000..1ca9e595a --- /dev/null +++ b/src/Squidex/app/shared/services/help.service.ts @@ -0,0 +1,37 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Sebastian Stehle. All rights reserved + */ + +import { Injectable } from '@angular/core'; +import { Http } from '@angular/http'; +import { Observable } from 'rxjs'; + +@Injectable() +export class HelpService { + constructor( + private readonly http: Http + ) { + } + + public getHelp(helpPage: string): Observable { + const url = `https://api.gitbook.com/book/squidex/squidex/contents/${helpPage}.json`; + + return this.http.get(url) + .map(response => response.json()) + .map(response => { + const result: string[] = []; + + for (let section of response.sections) { + const content = section.content.replace(/href="\.\.\/GLOSSARY\.html/, 'target="_blank" href="https://docs.squidex.io/GLOSSARY.html'); + + result.push(content); + } + + return result; + }) + .catch(err => []); + } +} \ No newline at end of file diff --git a/src/Squidex/app/theme/_panels.scss b/src/Squidex/app/theme/_panels.scss index fdd2df83c..f2ef909e0 100644 --- a/src/Squidex/app/theme/_panels.scss +++ b/src/Squidex/app/theme/_panels.scss @@ -56,7 +56,6 @@ @include flex-box; @include flex-flow(row); @include flex-grow(1); - overflow: hidden; } &-content {