Skip to content

Commit

Permalink
Merge pull request #466 from pvl-bit/master
Browse files Browse the repository at this point in the history
Feature update allowing preferred language
  • Loading branch information
charlesabarnes authored Mar 18, 2022
2 parents 6b9f92e + cadb769 commit ac31590
Show file tree
Hide file tree
Showing 18 changed files with 434 additions and 225 deletions.
68 changes: 50 additions & 18 deletions src/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,55 @@
"careersUrl": "",
"defaultLocale": "en-US",
"supportedLocales": [
"en-US",
"en-GB",
"en",
"fr-FR",
"fr",
"es",
"de",
"it",
"nl",
"ru",
"zh-CN"
"en-US",
"en-GB",
"en",
"fr-FR",
"fr",
"es",
"de",
"it",
"nl",
"ru",
"zh-CN"
],
"languageDropdownOptions": {
"enabled": true,
"choices": [
{
"localeCode": "en",
"name": "English"
},
{
"localeCode": "fr",
"name": "French"
},
{
"localeCode": "es",
"name": "Spanish"
},
{
"localeCode": "de",
"name": "German"
},
{
"localeCode": "it",
"name": "Italian"
},
{
"localeCode": "nl",
"name": "Dutch"
},
{
"localeCode": "ru",
"name": "Russian"
},
{
"localeCode": "zh-CN",
"name": "Chinese"
}
]
},
"minUploadSize": 4096,
"maxRelatedJobs": 5,
"maxUploadSize": 5242880,
Expand Down Expand Up @@ -58,16 +95,11 @@
}
],
"showCategory": true,
"keywordSearchFields": [
"publicDescription",
"title"
]
"keywordSearchFields": ["publicDescription", "title"]
},
"additionalJobCriteria": {
"field": "[ FILTER FIELD HERE ]",
"values": [
"[ FILTER VALUE HERE ]"
],
"values": ["[ FILTER VALUE HERE ]"],
"sort": "-dateLastPublished"
},
"integrations": {
Expand Down
68 changes: 50 additions & 18 deletions src/app.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,55 @@
"careersUrl": "",
"defaultLocale": "en-US",
"supportedLocales": [
"en-US",
"en-GB",
"en",
"fr-FR",
"fr",
"es",
"de",
"it",
"nl",
"ru",
"zh-CN"
"en-US",
"en-GB",
"en",
"fr-FR",
"fr",
"es",
"de",
"it",
"nl",
"ru",
"zh-CN"
],
"languageDropdownOptions": {
"enabled": false,
"choices": [
{
"localeCode": "en",
"name": "English"
},
{
"localeCode": "fr",
"name": "French"
},
{
"localeCode": "es",
"name": "Spanish"
},
{
"localeCode": "de",
"name": "German"
},
{
"localeCode": "it",
"name": "Italian"
},
{
"localeCode": "nl",
"name": "Dutch"
},
{
"localeCode": "ru",
"name": "Russian"
},
{
"localeCode": "zh-CN",
"name": "Chinese"
}
]
},
"minUploadSize": 4096,
"maxRelatedJobs": 5,
"maxUploadSize": 5242880,
Expand Down Expand Up @@ -58,16 +95,11 @@
}
],
"showCategory": true,
"keywordSearchFields": [
"publicDescription",
"title"
]
"keywordSearchFields": ["publicDescription", "title"]
},
"additionalJobCriteria": {
"field": "[ FILTER FIELD HERE ]",
"values": [
"[ FILTER VALUE HERE ]"
],
"values": ["[ FILTER VALUE HERE ]"],
"sort": "-dateLastPublished"
},
"integrations": {
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<div class="entity-header" novo-title></div>
</header>
<div>
<router-outlet></router-outlet>
</div>
<router-outlet></router-outlet>
</div>
46 changes: 27 additions & 19 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
import { Component, ViewContainerRef, OnInit } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { SettingsService } from './services/settings/settings.service';
import { Meta } from '@angular/platform-browser';
import { NovoToastService, NovoModalService } from 'novo-elements';
import { Component, ViewContainerRef, OnInit } from "@angular/core";
import { Router, NavigationEnd } from "@angular/router";
import { SettingsService } from "./services/settings/settings.service";
import { Meta } from "@angular/platform-browser";
import { NovoToastService, NovoModalService } from "novo-elements";

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.scss"],
})
export class AppComponent implements OnInit {
public title: string = SettingsService.settings.companyName;

constructor(private router: Router, private meta: Meta, private ref: ViewContainerRef, private toastService: NovoToastService, private modalService: NovoModalService) {

constructor(
private router: Router,
private meta: Meta,
private ref: ViewContainerRef,
private toastService: NovoToastService,
private modalService: NovoModalService
) {
if (SettingsService.settings.integrations.googleSiteVerification) {
this.meta.updateTag({ name: 'google-site-verification', content: SettingsService.settings.integrations.googleSiteVerification.verificationCode });
this.meta.updateTag({
name: "google-site-verification",
content:
SettingsService.settings.integrations.googleSiteVerification
.verificationCode,
});
}
let trackingId: string = '';
let trackingId: string = "";
if (SettingsService.settings.integrations.googleAnalytics) {
trackingId = SettingsService.settings.integrations.googleAnalytics.trackingId;
trackingId =
SettingsService.settings.integrations.googleAnalytics.trackingId;
}
if (trackingId && !SettingsService.isServer) {
this.router.events.subscribe((event: any) => {
if (event instanceof NavigationEnd) {
(<any>window).ga('create', trackingId, 'auto');
(<any>window).ga('set', 'page', event.urlAfterRedirects);
(<any>window).ga('send', 'pageview');
(<any>window).ga("create", trackingId, "auto");
(<any>window).ga("set", "page", event.urlAfterRedirects);
(<any>window).ga("send", "pageview");
}
});
}
Expand All @@ -35,7 +46,4 @@ export class AppComponent implements OnInit {
this.toastService.parentViewContainer = this.ref;
this.modalService.parentViewContainer = this.ref;
}

public action(): void {
}
}
116 changes: 65 additions & 51 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,65 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, APP_INITIALIZER } from '@angular/core';
import { AppComponent } from './app.component';
import { JobListComponent } from './job-list/job-list.component';
import { SettingsService } from './services/settings/settings.service';
import { AnalyticsService } from './services/analytics/analytics.service';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { SearchService } from './services/search/search.service';
import { ShareService } from './services/share/share.service';
import { ApplyService } from './services/apply/apply.service';
import { SidebarComponent } from './sidebar/sidebar.component';
import { SidebarFilterComponent } from './sidebar/sidebar-filter/sidebar-filter.component';
import { BrowserTransferStateModule } from '@angular/platform-browser';
import { NovoListModule, NovoElementsModule, NovoHeaderModule, NovoModalModule, NovoModalService, FieldInteractionApi, NovoToastService, } from 'novo-elements';
import { MainPageComponent } from './main-page/main-page.component';
import { JobDetailsComponent } from './job-details/job-details.component';
import { ApplyModalComponent } from './apply-modal/apply-modal.component';
import { ErrorModalComponent } from './error-modal/error-modal.component';
import { StripHtmlPipe } from './utils/stripHtml.pipe';
import { StructuredSeoComponent } from './structured-seo/structured-seo.component';
import { DatePipe } from '@angular/common';
import { JobResolver } from './job.resolver';
import { ServerResponseService } from './services/server-response/server-response.service';
import { PrivacyPolicyComponent } from './privacy-policy/privacy-policy.component';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslationLoader } from './services/localization/loader';
import { AppRoutingModule } from './app-routing.module';
import { InfoChipsComponent } from './components/info-chips/info-chips.component';
import { BrowserModule } from "@angular/platform-browser";
import { NgModule, APP_INITIALIZER } from "@angular/core";
import { AppComponent } from "./app.component";
import { JobListComponent } from "./job-list/job-list.component";
import { SettingsService } from "./services/settings/settings.service";
import { AnalyticsService } from "./services/analytics/analytics.service";
import { HttpClientModule } from "@angular/common/http";
import { FormsModule } from "@angular/forms";
import { SearchService } from "./services/search/search.service";
import { ShareService } from "./services/share/share.service";
import { ApplyService } from "./services/apply/apply.service";
import { SidebarComponent } from "./sidebar/sidebar.component";
import { SidebarFilterComponent } from "./sidebar/sidebar-filter/sidebar-filter.component";
import { BrowserTransferStateModule } from "@angular/platform-browser";
import {
NovoListModule,
NovoElementsModule,
NovoHeaderModule,
NovoModalModule,
NovoModalService,
FieldInteractionApi,
NovoToastService,
NovoDropdownModule,
NovoButtonModule,
} from "novo-elements";
import { MainPageComponent } from "./main-page/main-page.component";
import { JobDetailsComponent } from "./job-details/job-details.component";
import { ApplyModalComponent } from "./apply-modal/apply-modal.component";
import { ErrorModalComponent } from "./error-modal/error-modal.component";
import { StripHtmlPipe } from "./utils/stripHtml.pipe";
import { StructuredSeoComponent } from "./structured-seo/structured-seo.component";
import { DatePipe } from "@angular/common";
import { JobResolver } from "./job.resolver";
import { ServerResponseService } from "./services/server-response/server-response.service";
import { PrivacyPolicyComponent } from "./privacy-policy/privacy-policy.component";
import { TranslateLoader, TranslateModule } from "@ngx-translate/core";
import { TranslationLoader } from "./services/localization/loader";
import { AppRoutingModule } from "./app-routing.module";
import { InfoChipsComponent } from "./components/info-chips/info-chips.component";

export function initSettings(settings: SettingsService): () => Promise<void> {
return () => settings.load();
}

@NgModule({
declarations: [
AppComponent,
JobListComponent,
SidebarComponent,
MainPageComponent,
JobDetailsComponent,
ApplyModalComponent,
ErrorModalComponent,
StripHtmlPipe,
SidebarFilterComponent,
StructuredSeoComponent,
PrivacyPolicyComponent,
InfoChipsComponent,
],
entryComponents: [
ApplyModalComponent,
ErrorModalComponent,
],
imports: [
BrowserModule.withServerTransition({ appId: 'serverApp' }),
declarations: [
AppComponent,
JobListComponent,
SidebarComponent,
MainPageComponent,
JobDetailsComponent,
ApplyModalComponent,
ErrorModalComponent,
StripHtmlPipe,
SidebarFilterComponent,
StructuredSeoComponent,
PrivacyPolicyComponent,
InfoChipsComponent,
],
entryComponents: [ApplyModalComponent, ErrorModalComponent],
imports: [
BrowserModule.withServerTransition({ appId: "serverApp" }),
AppRoutingModule,
HttpClientModule,
NovoElementsModule,
Expand All @@ -61,6 +68,8 @@ export function initSettings(settings: SettingsService): () => Promise<void> {
BrowserTransferStateModule,
NovoModalModule,
FormsModule,
NovoDropdownModule,
NovoButtonModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
Expand All @@ -69,7 +78,12 @@ export function initSettings(settings: SettingsService): () => Promise<void> {
}),
],
providers: [
{ provide: APP_INITIALIZER, useFactory: initSettings, deps: [SettingsService], multi: true },
{
provide: APP_INITIALIZER,
useFactory: initSettings,
deps: [SettingsService],
multi: true,
},
SettingsService,
SearchService,
ShareService,
Expand All @@ -84,4 +98,4 @@ export function initSettings(settings: SettingsService): () => Promise<void> {
],
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
Loading

0 comments on commit ac31590

Please sign in to comment.