Commit 7fc72cd8 by Tuukka Kivilahti

viplist as testmodule , rewriting folder structure as planned on codecamp

1 parent c220a30c
Showing with 180 additions and 325 deletions
...@@ -39,18 +39,26 @@ Jos tulee muita järkeviä kokonaisuuksia, joita voi käyttää muualla, jaa oma ...@@ -39,18 +39,26 @@ Jos tulee muita järkeviä kokonaisuuksia, joita voi käyttää muualla, jaa oma
* app * app
* modules * modules
* viplist * viplist
* viplist.component * viplist-manager
* viplist.module * viplist-info.component
* viplist-admin.component
* viplist-manager.module
* models
* viplist.model
* pizza * pizza
* user-pizza * pizza-user
* user-pizza.component * pizza-user.component
* admin-pizza * pizza-user.service
* admin-pizza.component * pizza-user.module
* services * pizza-manager
* pizza.service * pizza-admin.component
* pizza-info.component
* pizza-manager.module
* pizza-manager.service
* common * common
* pizza-list.component (shared for user / admin pizza) * pizza-list.component (shared for user / admin pizza)
* pizza.module * models
* pizza.model
* shared * shared
* components * components
* services * services
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { LoginComponent } from './pages/login/login.component'; import { LoginComponent } from './modules/login/login.component';
import { InfoComponent } from './pages/info/info.component'; import {FrontpageComponent} from "./components/frontpage/frontpage.component";
import {ViplistModule} from "./modules/viplist/viplist.module";
import {InfoViplistPageComponent} from "./modules/viplist/info/info-viplist-page.component";
const APP_ROUTES: Routes = [ const APP_ROUTES: Routes = [
{ path: 'info', loadChildren: 'app/pages/info/info.module#InfoModule' },
{ path: 'admin', loadChildren: 'app/pages/admin/admin.module#AdminModule' },
{ path: 'user', loadChildren: 'app/pages/user/user.module#UserModule' },
{ path: 'login', component: LoginComponent }, { path: 'login', component: LoginComponent },
{ path: '', pathMatch: 'full', redirectTo: 'login' }, /*{ path: 'viplist', loadChildren: 'app/modules/viplist/viplist.module#ViplistModule' },*/
{ path: '**', component: LoginComponent } { path: 'viplist', component: InfoViplistPageComponent },
]; { path: 'old/info', loadChildren: 'app/modules/old-moya/old-moya.module#OldMoyaModule' },
{ path: '', pathMatch: 'full', component: FrontpageComponent }
];
@NgModule({ @NgModule({
imports: [ imports: [
......
<div id="top-container"> <div id="top-container">
<div id="left-menu"> <div id="left-menu">
<router-outlet name="left-menu"></router-outlet> <left-menu></left-menu>
</div> </div>
<div id="contentarea"> <div id="contentarea">
...@@ -13,4 +13,3 @@ ...@@ -13,4 +13,3 @@
<router-outlet></router-outlet> <router-outlet></router-outlet>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -13,15 +13,17 @@ import { MoyaLocaleComponent } from './components/moya-locale/moya-locale.compon ...@@ -13,15 +13,17 @@ import { MoyaLocaleComponent } from './components/moya-locale/moya-locale.compon
import { TopMenuComponent } from './menu/top-menu/top-menu.component'; import { TopMenuComponent } from './menu/top-menu/top-menu.component';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import {MatTableModule} from "@angular/material";
import {ViplistModule} from "./modules/viplist/viplist.module"; import {ViplistModule} from "./modules/viplist/viplist.module";
import {LoginModule} from "./pages/login/login.module"; import {LoginModule} from "./modules/login/login.module";
import {LeftMenuModule} from "./menu/left-menu/left-menu.module";
import { FrontpageComponent } from './components/frontpage/frontpage.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
TopMenuComponent, TopMenuComponent,
MoyaLocaleComponent, MoyaLocaleComponent,
FrontpageComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
...@@ -30,6 +32,13 @@ import {LoginModule} from "./pages/login/login.module"; ...@@ -30,6 +32,13 @@ import {LoginModule} from "./pages/login/login.module";
HttpClientModule, HttpClientModule,
ViplistModule, ViplistModule,
LoginModule, LoginModule,
LeftMenuModule,
// remove
ViplistModule,
// /remove
AlertModule.forRoot(), AlertModule.forRoot(),
TranslateModule.forRoot({ TranslateModule.forRoot({
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {DEFAULT_LOCALE, MoyaLocaleService} from './moya-locale.service'; import {DEFAULT_LOCALE, ENGLISH, FINNISH, MoyaLocaleService, SWEDISH} from './moya-locale.service';
import {TranslateService} from '@ngx-translate/core';
const ENGLISH = 'en';
const FINNISH = 'fi';
const SWEDISH = 'sv';
@Component({ @Component({
selector: 'moya-locale', selector: 'moya-locale',
...@@ -17,24 +12,18 @@ export class MoyaLocaleComponent implements OnInit { ...@@ -17,24 +12,18 @@ export class MoyaLocaleComponent implements OnInit {
svSelected = true; svSelected = true;
enSelected = true; enSelected = true;
constructor(private localeService: MoyaLocaleService, private translate: TranslateService) { constructor(private localeService: MoyaLocaleService) { }
// fallback language
translate.setDefaultLang(DEFAULT_LOCALE);
this.selectLocale(DEFAULT_LOCALE);
}
ngOnInit() { ngOnInit() {
this.localeService.getUserLocale().subscribe(locale => { this.selectLocale(locale); } ); this.localeService.getUserLocale().subscribe(locale => { this.updateFlagStatus(locale); } );
} }
selectLocale(locale: string, save = false): void { updateFlagStatus(locale: string): void {
if (![ENGLISH, FINNISH, SWEDISH].includes(locale)) { if (![ENGLISH, FINNISH, SWEDISH].includes(locale)) {
return; return;
} }
this.translate.use(locale);
this.fiSelected = this.svSelected = this.enSelected = false; this.fiSelected = this.svSelected = this.enSelected = false;
switch (locale) { switch (locale) {
...@@ -48,22 +37,17 @@ export class MoyaLocaleComponent implements OnInit { ...@@ -48,22 +37,17 @@ export class MoyaLocaleComponent implements OnInit {
this.svSelected = true; this.svSelected = true;
break; break;
} }
if (save) {
this.localeService.setUserLocale(locale);
}
} }
selectEnglish() { selectEnglish() {
this.selectLocale(ENGLISH, true); this.updateFlagStatus(this.localeService.selectLocale(ENGLISH, true));
} }
selectFinnish() { selectFinnish() {
this.selectLocale(FINNISH, true); this.updateFlagStatus(this.localeService.selectLocale(FINNISH, true));
} }
selectSwedish() { selectSwedish() {
this.selectLocale(SWEDISH, true); this.updateFlagStatus(this.localeService.selectLocale(SWEDISH, true));
} }
} }
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {MoyaLocale} from './moya-locale.model'; import {MoyaLocale} from './moya-locale.model';
import {MOYA_BASE_URL, MoyaRestTool} from '../../shared/tools/moya-rest.tool'; import {MOYA_BASE_URL} from '../../shared/tools/moya-rest.tool';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/catch';
import {TranslateService} from "@ngx-translate/core";
export const DEFAULT_LOCALE = 'fi';
export const ENGLISH = 'en';
export const FINNISH = 'fi';
export const SWEDISH = 'sv';
export const DEFAULT_LOCALE = FINNISH;
const LOCALSTORAGE_NAME = 'currently used locale code'; const LOCALSTORAGE_NAME = 'currently used locale code';
@Injectable() @Injectable()
export class MoyaLocaleService { export class MoyaLocaleService {
constructor(private http: HttpClient) { }
selectedLocale : string;
constructor(private http: HttpClient, private translate: TranslateService) {
this.translate.setDefaultLang(DEFAULT_LOCALE);
this.getUserLocale().subscribe();
}
/**
* Returns same locale you did give this as a parameter.
*
* @param {string} locale
* @param {boolean} save
* @return {string}
*/
selectLocale(locale: string, save = false): string {
if (![ENGLISH, FINNISH, SWEDISH].includes(locale)) {
return;
}
this.translate.use(locale);
this.selectedLocale = locale;
if (save) {
this.setUserLocale(locale);
}
return locale;
}
/** /**
* Order of Locale: * Order of Locale:
...@@ -23,24 +64,29 @@ export class MoyaLocaleService { ...@@ -23,24 +64,29 @@ export class MoyaLocaleService {
*/ */
public getUserLocale(): Observable<string> { public getUserLocale(): Observable<string> {
// If there is already locale, don't bother of running this rest stuff again
if(this.selectedLocale) {
return new Observable<string>(x => x.next(this.selectedLocale));
}
return this.http.get<MoyaLocale>(MOYA_BASE_URL + '/v3/locale/') return this.http.get<MoyaLocale>(MOYA_BASE_URL + '/v3/locale/')
.catch(x => Observable.of({} as MoyaLocale)) .catch(x => Observable.of({} as MoyaLocale))
.map(locale => { .map(locale => {
if (locale && locale.userLocale) { if (locale && locale.userLocale) {
return locale.userLocale; return this.selectLocale(locale.userLocale);
} }
const storageLocale = localStorage.getItem(LOCALSTORAGE_NAME); const storageLocale = localStorage.getItem(LOCALSTORAGE_NAME);
if (storageLocale) { if (storageLocale) {
return storageLocale; return this.selectLocale(storageLocale);
} }
if (locale.eventLocale) { if (locale.eventLocale) {
return locale.eventLocale; return this.selectLocale(locale.eventLocale);
} }
return DEFAULT_LOCALE; return this.selectLocale(DEFAULT_LOCALE);
}); });
} }
......
<left-menu [menu]="menu" styleClass="adminMenu"></left-menu> <!-- <left-menu [menu]="menu" styleClass="adminMenu"></left-menu> -->
import {MenuGroup} from '../models/menu-group.model'; import {MenuGroup} from '../models/menu-group.model';
import {OldMoyaComponent} from "../../modules/old-moya/old-moya.component";
/** /**
* Created by tuukka on 13/05/17. * Created by tuukka on 13/05/17.
*/ */
...@@ -10,16 +11,17 @@ export class MENU { ...@@ -10,16 +11,17 @@ export class MENU {
{ {
'name': 'Kauppa', 'name': 'Kauppa',
'items': [ 'items': [
{ 'path': '/admin/old', 'name': 'Products', 'params': {p: 'product/list.jsf'} } { 'path': '/old/admin', 'name': 'Products', 'params': {p: 'product/list.jsf'} }
]} ]}
]; ];
static INFO: MenuGroup[] = [ static INFO: MenuGroup[] = [
{ {
'name': 'Users', 'name': 'Users',
'items': [ 'items': [
{ 'path': '/info/old', 'name': 'List users', 'params': {p: 'useradmin/list.jsf'} }, { 'path': '/old/info', 'name': 'List users', 'params': {p: 'useradmin/list.jsf'} },
{ 'path': '/info/viplist', 'name': 'VipList'} { 'path': '/viplist', 'name': 'VipList'}
]} ]}
]; ];
...@@ -27,49 +29,49 @@ export class MENU { ...@@ -27,49 +29,49 @@ export class MENU {
{ {
'name': 'Event', 'name': 'Event',
'items': [ 'items': [
{ 'path': '/user/old', 'name': 'Poll', 'params': {p: 'poll/index.jsf'} }, { 'path': '/old/user', 'name': 'Poll', 'params': {p: 'poll/index.jsf'} },
{ 'path': '/user/old', 'name': 'Invite friends', 'params': {p: 'user/invite.jsf'} }, { 'path': '/old/user', 'name': 'Invite friends', 'params': {p: 'user/invite.jsf'} },
]}, ]},
{ {
'name': 'Shop', 'name': 'Shop',
'items': [ 'items': [
{ 'path': '/user/old', 'name': 'Buy Tickets', 'params': {p: 'shop/createBill.jsf'} }, { 'path': '/old/user', 'name': 'Buy Tickets', 'params': {p: 'shop/createBill.jsf'} },
{ 'path': '/user/old', 'name': 'Reserve Places', 'params': {p: 'neomap/reserve.jsf'} }, { 'path': '/old/user', 'name': 'Reserve Places', 'params': {p: 'neomap/reserve.jsf'} },
{ 'path': '/user/old', 'name': 'Change Places', 'params': {p: 'neomap/moveplaces.jsf'} }, { 'path': '/old/user', 'name': 'Change Places', 'params': {p: 'neomap/moveplaces.jsf'} },
{ 'path': '/user/old', 'name': 'Food Orders', 'params': {p: 'foodwave/list.jsf'} }, { 'path': '/old/user', 'name': 'Food Orders', 'params': {p: 'foodwave/list.jsf'} },
{ 'path': '/user/old', 'name': 'Own Orders', 'params': {p: 'bill/list.jsf'} }, { 'path': '/old/user', 'name': 'Own Orders', 'params': {p: 'bill/list.jsf'} },
{ 'path': '/user/old', 'name': 'Account Events', 'params': {p: 'user/accountEvents.jsf'} }, { 'path': '/old/user', 'name': 'Account Events', 'params': {p: 'user/accountEvents.jsf'} },
]}, ]},
{ {
'name': 'Computerplaces', 'name': 'Computerplaces',
'items': [ 'items': [
{ 'path': '/user/old', 'name': 'Own Places', 'params': {p: 'place/myGroups.jsf'} }, { 'path': '/old/user', 'name': 'Own Places', 'params': {p: 'place/myGroups.jsf'} },
{ 'path': '/user/old', 'name': 'Placemap', 'params': {p: 'neomap/view.jsf'} }, { 'path': '/old/user', 'name': 'Placemap', 'params': {p: 'neomap/view.jsf'} },
]}, ]},
{ {
'name': 'Competitions', 'name': 'Competitions',
'items': [ 'items': [
{ 'path': '/user/old', 'name': 'Compos', 'params': {p: 'voting/compolist.jsf'} }, { 'path': '/old/user', 'name': 'Compos', 'params': {p: 'voting/compolist.jsf'} },
{ 'path': '/user/old', 'name': 'My entries', 'params': {p: 'voting/myEntries.jsf'} }, { 'path': '/old/user', 'name': 'My entries', 'params': {p: 'voting/myEntries.jsf'} },
]}, ]},
{ {
'name': 'Profile', 'name': 'Profile',
'items': [ 'items': [
{ 'path': '/user/old', 'name': 'My Information', 'params': {p: 'user/edit.jsf'} }, { 'path': '/old/user', 'name': 'My Information', 'params': {p: 'user/edit.jsf'} },
{ 'path': '/user/old', 'name': 'Request Role', 'params': {p: 'orgrole/requestRole.jsf'} }, { 'path': '/old/user', 'name': 'Request Role', 'params': {p: 'orgrole/requestRole.jsf'} },
{ 'path': '/user/old', 'name': 'Change password', 'params': {p: 'user/changePassword.jsf'} }, { 'path': '/old/user', 'name': 'Change password', 'params': {p: 'user/changePassword.jsf'} },
{ 'path': '/user/old', 'name': 'Set GameIDs', 'params': {p: 'user/gameids.jsf'} }, { 'path': '/old/user', 'name': 'Set GameIDs', 'params': {p: 'user/gameids.jsf'} },
]}, ]},
{ {
'name': 'Tournaments', 'name': 'Tournaments',
'items': [ 'items': [
{ 'path': '/user/old', 'name': 'Tournaments List', 'params': {p: 'tournaments/index.jsf'} }, { 'path': '/old/user', 'name': 'Tournaments List', 'params': {p: 'tournaments/index.jsf'} },
{ 'path': '/user/old', 'name': 'My Participations', 'params': {p: 'tournaments/myparticipations.jsf'} }, { 'path': '/old/user', 'name': 'My Participations', 'params': {p: 'tournaments/myparticipations.jsf'} },
]}, ]},
{ {
'name': 'Lectures and Courses', 'name': 'Lectures and Courses',
'items': [ 'items': [
{ 'path': '/user/old', 'name': 'Participate', 'params': {p: 'lectures/viewLectures.jsf'} }, { 'path': '/old/user', 'name': 'Participate', 'params': {p: 'lectures/viewLectures.jsf'} },
]}, ]},
]; ];
......
<left-menu [menu]="menu" styleClass="infoMenu"></left-menu> <!-- <left-menu [menu]="menu" styleClass="infoMenu"></left-menu> -->
import {Component, OnInit, Input} from '@angular/core'; import {Component, OnInit, Input} from '@angular/core';
import {MenuGroup} from '../models/menu-group.model'; import {MenuGroup} from '../models/menu-group.model';
import {MENU} from "../defines/menu";
@Component({ @Component({
selector: 'left-menu', selector: 'left-menu',
...@@ -8,10 +9,7 @@ import {MenuGroup} from '../models/menu-group.model'; ...@@ -8,10 +9,7 @@ import {MenuGroup} from '../models/menu-group.model';
}) })
export class LeftMenuComponent implements OnInit { export class LeftMenuComponent implements OnInit {
@Input()
menu: MenuGroup[]; menu: MenuGroup[];
@Input()
styleClass: string; styleClass: string;
constructor() { constructor() {
...@@ -19,6 +17,8 @@ export class LeftMenuComponent implements OnInit { ...@@ -19,6 +17,8 @@ export class LeftMenuComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.menu = MENU.INFO;
this.styleClass = "infoMenu";
} }
} }
<left-menu [menu]="menu" styleClass="userMenu"></left-menu> <!-- <left-menu [menu]="menu" styleClass="userMenu"></left-menu> -->
import { LoginRoutingModule } from './login-routing.module'; import { LoginRoutingModule } from './login-routing.module';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { LoginComponent } from './login.component'; import {LoginComponent} from "./login.component";
import { TopMenuComponent } from '../../menu/top-menu/top-menu.component';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
LoginRoutingModule LoginRoutingModule
], ],
declarations: [] declarations: [LoginComponent]
}) })
export class LoginModule { } export class LoginModule { }
import { OldMoyaComponent } from './../old-moya/old-moya.component'; import { OldMoyaComponent } from '../../modules/old-moya/old-moya.component';
import { AdminMenuComponent } from './../../menu/admin-menu/admin-menu.component';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { AdminComponent } from './admin.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', component: AdminMenuComponent, outlet: 'left-menu' }, { path: '', pathMatch: 'full', component: OldMoyaComponent },
{ path: '', pathMatch: 'full', component: AdminComponent },
{ path: 'old', component: OldMoyaComponent }
]; ];
@NgModule({ @NgModule({
......
import { PipesModule } from './../../shared/pipes/pipes.module'; import { PipesModule } from '../../shared/pipes/pipes.module';
import { OldMoyaComponent } from './old-moya.component'; import { OldMoyaComponent } from './old-moya.component';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
......
<mat-table #table [dataSource]="vips | async"> <mat-table #table [dataSource]="vips | async">
<ng-container matColumnDef="host"> <ng-container matColumnDef="host">
<mat-header-cell *matHeaderCellDef translate> vip.host </mat-header-cell> <mat-header-cell *matHeaderCellDef translate > vip.host </mat-header-cell>
<mat-cell *matCellDef="let v"> {{v.host.firstname}} {{ v.host.lastname}} </mat-cell> <mat-cell *matCellDef="let v" > {{v.host.firstname}} {{ v.host.lastname}} </mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="host"> <ng-container matColumnDef="shortdescr">
<mat-header-cell *matHeaderCellDef translate> vip.shortdescr </mat-header-cell> <mat-header-cell *matHeaderCellDef translate >vip.shortdescr </mat-header-cell>
<mat-cell *matCellDef="let v"> {{v.shortdescr}} </mat-cell> <mat-cell *matCellDef="let v"> {{v.shortdescr}} </mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="host"> <ng-container matColumnDef="description">
<mat-header-cell *matHeaderCellDef translate> vip.description </mat-header-cell> <mat-header-cell *matHeaderCellDef translate > vip.description </mat-header-cell>
<mat-cell *matCellDef="let v"> {{v.description}} </mat-cell> <mat-cell *matCellDef="let v"> {{v.description}} </mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="host"> <ng-container matColumnDef="products">
<mat-header-cell *matHeaderCellDef translate> vip.products </mat-header-cell> <mat-header-cell *matHeaderCellDef translate > vip.products </mat-header-cell>
<mat-cell *matCellDef="let v"> <mat-cell *matCellDef="let v">
<div *ngFor="let p of v.products" class="row"> <div *ngFor="let p of v.products" class="row">
<div style="display: inline-block;">{{p.name}}</div> <div style="display: inline-block;">{{p.name}}</div>
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
</mat-cell> </mat-cell>
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row> <mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table> </mat-table>
import {Component, NgZone, OnInit} from '@angular/core'; import {Component, NgZone, OnInit} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Vip} from '../../../shared/models/vip.model'; import {Vip} from '../models/vip.model';
import {ViplistService} from '../viplist.service'; import {ViplistService} from '../viplist.service';
@Component({ @Component({
......
import {VipProduct} from './vip-product.model'; import {VipProduct} from './vip-product.model';
import {User} from './user.model'; import {User} from '../../../shared/models/user.model';
/** /**
* Created by tuukka on 04/02/17. * Created by tuukka on 04/02/17.
*/ */
......
import { OldMoyaComponent } from './../old-moya/old-moya.component';
import { UserMenuComponent } from './../../menu/user-menu/user-menu.component';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { UserComponent } from './user.component';
import {InfoViplistPageComponent} from "./info/info-viplist-page.component";
const routes: Routes = [ const routes: Routes = [
{ path: '', pathMatch: 'full', component: UserComponent }, { path: '', component: InfoViplistPageComponent }
{ path: '', component: UserMenuComponent, outlet: 'left-menu' },
{ path: 'old', component: OldMoyaComponent }
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule] exports: [RouterModule]
}) })
export class UserRoutingModule { } export class ViplistRoutingModule { }
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {Vip} from '../../shared/models/vip.model'; import {Vip} from './models/vip.model';
import {User} from '../../shared/models/user.model'; import {User} from '../../shared/models/user.model';
import {UserService} from '../../shared/services/user.service'; import {UserService} from '../../shared/services/user.service';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminComponent } from './admin.component';
describe('AdminComponent', () => {
let component: AdminComponent;
let fixture: ComponentFixture<AdminComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdminComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'moya-admin',
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.scss']
})
export class AdminComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { OldMoyaModule } from './../old-moya/old-moya.module';
import { AdminMenuComponent } from './../../menu/admin-menu/admin-menu.component';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AdminRoutingModule } from './admin-routing.module';
import { AdminComponent } from './admin.component';
import { LeftMenuModule } from '../../menu/left-menu/left-menu.module';
@NgModule({
imports: [
CommonModule,
AdminRoutingModule,
LeftMenuModule,
OldMoyaModule
],
declarations: [AdminComponent, AdminMenuComponent]
})
export class AdminModule { }
import { InfoViplistPageComponent } from '../../modules/viplist/info/info-viplist-page.component';
import { OldMoyaComponent } from './../old-moya/old-moya.component';
import { InfoMenuComponent } from './../../menu/info-menu/info-menu.component';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { InfoComponent } from './info.component';
const routes: Routes = [
{ path: '', component: InfoMenuComponent, outlet: 'left-menu' },
{ path: '', pathMatch: 'full', component: OldMoyaComponent },
{ path: 'old', component: OldMoyaComponent },
{ path: 'viplist', component: InfoViplistPageComponent }
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class InfoRoutingModule { }
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InfoComponent } from './info.component';
describe('InfoComponent', () => {
let component: InfoComponent;
let fixture: ComponentFixture<InfoComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InfoComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InfoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'moya-info',
templateUrl: './info.component.html',
styleUrls: ['./info.component.scss']
})
export class InfoComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { OldMoyaModule } from './../old-moya/old-moya.module';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { InfoRoutingModule } from './info-routing.module';
import { InfoComponent } from './info.component';
import { InfoMenuComponent } from '../../menu/info-menu/info-menu.component';
import { LeftMenuModule } from '../../menu/left-menu/left-menu.module';
@NgModule({
imports: [
CommonModule,
InfoRoutingModule,
LeftMenuModule,
OldMoyaModule
],
declarations: [InfoComponent, InfoMenuComponent]
})
export class InfoModule { }
<p>
{{'test.user' | translate}} works!
</p>
<div translate>test.user</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserComponent } from './user.component';
describe('UserComponent', () => {
let component: UserComponent;
let fixture: ComponentFixture<UserComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UserComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'moya-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.scss']
})
export class UserComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { PipesModule } from './../../shared/pipes/pipes.module';
import { OldMoyaModule } from './../old-moya/old-moya.module';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { UserRoutingModule } from './user-routing.module';
import { UserComponent } from './user.component';
import { UserMenuComponent } from '../../menu/user-menu/user-menu.component';
import { LeftMenuModule } from '../../menu/left-menu/left-menu.module';
import { TranslateModule } from '@ngx-translate/core';
@NgModule({
imports: [
CommonModule,
UserRoutingModule,
LeftMenuModule,
OldMoyaModule,
TranslateModule.forRoot()
],
declarations: [UserComponent, UserMenuComponent]
})
export class UserModule { }
{ {
"test": { "test": {
"user": "User" "user": "User"
},
"general": {
"yes": "Yes",
"no": "No",
"save": "Save",
"edit": "Edit",
"control": "Control"
},
"vip": {
"host": "Host",
"shortdescr": "Name",
"description": "Description",
"products": "Products",
"deliver": "Deliver"
} }
} }
{ {
"test": { "test": {
"user": "Käyttäjä" "user": "Käyttäjä"
},
"general": {
"yes": "Kyllä",
"no": "Ei",
"save": "Tallenna",
"edit": "Muokkaa",
"control": "Hallitse"
},
"vip": {
"host": "Isäntä",
"shortdescr": "Nimi",
"description": "Kuvaus",
"products": "Tuotteet",
"deliver": "Toimita"
} }
} }
{ {
"test": { "test": {
"user": "Användare", "user": "Användare"
}, },
"general": { "general": {
"yes": "Ja", "yes": "Ja",
"no": "Nej", "no": "Nej",
"save": "Spara", "save": "Spara",
"edit": "Edigera", "edit": "Edigera",
"control": "Kontrollera", "control": "Kontrollera"
}, },
"vip": { "vip": {
"host": "Värd", "host": "Värd",
"shortdescr": "Namn", "shortdescr": "Namn",
"description": "Beskrivning", "description": "Beskrivning",
"products": "Produkter", "products": "Produkter",
"deliver": "Leverera", "deliver": "Leverera"
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!