diff --git a/api/routes/users.js b/api/routes/users.js index 6e98986..3a33a0d 100644 --- a/api/routes/users.js +++ b/api/routes/users.js @@ -91,8 +91,11 @@ users.route('/') return next(err); } res.status(codes.created); - res.locals.items = user; - next(); + getExtendedUser(user, next, (extUser) => { + res.locals.items = extUser; + res.locals.processed = true; + return next(); + }) }); }) diff --git a/static/src/app/army/army.component.ts b/static/src/app/army/army.component.ts index 8c71381..e1dfa52 100644 --- a/static/src/app/army/army.component.ts +++ b/static/src/app/army/army.component.ts @@ -10,17 +10,15 @@ import {ArmyService} from "../services/army-service/army.service"; }) export class ArmyComponent { - army: Army = {NATO: {squads: [], memberCount: 0}, CSAT: {squads: [], memberCount:0}}; + army: Army = {NATO: {squads: [], memberCount: 0}, CSAT: {squads: [], memberCount: 0}}; constructor(private armyService: ArmyService) { } - ngOnInit() { this.armyService.getArmy() .subscribe(army => { this.army = army; - console.log(army) }); }; } diff --git a/static/src/app/users/new-user/new-user.component.css b/static/src/app/users/new-user/new-user.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/static/src/app/users/new-user/new-user.component.html b/static/src/app/users/new-user/new-user.component.html deleted file mode 100644 index 500df9a..0000000 --- a/static/src/app/users/new-user/new-user.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
diff --git a/static/src/app/users/new-user/new-user.component.ts b/static/src/app/users/new-user/new-user.component.ts deleted file mode 100644 index 61beda0..0000000 --- a/static/src/app/users/new-user/new-user.component.ts +++ /dev/null @@ -1,50 +0,0 @@ -import {Component, ViewChild} from "@angular/core"; -import {ActivatedRoute, Router} from "@angular/router"; -import {NgForm} from "@angular/forms"; -import {User} from "../../models/model-interfaces"; -import {UserService} from "../../services/user-service/user.service"; - - -@Component({ - templateUrl: './new-user.component.html', - styleUrls: ['./new-user.component.css', '../../style/new-entry-form.css'] -}) -export class CreateUserComponent { - - user: User = {}; - - saved = false; - - @ViewChild(NgForm) form: NgForm; - - constructor(private route: ActivatedRoute, - private router: Router, - private userService: UserService) { - } - - ngOnInit() { - - } - - saveUser() { - this.userService.submitUser(this.user) - .subscribe(user => { - this.saved = true; - this.router.navigate(['../overview', user._id], {relativeTo: this.route}); - }) - } - - cancel() { - //this.location.back(); - this.router.navigate(['/cc-users']); - return false; - } - - canDeactivate(): boolean { - if (this.saved || !this.form.dirty) { - return true; - } - return window.confirm(`Ihr Formular besitzt ungespeicherte Änderungen, möchten Sie die Seite wirklich verlassen?`); - } - -} diff --git a/static/src/app/users/user-list/user-list.component.ts b/static/src/app/users/user-list/user-list.component.ts index 758de15..91de1c3 100644 --- a/static/src/app/users/user-list/user-list.component.ts +++ b/static/src/app/users/user-list/user-list.component.ts @@ -48,7 +48,8 @@ export class UserListComponent implements OnInit { } openNewUserForm() { - this.router.navigate([{outlets: {'right': ['new']}}], {relativeTo: this.route}); + this.selectedUserId = null; + this.router.navigate([{outlets: {'right': ['overview']}}], {relativeTo: this.route}); } selectUser(userId: string) { diff --git a/static/src/app/users/user-overview/user-overview.component.html b/static/src/app/users/user-overview/user-overview.component.html index a60aba0..5e18fee 100644 --- a/static/src/app/users/user-overview/user-overview.component.html +++ b/static/src/app/users/user-overview/user-overview.component.html @@ -1,5 +1,6 @@