From 145166064a4dfca65de437b2fa1540e737e678ac Mon Sep 17 00:00:00 2001 From: TidusJar Date: Wed, 9 Jan 2019 08:44:35 +0000 Subject: [PATCH] Added a page where the admin can write/style/basically do whatever they want with e.g. FAQ for the users #2715 This needs to be enabled in the Customization Settings and then it's all configured on the page. --- .../Settings/Models/CustomPageSettings.cs | 1 + src/Ombi/ClientApp/app/app.component.html | 8 +++++ src/Ombi/ClientApp/app/app.component.ts | 16 +++++++-- .../app/custompage/custompage.component.html | 9 +++++ .../app/custompage/custompage.component.scss | 2 +- .../app/custompage/custompage.component.ts | 9 +++-- .../ClientApp/app/interfaces/ISettings.ts | 3 +- .../customization.component.html | 35 ++++++++++--------- src/Ombi/Ombi.csproj | 6 ++-- 9 files changed, 63 insertions(+), 26 deletions(-) diff --git a/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs b/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs index 0087bbe02..18c0125cb 100644 --- a/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs +++ b/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs @@ -4,5 +4,6 @@ { public string Title { get; set; } public string Html { get; set; } + public string FontAwesomeIcon { get; set; } } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/app.component.html b/src/Ombi/ClientApp/app/app.component.html index 9f6d00a7e..08c153f31 100644 --- a/src/Ombi/ClientApp/app/app.component.html +++ b/src/Ombi/ClientApp/app/app.component.html @@ -34,6 +34,14 @@ {{ 'NavigationBar.Requests' | translate }} +
+ +
+
+ + + +
+
diff --git a/src/Ombi/ClientApp/app/custompage/custompage.component.scss b/src/Ombi/ClientApp/app/custompage/custompage.component.scss index 127ee8b74..702973737 100644 --- a/src/Ombi/ClientApp/app/custompage/custompage.component.scss +++ b/src/Ombi/ClientApp/app/custompage/custompage.component.scss @@ -41,4 +41,4 @@ $bg-colour-disabled: #252424; :host app-ngx-editor /deep/ .ngx-editor-message { display:none !important; -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/app/custompage/custompage.component.ts b/src/Ombi/ClientApp/app/custompage/custompage.component.ts index e5968cc6e..f346bef2b 100644 --- a/src/Ombi/ClientApp/app/custompage/custompage.component.ts +++ b/src/Ombi/ClientApp/app/custompage/custompage.component.ts @@ -1,5 +1,6 @@ -import { Component, OnInit } from "@angular/core"; +import { Component, OnInit, SecurityContext } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; +import { DomSanitizer } from "@angular/platform-browser"; import { AuthService } from "../auth/auth.service"; import { NotificationService, SettingsService } from "../services"; @@ -14,16 +15,18 @@ export class CustomPageComponent implements OnInit { public isAdmin: boolean; constructor(private auth: AuthService, private settings: SettingsService, private fb: FormBuilder, - private notificationService: NotificationService) { + private notificationService: NotificationService, + private sanitizer: DomSanitizer) { } public ngOnInit() { this.settings.getCustomPage().subscribe(x => { - + x.html = this.sanitizer.sanitize(SecurityContext.HTML, this.sanitizer.bypassSecurityTrustHtml(x.html)); this.form = this.fb.group({ enabled: [x.enabled], title: [x.title, [Validators.required]], html: [x.html, [Validators.required]], + fontAwesomeIcon: [x.fontAwesomeIcon, [Validators.required]], }); }); this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser"); diff --git a/src/Ombi/ClientApp/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/app/interfaces/ISettings.ts index 18a509bb2..2f8a4e80b 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts @@ -161,8 +161,9 @@ export interface IAuthenticationSettings extends ISettings { export interface ICustomPage extends ISettings { enabled: boolean; + fontAwesomeIcon: string; title: string; - html: string; + html: any; } export interface IUserManagementSettings extends ISettings { diff --git a/src/Ombi/ClientApp/app/settings/customization/customization.component.html b/src/Ombi/ClientApp/app/settings/customization/customization.component.html index 90c6fb5bc..21a992c32 100644 --- a/src/Ombi/ClientApp/app/settings/customization/customization.component.html +++ b/src/Ombi/ClientApp/app/settings/customization/customization.component.html @@ -21,8 +21,8 @@
- +
@@ -36,8 +36,8 @@
- +
@@ -50,14 +50,16 @@
- +
-
@@ -65,17 +67,19 @@
-
-
- -
- -
+
+
+ + +
+
@@ -92,9 +96,8 @@
- +
diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index 881a6cc54..dc447dd20 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -14,12 +14,12 @@ false - bin\Debug\netcoreapp2.0\Swagger.xml + bin\Debug\netcoreapp2.2\Swagger.xml 1701;1702;1705;1591; - bin\Release\netcoreapp2.0\Swagger.xml + bin\Release\netcoreapp2.2\Swagger.xml 1701;1702;1705;1591; TRACE;RELEASE;NETCOREAPP2_0 @@ -71,7 +71,7 @@ - +