Compare commits
No commits in common. "947e8df1f70870b420e77a89a1dae436fad09607" and "53be9498af4e2d7e9fa46959b6ee3faa3f593efc" have entirely different histories.
947e8df1f7
...
53be9498af
|
@ -13,8 +13,6 @@ const checkMT = require('../middleware/permission-check').checkMT;
|
||||||
|
|
||||||
// Mongoose Model using mongoDB
|
// Mongoose Model using mongoDB
|
||||||
const CampaignModel = require('../models/campaign');
|
const CampaignModel = require('../models/campaign');
|
||||||
const WarModel = require('../models/war');
|
|
||||||
|
|
||||||
|
|
||||||
const campaigns = express.Router();
|
const campaigns = express.Router();
|
||||||
|
|
||||||
|
@ -68,10 +66,7 @@ campaigns.route('/:id')
|
||||||
err.status = codes.notfound;
|
err.status = codes.notfound;
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
WarModel.find({campaign: req.params.id}).remove().exec();
|
return next();
|
||||||
|
|
||||||
res.locals.processed = true;
|
|
||||||
next();
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
.overview {
|
|
||||||
position: fixed;
|
|
||||||
width: 25%;
|
|
||||||
min-width: 300px;
|
|
||||||
padding-left: 50px;
|
|
||||||
padding-top: 70px;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
<form #form="ngForm" class="overview">
|
|
||||||
<h3>Kampagne hinzufügen</h3>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="title">Titel</label>
|
|
||||||
<input type="text" class="form-control"
|
|
||||||
[(ngModel)]="campaign.title"
|
|
||||||
name="title"
|
|
||||||
id="title"
|
|
||||||
required maxlength="50"/>
|
|
||||||
|
|
||||||
<show-error text="Name" path="title"></show-error>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button id="cancel"
|
|
||||||
(click)="cancel()"
|
|
||||||
class="btn btn-default">
|
|
||||||
Abbrechen
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button id="save"
|
|
||||||
(click)="saveCampaign()"
|
|
||||||
class="btn btn-default"
|
|
||||||
[disabled]="!form.valid">
|
|
||||||
Bestätigen
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<span *ngIf="showErrorLabel"
|
|
||||||
class="center-block label label-danger" style="font-size: medium; padding: 2px; margin-top: 2px">
|
|
||||||
{{error}}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</form>
|
|
|
@ -1,44 +0,0 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
|
||||||
import {NgForm} from "@angular/forms";
|
|
||||||
import {Campaign} from "../../models/model-interfaces";
|
|
||||||
import {CampaignService} from "../../services/campaign-service/campaign.service";
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'campaign-submit',
|
|
||||||
templateUrl: './campaign-submit.component.html',
|
|
||||||
styleUrls: ['./campaign-submit.component.css']
|
|
||||||
})
|
|
||||||
export class CampaignSubmitComponent {
|
|
||||||
|
|
||||||
campaign: Campaign = {};
|
|
||||||
|
|
||||||
showErrorLabel = false;
|
|
||||||
|
|
||||||
error;
|
|
||||||
|
|
||||||
@ViewChild(NgForm) form: NgForm;
|
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
|
||||||
private router: Router,
|
|
||||||
private campaignService: CampaignService) {
|
|
||||||
}
|
|
||||||
|
|
||||||
saveCampaign() {
|
|
||||||
this.campaignService.submitCampaign(this.campaign)
|
|
||||||
.subscribe(campaign => {
|
|
||||||
this.router.navigate(['../overview/' + campaign._id], {relativeTo: this.route});
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
this.error = error._body.error.message;
|
|
||||||
this.showErrorLabel = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
cancel() {
|
|
||||||
this.router.navigate(['..'], {relativeTo: this.route});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -6,7 +6,6 @@ import {WarListComponent} from "./war-list/war-list.component";
|
||||||
import {StatisticOverviewComponent} from "./overview/stats-overview.component";
|
import {StatisticOverviewComponent} from "./overview/stats-overview.component";
|
||||||
import {WarItemComponent} from "./war-list/war-item.component";
|
import {WarItemComponent} from "./war-list/war-item.component";
|
||||||
import {ModuleWithProviders} from "@angular/core";
|
import {ModuleWithProviders} from "@angular/core";
|
||||||
import {CampaignSubmitComponent} from "./campaign-submit/campaign-submit.component";
|
|
||||||
|
|
||||||
|
|
||||||
export const statsRoutes: Routes = [{
|
export const statsRoutes: Routes = [{
|
||||||
|
@ -23,11 +22,6 @@ export const statsRoutes: Routes = [{
|
||||||
component: StatisticOverviewComponent,
|
component: StatisticOverviewComponent,
|
||||||
outlet: 'right'
|
outlet: 'right'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'new-campaign',
|
|
||||||
component: CampaignSubmitComponent,
|
|
||||||
outlet: 'right'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: 'new',
|
path: 'new',
|
||||||
component: WarSubmitComponent,
|
component: WarSubmitComponent,
|
||||||
|
@ -41,6 +35,6 @@ export const statsRoutes: Routes = [{
|
||||||
|
|
||||||
export const statsRouterModule: ModuleWithProviders = RouterModule.forChild(statsRoutes);
|
export const statsRouterModule: ModuleWithProviders = RouterModule.forChild(statsRoutes);
|
||||||
|
|
||||||
export const statsRoutingComponents = [StatisticComponent, StatisticOverviewComponent, CampaignSubmitComponent,
|
export const statsRoutingComponents = [StatisticComponent, StatisticOverviewComponent, WarListComponent,
|
||||||
WarListComponent, WarSubmitComponent, WarDetailComponent, WarItemComponent];
|
WarSubmitComponent, WarDetailComponent, WarItemComponent];
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,6 @@ export class WarListComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
selectNewCampaign() {
|
|
||||||
this.selectedWarId = null;
|
|
||||||
this.router.navigate([{outlets: {'right': ['new-campaign']}}], {relativeTo: this.route});
|
|
||||||
}
|
|
||||||
|
|
||||||
selectNewWar() {
|
selectNewWar() {
|
||||||
this.selectedWarId = null;
|
this.selectedWarId = null;
|
||||||
this.router.navigate([{outlets: {'right': ['new']}}], {relativeTo: this.route});
|
this.router.navigate([{outlets: {'right': ['new']}}], {relativeTo: this.route});
|
||||||
|
|
|
@ -6,3 +6,24 @@
|
||||||
padding-top: 70px;
|
padding-top: 70px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.load-arrow {
|
||||||
|
background: url(../../../assets/loading.png) no-repeat;
|
||||||
|
display: block;
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Loading Animation */
|
||||||
|
.glyphicon-refresh-animate {
|
||||||
|
animation: spin 1.5s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
id="campaign"
|
id="campaign"
|
||||||
[(ngModel)]="war.campaign"
|
[(ngModel)]="war.campaign"
|
||||||
required>
|
required>
|
||||||
<option *ngFor="let campaign of campaignService.campaigns" [ngValue]="campaign._id">
|
<option *ngFor="let campaign of warService.campaigns" [ngValue]="campaign._id">
|
||||||
{{campaign.title}}
|
{{campaign.title}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from "@angular/forms";
|
||||||
import {WarService} from "../../services/war-service/war.service";
|
import {WarService} from "../../services/war-service/war.service";
|
||||||
import {War} from "../../models/model-interfaces";
|
import {War} from "../../models/model-interfaces";
|
||||||
import {CampaignService} from "../../services/campaign-service/campaign.service";
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -29,8 +28,7 @@ export class WarSubmitComponent {
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private warService: WarService,
|
private warService: WarService) {
|
||||||
private campaignService: CampaignService) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileChange(event) {
|
fileChange(event) {
|
||||||
|
|
Loading…
Reference in New Issue