Think i've finished the ui now too !wip needs testing

pull/2089/head
Jamie 7 years ago
parent 1528cdfc03
commit b99a5a668b

@ -18,6 +18,7 @@ namespace Ombi.Mapping.Profiles
CreateMap<TelegramNotificationsViewModel, TelegramSettings>().ReverseMap();
CreateMap<UpdateSettingsViewModel, UpdateSettings>().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 PresetThemeContent { get; set; }
public bool RecentlyAddedPage { get; set; }
[NotMapped]
public string PresetThemeVersion

@ -10,8 +10,8 @@ namespace Ombi.Store.Repository
public interface INotificationTemplatesRepository : IDisposable
{
IQueryable<NotificationTemplates> All();
Task<IEnumerable<NotificationTemplates>> GetAllTemplates();
Task<IEnumerable<NotificationTemplates>> GetAllTemplates(NotificationAgent agent);
IQueryable<NotificationTemplates> GetAllTemplates();
IQueryable<NotificationTemplates> GetAllTemplates(NotificationAgent agent);
Task<NotificationTemplates> Insert(NotificationTemplates entity);
Task Update(NotificationTemplates template);
Task UpdateRange(IEnumerable<NotificationTemplates> template);

@ -23,14 +23,14 @@ namespace Ombi.Store.Repository
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)

@ -34,13 +34,14 @@
<i class="fa fa-th-list"></i> {{ 'NavigationBar.Requests' | translate }}</a>
</li>
</ul>
<ul class="nav navbar-nav">
<li id="Requests" [routerLinkActive]="['active']">
<a [routerLink]="['/recentlyadded']">
<i class="fa fa-check"></i> {{ 'NavigationBar.RecentlyAdded' | translate }}</a>
</li>
</ul>
<div *ngIf="customizationSettings">
<ul *ngIf="customizationSettings.recentlyAddedPage" class="nav navbar-nav">
<li id="RecentlyAdded" [routerLinkActive]="['active']">
<a [routerLink]="['/recentlyadded']">
<i class="fa fa-check"></i> {{ 'NavigationBar.RecentlyAdded' | translate }}</a>
</li>
</ul>
</div>
<ul *ngIf="issuesEnabled" class="nav navbar-nav">
<li id="Issues" [routerLinkActive]="['active']">
<a [routerLink]="['/issues']">

@ -46,6 +46,7 @@ export enum NotificationType {
WelcomeEmail = 8,
IssueResolved = 9,
IssueComment = 10,
Newsletter = 11,
}
export interface IDiscordNotifcationSettings extends INotificationSettings {

@ -107,6 +107,7 @@ export interface ICustomizationSettings extends ISettings {
presetThemeContent: string;
presetThemeDisplayName: string;
presetThemeVersion: string;
recentlyAddedPage: boolean;
}
export interface IThemes {

@ -33,6 +33,13 @@
</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">
<label for="logo" class="control-label">Custom Logo</label>
<div>

@ -25,6 +25,7 @@ import { DiscordComponent } from "./notifications/discord.component";
import { EmailNotificationComponent } from "./notifications/emailnotification.component";
import { MattermostComponent } from "./notifications/mattermost.component";
import { MobileComponent } from "./notifications/mobile.component";
import { NewsletterComponent } from "./notifications/newsletter.component";
import { NotificationTemplate } from "./notifications/notificationtemplate.component";
import { PushbulletComponent } from "./notifications/pushbullet.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";
const routes: Routes = [
{ path: "Ombi", component: OmbiComponent, canActivate: [AuthGuard] },
{ path: "About", component: AboutComponent, canActivate: [AuthGuard] },
@ -69,6 +71,7 @@ const routes: Routes = [
{ path: "Authentication", component: AuthenticationComponent, canActivate: [AuthGuard] },
{ path: "Mobile", component: MobileComponent, canActivate: [AuthGuard] },
{ path: "MassEmail", component: MassEmailComponent, canActivate: [AuthGuard] },
{ path: "Newsletter", component: NewsletterComponent, canActivate: [AuthGuard] },
];
@NgModule({
@ -119,6 +122,7 @@ const routes: Routes = [
AuthenticationComponent,
MobileComponent,
MassEmailComponent,
NewsletterComponent,
],
exports: [
RouterModule,

@ -56,7 +56,7 @@
<ul class="dropdown-menu">
<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/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/Slack']">Slack</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);
// Lookup to see if we have any templates saved
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Email);
model.NotificationTemplates = BuildTemplates(NotificationAgent.Email);
return model;
}
@ -657,7 +657,7 @@ namespace Ombi.Controllers
var model = Mapper.Map<DiscordNotificationsViewModel>(emailSettings);
// Lookup to see if we have any templates saved
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Discord);
model.NotificationTemplates = BuildTemplates(NotificationAgent.Discord);
return model;
}
@ -692,7 +692,7 @@ namespace Ombi.Controllers
var model = Mapper.Map<TelegramNotificationsViewModel>(emailSettings);
// Lookup to see if we have any templates saved
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Telegram);
model.NotificationTemplates = BuildTemplates(NotificationAgent.Telegram);
return model;
}
@ -726,7 +726,7 @@ namespace Ombi.Controllers
var model = Mapper.Map<PushbulletNotificationViewModel>(settings);
// Lookup to see if we have any templates saved
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Pushbullet);
model.NotificationTemplates = BuildTemplates(NotificationAgent.Pushbullet);
return model;
}
@ -760,7 +760,7 @@ namespace Ombi.Controllers
var model = Mapper.Map<PushoverNotificationViewModel>(settings);
// Lookup to see if we have any templates saved
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Pushover);
model.NotificationTemplates = BuildTemplates(NotificationAgent.Pushover);
return model;
}
@ -795,7 +795,7 @@ namespace Ombi.Controllers
var model = Mapper.Map<SlackNotificationsViewModel>(settings);
// Lookup to see if we have any templates saved
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Slack);
model.NotificationTemplates = BuildTemplates(NotificationAgent.Slack);
return model;
}
@ -829,7 +829,7 @@ namespace Ombi.Controllers
var model = Mapper.Map<MattermostNotificationsViewModel>(settings);
// Lookup to see if we have any templates saved
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Mattermost);
model.NotificationTemplates = BuildTemplates(NotificationAgent.Mattermost);
return model;
}
@ -863,7 +863,7 @@ namespace Ombi.Controllers
var model = Mapper.Map<MobileNotificationsViewModel>(settings);
// Lookup to see if we have any templates saved
model.NotificationTemplates = await BuildTemplates(NotificationAgent.Mobile);
model.NotificationTemplates = BuildTemplates(NotificationAgent.Mobile);
return model;
}
@ -904,14 +904,19 @@ namespace Ombi.Controllers
var model = Mapper.Map<NewsletterNotificationViewModel>(settings);
// 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);
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();
}

Loading…
Cancel
Save