Compare commits

..

No commits in common. "e92cb6d59f4b1027f325c57c3524cba90e8be6f8" and "3bb7bd0e1d198d87d09f63c04e4912642e4f5af1" have entirely different histories.

6 changed files with 16 additions and 23 deletions

View File

@ -6,9 +6,9 @@
"scripts": { "scripts": {
"start": "npm run deploy-static-prod && npm start --prefix ./api", "start": "npm run deploy-static-prod && npm start --prefix ./api",
"dev": "npm run deploy-static && npm run dev --prefix ./api", "dev": "npm run deploy-static && npm run dev --prefix ./api",
"pre-deploy-clean": "rm -f ./public/resource", "pre-deploy-clean": "unlink ./public/resource",
"deploy-static": "npm run pre-deploy-clean && npm run build --prefix=static && npm run deploy-static:link-resource && npm run deploy-static:api-docs", "deploy-static": "npm run pre-deploy-clean && npm run build --prefix=static && npm run deploy-static:link-resource && npm run deploy-static:api-docs",
"deploy-static:prod": "npm run pre-deploy-clean && npm run build:prod --prefix=static && npm run deploy-static:link-resource && npm run deploy-static:api-docs", "deploy-static:prod": "pre-deploy-clean && npm run build:prod --prefix=static && npm run deploy-static:link-resource && npm run deploy-static:api-docs",
"deploy-static:link-resource": "ln -s ../api/resource/ public/resource", "deploy-static:link-resource": "ln -s ../api/resource/ public/resource",
"deploy-static:api-docs": "npm run api:docs --prefix=api", "deploy-static:api-docs": "npm run api:docs --prefix=api",
"postinstall": "npm install --prefix ./static && npm install --prefix ./api", "postinstall": "npm install --prefix ./static && npm install --prefix ./api",

View File

@ -8,7 +8,6 @@ import {Rank} from '../../models/model-interfaces';
import {RankService} from '../../services/army-management/rank.service'; import {RankService} from '../../services/army-management/rank.service';
import {Fraction} from '../../utils/fraction.enum'; import {Fraction} from '../../utils/fraction.enum';
import {UIHelpers} from '../../utils/global.helpers'; import {UIHelpers} from '../../utils/global.helpers';
import {MatButtonToggleGroup} from "@angular/material";
@Component({ @Component({
selector: 'rank-list', selector: 'rank-list',
@ -62,7 +61,7 @@ export class RankListComponent implements OnInit {
this.router.navigate([{outlets: {'right': ['edit', rankId]}}], {relativeTo: this.route}); this.router.navigate([{outlets: {'right': ['edit', rankId]}}], {relativeTo: this.route});
} }
filterRanks(group: MatButtonToggleGroup) { filterRanks(group) {
this.radioModel = UIHelpers.toggleReleaseButton(this.radioModel, group); this.radioModel = UIHelpers.toggleReleaseButton(this.radioModel, group);
this.ranks$ = this.rankService.findRanks(this.searchTerm.value, this.radioModel); this.ranks$ = this.rankService.findRanks(this.searchTerm.value, this.radioModel);
} }
@ -82,4 +81,5 @@ export class RankListComponent implements OnInit {
this.location.replaceState(absoluteUrl, queryPart); this.location.replaceState(absoluteUrl, queryPart);
} }
} }

View File

@ -1,13 +1,9 @@
<div class="select-list"> <div class="select-list">
<div class="list-header"> <div class="input-group list-header pull-left">
<mat-button-toggle-group #group="matButtonToggleGroup"> <div class="btn-group" (click)="filterSquads()">
<mat-button-toggle value="BLUFOR" (change)="filterSquads(group)"> <label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="blufor" uncheckable>{{fraction.BLUFOR}}</label>
{{fraction.BLUFOR}} <label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="opfor" uncheckable>{{fraction.OPFOR}}</label>
</mat-button-toggle> </div>
<mat-button-toggle value="OPFOR" (change)="filterSquads(group)">
{{fraction.OPFOR}}
</mat-button-toggle>
</mat-button-toggle-group>
<a class="pull-right btn btn-success" (click)="openNewSquadForm()">+</a> <a class="pull-right btn btn-success" (click)="openNewSquadForm()">+</a>
</div> </div>

View File

@ -7,8 +7,6 @@ import {Observable} from 'rxjs/Observable';
import {Squad} from '../../models/model-interfaces'; import {Squad} from '../../models/model-interfaces';
import {SquadService} from '../../services/army-management/squad.service'; import {SquadService} from '../../services/army-management/squad.service';
import {Fraction} from '../../utils/fraction.enum'; import {Fraction} from '../../utils/fraction.enum';
import {UIHelpers} from "../../utils/global.helpers";
import {MatButtonToggleGroup} from "@angular/material";
@Component({ @Component({
selector: 'squad-list', selector: 'squad-list',
@ -71,8 +69,7 @@ export class SquadListComponent implements OnInit {
} }
} }
filterSquads(group: MatButtonToggleGroup) { filterSquads() {
this.radioModel = UIHelpers.toggleReleaseButton(this.radioModel, group);
this.squads$ = this.squadService.findSquads(this.searchTerm.value, this.radioModel); this.squads$ = this.squadService.findSquads(this.searchTerm.value, this.radioModel);
} }
@ -82,4 +79,5 @@ export class SquadListComponent implements OnInit {
this.location.replaceState(absoluteUrl, queryPart); this.location.replaceState(absoluteUrl, queryPart);
} }
} }

View File

@ -4,11 +4,11 @@ import {SharedModule} from '../shared.module';
import {squadRouterModule, squadsRoutingComponents} from './squads.routing'; import {squadRouterModule, squadsRoutingComponents} from './squads.routing';
import {SquadStore} from '../services/stores/squad.store'; import {SquadStore} from '../services/stores/squad.store';
import {SquadService} from '../services/army-management/squad.service'; import {SquadService} from '../services/army-management/squad.service';
import {MatButtonToggleModule} from "@angular/material"; import {ButtonsModule} from 'ngx-bootstrap';
@NgModule({ @NgModule({
declarations: squadsRoutingComponents, declarations: squadsRoutingComponents,
imports: [CommonModule, SharedModule, MatButtonToggleModule, squadRouterModule], imports: [CommonModule, SharedModule, ButtonsModule.forRoot(), squadRouterModule],
providers: [SquadStore, SquadService] providers: [SquadStore, SquadService]
}) })
export class SquadsModule { export class SquadsModule {

View File

@ -1,5 +1,3 @@
import {MatButtonToggleGroup} from "@angular/material";
export const CSSHelpers = { export const CSSHelpers = {
getBackgroundCSS: (imageUrl) => { getBackgroundCSS: (imageUrl) => {
return 'background-image: url(' + imageUrl + ');' + return 'background-image: url(' + imageUrl + ');' +
@ -11,11 +9,12 @@ export const CSSHelpers = {
}; };
export const UIHelpers = { export const UIHelpers = {
toggleReleaseButton: (currentVal, group: MatButtonToggleGroup) => { toggleReleaseButton: (currentVal, group) => {
if (currentVal === group.value) { if (currentVal === group.value) {
group.value = ''; group.value = '';
return ''; return '';
} else {
return group.value;
} }
return group.value;
} }
}; };