Compare commits

..

No commits in common. "947e8df1f70870b420e77a89a1dae436fad09607" and "53be9498af4e2d7e9fa46959b6ee3faa3f593efc" have entirely different histories.

9 changed files with 26 additions and 108 deletions

View File

@ -13,8 +13,6 @@ const checkMT = require('../middleware/permission-check').checkMT;
// Mongoose Model using mongoDB
const CampaignModel = require('../models/campaign');
const WarModel = require('../models/war');
const campaigns = express.Router();
@ -68,10 +66,7 @@ campaigns.route('/:id')
err.status = codes.notfound;
return next(err);
}
WarModel.find({campaign: req.params.id}).remove().exec();
res.locals.processed = true;
next();
return next();
})
})

View File

@ -1,8 +0,0 @@
.overview {
position: fixed;
width: 25%;
min-width: 300px;
padding-left: 50px;
padding-top: 70px;
margin-left: 10px;
}

View File

@ -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>

View File

@ -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;
}
}

View File

@ -6,7 +6,6 @@ import {WarListComponent} from "./war-list/war-list.component";
import {StatisticOverviewComponent} from "./overview/stats-overview.component";
import {WarItemComponent} from "./war-list/war-item.component";
import {ModuleWithProviders} from "@angular/core";
import {CampaignSubmitComponent} from "./campaign-submit/campaign-submit.component";
export const statsRoutes: Routes = [{
@ -23,11 +22,6 @@ export const statsRoutes: Routes = [{
component: StatisticOverviewComponent,
outlet: 'right'
},
{
path: 'new-campaign',
component: CampaignSubmitComponent,
outlet: 'right'
},
{
path: 'new',
component: WarSubmitComponent,
@ -41,6 +35,6 @@ export const statsRoutes: Routes = [{
export const statsRouterModule: ModuleWithProviders = RouterModule.forChild(statsRoutes);
export const statsRoutingComponents = [StatisticComponent, StatisticOverviewComponent, CampaignSubmitComponent,
WarListComponent, WarSubmitComponent, WarDetailComponent, WarItemComponent];
export const statsRoutingComponents = [StatisticComponent, StatisticOverviewComponent, WarListComponent,
WarSubmitComponent, WarDetailComponent, WarItemComponent];

View File

@ -31,11 +31,6 @@ export class WarListComponent implements OnInit {
});
}
selectNewCampaign() {
this.selectedWarId = null;
this.router.navigate([{outlets: {'right': ['new-campaign']}}], {relativeTo: this.route});
}
selectNewWar() {
this.selectedWarId = null;
this.router.navigate([{outlets: {'right': ['new']}}], {relativeTo: this.route});

View File

@ -6,3 +6,24 @@
padding-top: 70px;
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);
}
}

View File

@ -49,7 +49,7 @@
id="campaign"
[(ngModel)]="war.campaign"
required>
<option *ngFor="let campaign of campaignService.campaigns" [ngValue]="campaign._id">
<option *ngFor="let campaign of warService.campaigns" [ngValue]="campaign._id">
{{campaign.title}}
</option>
</select>

View File

@ -3,7 +3,6 @@ import {ActivatedRoute, Router} from "@angular/router";
import {NgForm} from "@angular/forms";
import {WarService} from "../../services/war-service/war.service";
import {War} from "../../models/model-interfaces";
import {CampaignService} from "../../services/campaign-service/campaign.service";
@Component({
@ -29,8 +28,7 @@ export class WarSubmitComponent {
constructor(private route: ActivatedRoute,
private router: Router,
private warService: WarService,
private campaignService: CampaignService) {
private warService: WarService) {
}
fileChange(event) {