diff --git a/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs b/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs
index 9a33b799c..0087bbe02 100644
--- a/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs
+++ b/src/Ombi.Settings/Settings/Models/CustomPageSettings.cs
@@ -2,7 +2,6 @@
{
public class CustomPageSettings : Settings
{
- public bool Enabled { get; set; }
public string Title { get; set; }
public string Html { get; set; }
}
diff --git a/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs b/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs
index 6c18c712f..5f0287fc4 100644
--- a/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs
+++ b/src/Ombi.Settings/Settings/Models/CustomizationSettings.cs
@@ -10,6 +10,7 @@
public string CustomDonationMessage { get; set; }
public string Logo { get; set; }
public bool RecentlyAddedPage { get; set; }
+ public bool UseCustomPage { get; set; }
public void AddToUrl(string part)
{
diff --git a/src/Ombi.Store/Entities/Requests/MovieRequests.cs b/src/Ombi.Store/Entities/Requests/MovieRequests.cs
index e5957ca63..677a4292c 100644
--- a/src/Ombi.Store/Entities/Requests/MovieRequests.cs
+++ b/src/Ombi.Store/Entities/Requests/MovieRequests.cs
@@ -1,6 +1,7 @@
using Ombi.Helpers;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
+using Newtonsoft.Json;
namespace Ombi.Store.Entities.Requests
{
@@ -26,6 +27,7 @@ namespace Ombi.Store.Entities.Requests
public string LangCode { get; set; }
[NotMapped]
+ [JsonIgnore]
public string LanguageCode => LangCode.IsNullOrEmpty() ? "en" : LangCode;
}
}
diff --git a/src/Ombi/ClientApp/app/custompage/custompage.component.html b/src/Ombi/ClientApp/app/custompage/custompage.component.html
index 545f56cb5..3188f5d4e 100644
--- a/src/Ombi/ClientApp/app/custompage/custompage.component.html
+++ b/src/Ombi/ClientApp/app/custompage/custompage.component.html
@@ -1,7 +1,22 @@
-
-
-
\ No newline at end of file
+
\ 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 dd9259dae..e5968cc6e 100644
--- a/src/Ombi/ClientApp/app/custompage/custompage.component.ts
+++ b/src/Ombi/ClientApp/app/custompage/custompage.component.ts
@@ -1,4 +1,7 @@
import { Component, OnInit } from "@angular/core";
+import { FormBuilder, FormGroup, Validators } from "@angular/forms";
+import { AuthService } from "../auth/auth.service";
+import { NotificationService, SettingsService } from "../services";
@Component({
templateUrl: "./custompage.component.html",
@@ -6,14 +9,37 @@
})
export class CustomPageComponent implements OnInit {
- public html: string;
+ public form: FormGroup;
public isEditing: boolean;
+ public isAdmin: boolean;
- constructor() {
-//
+ constructor(private auth: AuthService, private settings: SettingsService, private fb: FormBuilder,
+ private notificationService: NotificationService) {
}
public ngOnInit() {
- //
+ this.settings.getCustomPage().subscribe(x => {
+
+ this.form = this.fb.group({
+ enabled: [x.enabled],
+ title: [x.title, [Validators.required]],
+ html: [x.html, [Validators.required]],
+ });
+ });
+ this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
+ }
+
+ public onSubmit() {
+ if (this.form.invalid) {
+ this.notificationService.error("Please check your entered values");
+ return;
+ }
+ this.settings.saveCustomPage(this.form.value).subscribe(x => {
+ if (x) {
+ this.notificationService.success("Successfully saved Custom Page settings");
+ } else {
+ this.notificationService.success("There was an error when saving the Custom Page settings");
+ }
+ });
}
}
diff --git a/src/Ombi/ClientApp/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/app/interfaces/ISettings.ts
index f2453c273..18a509bb2 100644
--- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts
+++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts
@@ -120,6 +120,7 @@ export interface ICustomizationSettings extends ISettings {
customDonationUrl: string;
customDonationMessage: string;
recentlyAddedPage: boolean;
+ useCustomPage: boolean;
}
export interface IJobSettings {
@@ -158,6 +159,12 @@ export interface IAuthenticationSettings extends ISettings {
enableOAuth: boolean;
}
+export interface ICustomPage extends ISettings {
+ enabled: boolean;
+ title: string;
+ html: string;
+}
+
export interface IUserManagementSettings extends ISettings {
importPlexUsers: boolean;
importPlexAdmin: boolean;
diff --git a/src/Ombi/ClientApp/app/services/settings.service.ts b/src/Ombi/ClientApp/app/services/settings.service.ts
index 64a6edd14..4e68d28df 100644
--- a/src/Ombi/ClientApp/app/services/settings.service.ts
+++ b/src/Ombi/ClientApp/app/services/settings.service.ts
@@ -10,6 +10,7 @@ import {
ICronTestModel,
ICronViewModelBody,
ICustomizationSettings,
+ ICustomPage,
IDiscordNotifcationSettings,
IDogNzbSettings,
IEmailNotificationSettings,
@@ -112,6 +113,14 @@ export class SettingsService extends ServiceHelpers {
return this.http.get(`${this.url}/Authentication`, {headers: this.headers});
}
+ public getCustomPage(): Observable {
+ return this.http.get(`${this.url}/CustomPage`, {headers: this.headers});
+ }
+
+ public saveCustomPage(model: ICustomPage): Observable {
+ return this.http.post(`${this.url}/CustomPage`, model, {headers: this.headers});
+ }
+
public getClientId(): Observable {
return this.http.get(`${this.url}/clientid`, {headers: this.headers});
}
diff --git a/src/Ombi/ClientApp/app/settings/customization/customization.component.html b/src/Ombi/ClientApp/app/settings/customization/customization.component.html
index 32d91aed9..90c6fb5bc 100644
--- a/src/Ombi/ClientApp/app/settings/customization/customization.component.html
+++ b/src/Ombi/ClientApp/app/settings/customization/customization.component.html
@@ -69,6 +69,13 @@
tooltipPosition="top" pTooltip="Set a custom message to be displayed in the navigation bar.">
+
diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs
index 770745786..892471d94 100644
--- a/src/Ombi/Controllers/SettingsController.cs
+++ b/src/Ombi/Controllers/SettingsController.cs
@@ -721,7 +721,7 @@ namespace Ombi.Controllers
/// Saves the Custom Page Settings.
///
///
- [HttpGet("CustomPage")]
+ [HttpPost("CustomPage")]
public async Task CustomPageSettings([FromBody] CustomPageSettings page)
{
return await Save(page);