mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-14 09:12:57 -07:00
Think i've finished the ui now too !wip needs testing
This commit is contained in:
parent
1528cdfc03
commit
b99a5a668b
11 changed files with 46 additions and 25 deletions
|
@ -18,6 +18,7 @@ namespace Ombi.Mapping.Profiles
|
||||||
CreateMap<TelegramNotificationsViewModel, TelegramSettings>().ReverseMap();
|
CreateMap<TelegramNotificationsViewModel, TelegramSettings>().ReverseMap();
|
||||||
CreateMap<UpdateSettingsViewModel, UpdateSettings>().ReverseMap();
|
CreateMap<UpdateSettingsViewModel, UpdateSettings>().ReverseMap();
|
||||||
CreateMap<MobileNotificationsViewModel, MobileNotificationSettings>().ReverseMap();
|
CreateMap<MobileNotificationsViewModel, MobileNotificationSettings>().ReverseMap();
|
||||||
|
CreateMap<NewsletterNotificationViewModel, NewsletterSettings>().ReverseMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,6 +18,7 @@ namespace Ombi.Settings.Settings.Models
|
||||||
|
|
||||||
public string PresetThemeName { get; set; }
|
public string PresetThemeName { get; set; }
|
||||||
public string PresetThemeContent { get; set; }
|
public string PresetThemeContent { get; set; }
|
||||||
|
public bool RecentlyAddedPage { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public string PresetThemeVersion
|
public string PresetThemeVersion
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace Ombi.Store.Repository
|
||||||
public interface INotificationTemplatesRepository : IDisposable
|
public interface INotificationTemplatesRepository : IDisposable
|
||||||
{
|
{
|
||||||
IQueryable<NotificationTemplates> All();
|
IQueryable<NotificationTemplates> All();
|
||||||
Task<IEnumerable<NotificationTemplates>> GetAllTemplates();
|
IQueryable<NotificationTemplates> GetAllTemplates();
|
||||||
Task<IEnumerable<NotificationTemplates>> GetAllTemplates(NotificationAgent agent);
|
IQueryable<NotificationTemplates> GetAllTemplates(NotificationAgent agent);
|
||||||
Task<NotificationTemplates> Insert(NotificationTemplates entity);
|
Task<NotificationTemplates> Insert(NotificationTemplates entity);
|
||||||
Task Update(NotificationTemplates template);
|
Task Update(NotificationTemplates template);
|
||||||
Task UpdateRange(IEnumerable<NotificationTemplates> template);
|
Task UpdateRange(IEnumerable<NotificationTemplates> template);
|
||||||
|
|
|
@ -23,14 +23,14 @@ namespace Ombi.Store.Repository
|
||||||
return Db.NotificationTemplates.AsQueryable();
|
return Db.NotificationTemplates.AsQueryable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<NotificationTemplates>> GetAllTemplates()
|
public IQueryable<NotificationTemplates> GetAllTemplates()
|
||||||
{
|
{
|
||||||
return await Db.NotificationTemplates.ToListAsync();
|
return Db.NotificationTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<NotificationTemplates>> GetAllTemplates(NotificationAgent agent)
|
public IQueryable<NotificationTemplates> GetAllTemplates(NotificationAgent agent)
|
||||||
{
|
{
|
||||||
return await Db.NotificationTemplates.Where(x => x.Agent == agent).ToListAsync();
|
return Db.NotificationTemplates.Where(x => x.Agent == agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<NotificationTemplates> GetTemplate(NotificationAgent agent, NotificationType type)
|
public async Task<NotificationTemplates> GetTemplate(NotificationAgent agent, NotificationType type)
|
||||||
|
|
|
@ -34,13 +34,14 @@
|
||||||
<i class="fa fa-th-list"></i> {{ 'NavigationBar.Requests' | translate }}</a>
|
<i class="fa fa-th-list"></i> {{ 'NavigationBar.Requests' | translate }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div *ngIf="customizationSettings">
|
||||||
<ul class="nav navbar-nav">
|
<ul *ngIf="customizationSettings.recentlyAddedPage" class="nav navbar-nav">
|
||||||
<li id="Requests" [routerLinkActive]="['active']">
|
<li id="RecentlyAdded" [routerLinkActive]="['active']">
|
||||||
<a [routerLink]="['/recentlyadded']">
|
<a [routerLink]="['/recentlyadded']">
|
||||||
<i class="fa fa-check"></i> {{ 'NavigationBar.RecentlyAdded' | translate }}</a>
|
<i class="fa fa-check"></i> {{ 'NavigationBar.RecentlyAdded' | translate }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
<ul *ngIf="issuesEnabled" class="nav navbar-nav">
|
<ul *ngIf="issuesEnabled" class="nav navbar-nav">
|
||||||
<li id="Issues" [routerLinkActive]="['active']">
|
<li id="Issues" [routerLinkActive]="['active']">
|
||||||
<a [routerLink]="['/issues']">
|
<a [routerLink]="['/issues']">
|
||||||
|
|
|
@ -46,6 +46,7 @@ export enum NotificationType {
|
||||||
WelcomeEmail = 8,
|
WelcomeEmail = 8,
|
||||||
IssueResolved = 9,
|
IssueResolved = 9,
|
||||||
IssueComment = 10,
|
IssueComment = 10,
|
||||||
|
Newsletter = 11,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDiscordNotifcationSettings extends INotificationSettings {
|
export interface IDiscordNotifcationSettings extends INotificationSettings {
|
||||||
|
|
|
@ -107,6 +107,7 @@ export interface ICustomizationSettings extends ISettings {
|
||||||
presetThemeContent: string;
|
presetThemeContent: string;
|
||||||
presetThemeDisplayName: string;
|
presetThemeDisplayName: string;
|
||||||
presetThemeVersion: string;
|
presetThemeVersion: string;
|
||||||
|
recentlyAddedPage: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IThemes {
|
export interface IThemes {
|
||||||
|
|
|
@ -33,6 +33,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" id="enable" [(ngModel)]="settings.recentlyAddedPage" [checked]="settings.recentlyAddedPage">
|
||||||
|
<label for="enable">Enable Recently Added Page</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="logo" class="control-label">Custom Logo</label>
|
<label for="logo" class="control-label">Custom Logo</label>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -25,6 +25,7 @@ import { DiscordComponent } from "./notifications/discord.component";
|
||||||
import { EmailNotificationComponent } from "./notifications/emailnotification.component";
|
import { EmailNotificationComponent } from "./notifications/emailnotification.component";
|
||||||
import { MattermostComponent } from "./notifications/mattermost.component";
|
import { MattermostComponent } from "./notifications/mattermost.component";
|
||||||
import { MobileComponent } from "./notifications/mobile.component";
|
import { MobileComponent } from "./notifications/mobile.component";
|
||||||
|
import { NewsletterComponent } from "./notifications/newsletter.component";
|
||||||
import { NotificationTemplate } from "./notifications/notificationtemplate.component";
|
import { NotificationTemplate } from "./notifications/notificationtemplate.component";
|
||||||
import { PushbulletComponent } from "./notifications/pushbullet.component";
|
import { PushbulletComponent } from "./notifications/pushbullet.component";
|
||||||
import { PushoverComponent } from "./notifications/pushover.component";
|
import { PushoverComponent } from "./notifications/pushover.component";
|
||||||
|
@ -43,6 +44,7 @@ import { SettingsMenuComponent } from "./settingsmenu.component";
|
||||||
|
|
||||||
import { AutoCompleteModule, CalendarModule, DialogModule, InputSwitchModule, InputTextModule, MenuModule, RadioButtonModule, TooltipModule } from "primeng/primeng";
|
import { AutoCompleteModule, CalendarModule, DialogModule, InputSwitchModule, InputTextModule, MenuModule, RadioButtonModule, TooltipModule } from "primeng/primeng";
|
||||||
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: "Ombi", component: OmbiComponent, canActivate: [AuthGuard] },
|
{ path: "Ombi", component: OmbiComponent, canActivate: [AuthGuard] },
|
||||||
{ path: "About", component: AboutComponent, canActivate: [AuthGuard] },
|
{ path: "About", component: AboutComponent, canActivate: [AuthGuard] },
|
||||||
|
@ -69,6 +71,7 @@ const routes: Routes = [
|
||||||
{ path: "Authentication", component: AuthenticationComponent, canActivate: [AuthGuard] },
|
{ path: "Authentication", component: AuthenticationComponent, canActivate: [AuthGuard] },
|
||||||
{ path: "Mobile", component: MobileComponent, canActivate: [AuthGuard] },
|
{ path: "Mobile", component: MobileComponent, canActivate: [AuthGuard] },
|
||||||
{ path: "MassEmail", component: MassEmailComponent, canActivate: [AuthGuard] },
|
{ path: "MassEmail", component: MassEmailComponent, canActivate: [AuthGuard] },
|
||||||
|
{ path: "Newsletter", component: NewsletterComponent, canActivate: [AuthGuard] },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -119,6 +122,7 @@ const routes: Routes = [
|
||||||
AuthenticationComponent,
|
AuthenticationComponent,
|
||||||
MobileComponent,
|
MobileComponent,
|
||||||
MassEmailComponent,
|
MassEmailComponent,
|
||||||
|
NewsletterComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Email']">Email</a></li>
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Email']">Email</a></li>
|
||||||
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/MassEmail']">Mass Email</a></li>
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/MassEmail']">Mass Email</a></li>
|
||||||
<!--<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Newsletter']">Newsletter</a></li>-->
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Newsletter']">Newsletter</a></li>
|
||||||
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Discord']">Discord</a></li>
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Discord']">Discord</a></li>
|
||||||
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Slack']">Slack</a></li>
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Slack']">Slack</a></li>
|
||||||
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Pushbullet']">Pushbullet</a></li>
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Pushbullet']">Pushbullet</a></li>
|
||||||
|
|
|
@ -610,7 +610,7 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<EmailNotificationsViewModel>(emailSettings);
|
var model = Mapper.Map<EmailNotificationsViewModel>(emailSettings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Email);
|
model.NotificationTemplates = BuildTemplates(NotificationAgent.Email);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -657,7 +657,7 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<DiscordNotificationsViewModel>(emailSettings);
|
var model = Mapper.Map<DiscordNotificationsViewModel>(emailSettings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Discord);
|
model.NotificationTemplates = BuildTemplates(NotificationAgent.Discord);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -692,7 +692,7 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<TelegramNotificationsViewModel>(emailSettings);
|
var model = Mapper.Map<TelegramNotificationsViewModel>(emailSettings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Telegram);
|
model.NotificationTemplates = BuildTemplates(NotificationAgent.Telegram);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<PushbulletNotificationViewModel>(settings);
|
var model = Mapper.Map<PushbulletNotificationViewModel>(settings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Pushbullet);
|
model.NotificationTemplates = BuildTemplates(NotificationAgent.Pushbullet);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -760,7 +760,7 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<PushoverNotificationViewModel>(settings);
|
var model = Mapper.Map<PushoverNotificationViewModel>(settings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Pushover);
|
model.NotificationTemplates = BuildTemplates(NotificationAgent.Pushover);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -795,7 +795,7 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<SlackNotificationsViewModel>(settings);
|
var model = Mapper.Map<SlackNotificationsViewModel>(settings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Slack);
|
model.NotificationTemplates = BuildTemplates(NotificationAgent.Slack);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -829,7 +829,7 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<MattermostNotificationsViewModel>(settings);
|
var model = Mapper.Map<MattermostNotificationsViewModel>(settings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Mattermost);
|
model.NotificationTemplates = BuildTemplates(NotificationAgent.Mattermost);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -863,7 +863,7 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<MobileNotificationsViewModel>(settings);
|
var model = Mapper.Map<MobileNotificationsViewModel>(settings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Mobile);
|
model.NotificationTemplates = BuildTemplates(NotificationAgent.Mobile);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -904,14 +904,19 @@ namespace Ombi.Controllers
|
||||||
var model = Mapper.Map<NewsletterNotificationViewModel>(settings);
|
var model = Mapper.Map<NewsletterNotificationViewModel>(settings);
|
||||||
|
|
||||||
// Lookup to see if we have any templates saved
|
// Lookup to see if we have any templates saved
|
||||||
var templates = await BuildTemplates(NotificationAgent.Email);
|
var templates = BuildTemplates(NotificationAgent.Email, true);
|
||||||
model.NotificationTemplate = templates.FirstOrDefault(x => x.NotificationType == NotificationType.Newsletter);
|
model.NotificationTemplate = templates.FirstOrDefault(x => x.NotificationType == NotificationType.Newsletter);
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<NotificationTemplates>> BuildTemplates(NotificationAgent agent)
|
private List<NotificationTemplates> BuildTemplates(NotificationAgent agent, bool showNewsletter = false)
|
||||||
{
|
{
|
||||||
var templates = await TemplateRepository.GetAllTemplates(agent);
|
var templates = TemplateRepository.GetAllTemplates(agent);
|
||||||
|
if (!showNewsletter)
|
||||||
|
{
|
||||||
|
// Make sure we do not display the newsletter
|
||||||
|
templates = templates.Where(x => x.NotificationType != NotificationType.Newsletter);
|
||||||
|
}
|
||||||
return templates.OrderBy(x => x.NotificationType.ToString()).ToList();
|
return templates.OrderBy(x => x.NotificationType.ToString()).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue