mirror of https://github.com/Squidex/squidex.git
17 changed files with 143 additions and 7 deletions
@ -0,0 +1,17 @@ |
|||
<sqx-panel panelWidth="16rem"> |
|||
<div class="panel-header"> |
|||
<div class="panel-title-row"> |
|||
<h3 class="panel-title">Help</h3> |
|||
</div> |
|||
|
|||
<a class="panel-close" routerLink="../"> |
|||
<i class="icon-close"></i> |
|||
</a> |
|||
</div> |
|||
|
|||
<div class="panel-main"> |
|||
<div class="panel-content panel-content-blank"> |
|||
<p *ngFor="let section of helpSections | async" [innerHTML]="section"></p> |
|||
</div> |
|||
</div> |
|||
</sqx-panel> |
|||
@ -0,0 +1,6 @@ |
|||
@import '_vars'; |
|||
@import '_mixins'; |
|||
|
|||
p { |
|||
font-size: .9rem; |
|||
} |
|||
@ -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 |
|||
) { |
|||
} |
|||
} |
|||
@ -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<string[]> { |
|||
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 => []); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue