From edf87bf296171ce0b3244b451dc20a9e0f6a743b Mon Sep 17 00:00:00 2001 From: TidusJar Date: Tue, 8 Jan 2019 15:04:08 +0000 Subject: [PATCH] !wip on the new custom page --- .../Settings/Models/CustomPageSettings.cs | 9 ++++ src/Ombi/ClientApp/app/app.module.ts | 8 +++- .../app/custompage/custompage.component.html | 7 +++ .../app/custompage/custompage.component.scss | 44 +++++++++++++++++++ .../app/custompage/custompage.component.ts | 19 ++++++++ src/Ombi/Controllers/SettingsController.cs | 21 +++++++++ src/Ombi/package.json | 16 ++++--- src/Ombi/webpack.config.vendor.ts | 2 + src/Ombi/yarn.lock | 10 +++++ 9 files changed, 128 insertions(+), 8 deletions(-) create mode 100644 src/Ombi.Settings/Settings/Models/CustomPageSettings.cs create mode 100644 src/Ombi/ClientApp/app/custompage/custompage.component.html create mode 100644 src/Ombi/ClientApp/app/custompage/custompage.component.scss create mode 100644 src/Ombi/ClientApp/app/custompage/custompage.component.ts diff --git a/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs b/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs new file mode 100644 index 000000000..9a33b799c --- /dev/null +++ b/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs @@ -0,0 +1,9 @@ +namespace Ombi.Settings.Settings.Models +{ + public class CustomPageSettings : Settings + { + public bool Enabled { get; set; } + public string Title { get; set; } + public string Html { get; set; } + } +} \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/app.module.ts b/src/Ombi/ClientApp/app/app.module.ts index 0f268e4d2..6917cc85b 100644 --- a/src/Ombi/ClientApp/app/app.module.ts +++ b/src/Ombi/ClientApp/app/app.module.ts @@ -14,13 +14,16 @@ import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; import { TranslateLoader, TranslateModule } from "@ngx-translate/core"; import { TranslateHttpLoader } from "@ngx-translate/http-loader"; import { CookieService } from "ng2-cookies"; +import { NgxEditorModule } from "ngx-editor"; import { GrowlModule } from "primeng/components/growl/growl"; -import { ButtonModule, CaptchaModule, ConfirmationService, ConfirmDialogModule, DataTableModule, DialogModule, OverlayPanelModule, SharedModule, SidebarModule, TooltipModule } from "primeng/primeng"; +import { ButtonModule, CaptchaModule, ConfirmationService, ConfirmDialogModule, DataTableModule, DialogModule, OverlayPanelModule, SharedModule, SidebarModule, + TooltipModule } from "primeng/primeng"; // Components import { AppComponent } from "./app.component"; import { CookieComponent } from "./auth/cookie.component"; +import { CustomPageComponent } from "./custompage/custompage.component"; import { PageNotFoundComponent } from "./errors/not-found.component"; import { LandingPageComponent } from "./landingpage/landingpage.component"; import { LoginComponent } from "./login/login.component"; @@ -43,6 +46,7 @@ const routes: Routes = [ { path: "", redirectTo: "/search", pathMatch: "full" }, { path: "login", component: LoginComponent }, { path: "Login/OAuth/:pin", component: LoginOAuthComponent }, + { path: "Custom", component: CustomPageComponent }, { path: "login/:landing", component: LoginComponent }, { path: "reset", component: ResetPasswordComponent }, { path: "token", component: TokenResetPasswordComponent }, @@ -88,6 +92,7 @@ export function JwtTokenGetter() { FormsModule, DataTableModule, SharedModule, + NgxEditorModule, DialogModule, MatButtonModule, NgbModule.forRoot(), @@ -121,6 +126,7 @@ export function JwtTokenGetter() { LandingPageComponent, ResetPasswordComponent, TokenResetPasswordComponent, + CustomPageComponent, CookieComponent, LoginOAuthComponent, ], diff --git a/src/Ombi/ClientApp/app/custompage/custompage.component.html b/src/Ombi/ClientApp/app/custompage/custompage.component.html new file mode 100644 index 000000000..545f56cb5 --- /dev/null +++ b/src/Ombi/ClientApp/app/custompage/custompage.component.html @@ -0,0 +1,7 @@ + +
+ + +
+
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/app/custompage/custompage.component.scss b/src/Ombi/ClientApp/app/custompage/custompage.component.scss new file mode 100644 index 000000000..127ee8b74 --- /dev/null +++ b/src/Ombi/ClientApp/app/custompage/custompage.component.scss @@ -0,0 +1,44 @@ +$primary-colour: #df691a; +$primary-colour-outline: #ff761b; +$bg-colour: #333333; +$bg-colour-disabled: #252424; + +:host app-ngx-editor /deep/ .ngx-toolbar { + background-color: $bg-colour; + border: 1px solid $primary-colour-outline; +} + +:host app-ngx-editor /deep/ .ngx-toolbar-set { + background-color: transparent !important; + border: 1px solid $primary-colour-outline !important; +} + +:host app-ngx-editor /deep/ .ngx-editor-button { + -o-transition: all 0.218s; + -moz-transition: all 0.218s; + -webkit-transition: all 0.218s; + transition: all 0.218s; + color: $primary-colour-outline; + background-color: transparent; + background-image: none; + border-color: $primary-colour-outline !important; +} + +:host app-ngx-editor /deep/ .ngx-editor-button:hover { + color: black; + background-color: $primary-colour !important; + border-color: $primary-colour-outline !important; +} + +:host app-ngx-editor /deep/ .ngx-editor-grippie { + background-color: $bg-colour; + border: 1px solid $primary-colour-outline; +} + +:host app-ngx-editor /deep/ .ngx-editor-textarea { + border: 1px solid $primary-colour-outline !important; +} + +: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 new file mode 100644 index 000000000..dd9259dae --- /dev/null +++ b/src/Ombi/ClientApp/app/custompage/custompage.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit } from "@angular/core"; + +@Component({ + templateUrl: "./custompage.component.html", + styleUrls: ["./custompage.component.scss"], +}) +export class CustomPageComponent implements OnInit { + + public html: string; + public isEditing: boolean; + + constructor() { +// + } + + public ngOnInit() { + // + } +} diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs index 45efc8067..770745786 100644 --- a/src/Ombi/Controllers/SettingsController.cs +++ b/src/Ombi/Controllers/SettingsController.cs @@ -706,6 +706,27 @@ namespace Ombi.Controllers return emailSettings.Enabled; } + /// + /// Gets the Custom Page Settings. + /// + /// + [HttpGet("CustomPage")] + [AllowAnonymous] + public async Task CustomPageSettings() + { + return await Get(); + } + + /// + /// Saves the Custom Page Settings. + /// + /// + [HttpGet("CustomPage")] + public async Task CustomPageSettings([FromBody] CustomPageSettings page) + { + return await Save(page); + } + /// /// Saves the discord notification settings. /// diff --git a/src/Ombi/package.json b/src/Ombi/package.json index 0d4c31f21..5713b1061 100644 --- a/src/Ombi/package.json +++ b/src/Ombi/package.json @@ -15,20 +15,20 @@ "@angular/animations": "^7.1.4", "@angular/cdk": "^7.2.0", "@angular/common": "^7.1.4", - "@angular/compiler":"^7.1.4", + "@angular/compiler": "^7.1.4", "@angular/compiler-cli": "^7.1.4", "@angular/core": "^7.1.4", - "@angular/forms":"^7.1.4", + "@angular/forms": "^7.1.4", "@angular/http": "^7.1.4", - "@angular/material":"^7.2.0", + "@angular/material": "^7.2.0", "@angular/platform-browser": "^7.1.4", "@angular/platform-browser-dynamic": "^7.1.4", - "@angular/platform-server":"^7.1.4", - "@angular/router":"^7.1.4", + "@angular/platform-server": "^7.1.4", + "@angular/router": "^7.1.4", "@auth0/angular-jwt": "^2.0.0", "@ng-bootstrap/ng-bootstrap": "^3.3.1", - "@ngtools/webpack":"^7.1.4", - "@ngu/carousel": "^1.4.9-beta-2", + "@ngtools/webpack": "^7.1.4", + "@ngu/carousel": "^1.4.9-beta-2", "@ngx-translate/core": "^11.0.1", "@ngx-translate/http-loader": "^4.0.0", "@types/core-js": "^2.5.0", @@ -62,7 +62,9 @@ "moment": "^2.22.2", "natives": "1.1.6", "ng2-cookies": "^1.0.12", + "ngx-bootstrap": "^3.1.4", "ngx-clipboard": "^11.1.1", + "ngx-editor": "^4.1.0", "ngx-infinite-scroll": "^6.0.1", "ngx-moment": "^3.0.1", "ngx-order-pipe": "^2.0.1", diff --git a/src/Ombi/webpack.config.vendor.ts b/src/Ombi/webpack.config.vendor.ts index dc7c282bd..3f360af10 100644 --- a/src/Ombi/webpack.config.vendor.ts +++ b/src/Ombi/webpack.config.vendor.ts @@ -53,6 +53,8 @@ module.exports = (env: any) => { "@ngx-translate/http-loader", "ngx-order-pipe", "@yellowspot/ng-truncate", + "ngx-editor", + "ngx-bootstrap", ]), }, plugins: prod ? [] : [ diff --git a/src/Ombi/yarn.lock b/src/Ombi/yarn.lock index ae028221a..95d3e136b 100644 --- a/src/Ombi/yarn.lock +++ b/src/Ombi/yarn.lock @@ -4182,6 +4182,10 @@ ng2-cookies@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/ng2-cookies/-/ng2-cookies-1.0.12.tgz#3f3e613e0137b0649b705c678074b4bd08149ccc" +ngx-bootstrap@^3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/ngx-bootstrap/-/ngx-bootstrap-3.1.4.tgz#5105c0227da3b51a1972d04efa1504a79474fd57" + ngx-clipboard@^11.1.1: version "11.1.9" resolved "https://registry.yarnpkg.com/ngx-clipboard/-/ngx-clipboard-11.1.9.tgz#a391853dc49e436de407260863a2c814d73a9332" @@ -4189,6 +4193,12 @@ ngx-clipboard@^11.1.1: ngx-window-token "^1.0.2" tslib "^1.9.0" +ngx-editor@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ngx-editor/-/ngx-editor-4.1.0.tgz#3ec5820627f25a2239094747cccf88a7ca02f79f" + dependencies: + tslib "^1.9.0" + ngx-infinite-scroll@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/ngx-infinite-scroll/-/ngx-infinite-scroll-6.0.1.tgz#571e54860ce32839451569bcf6e7a63cfae327bd"