Merge branch 'max_dev' of Software_Engineering_I/greenvironment-frontend into master

master
Trivernis 5 years ago committed by Gitea
commit fabb901d95

@ -9,14 +9,14 @@
</button> </button>
</mat-form-field> </mat-form-field>
<p id="check"> <p id="check">
<mat-checkbox color="primary" [(ngModel)]="checked">I protected the environment.</mat-checkbox> <mat-checkbox color="primary" [(ngModel)]="checked" checked="checked">I protected the environment.</mat-checkbox>
</p> </p>
<mat-form-field id="action-chooser" *ngIf="checked"> <mat-form-field id="action-chooser" *ngIf="checked">
<mat-label>What did you do?</mat-label> <mat-label>What did you do?</mat-label>
<mat-select [(ngModel)]="activityId" name="action"> <mat-select [(ngModel)]="activityId" name="action">
<mat-option>nothing ;)</mat-option> <mat-option>nothing ;)</mat-option>
<mat-option *ngFor="let action of actionlist.Actions" [value]="action.id" [matTooltip]="action.description" matTooltipShowDelay="200"> <mat-option *ngFor="let action of actionlist.Actions" [value]="action.id" [matTooltip]="action.description" matTooltipShowDelay="200">
{{action.name}} {{action.name}} ({{action.description}})
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -37,7 +37,7 @@
</div> </div>
<div id="chooser-div" style="text-align: center; margin-top: 1em;"> <div id="chooser-div" style="text-align: center; margin-top: 1em;">
<mat-button-toggle-group id="feedchooser" value="new"> <mat-button-toggle-group id="feedchooser" [(ngModel)]="view" value="view">
<mat-button-toggle (click)="showNew()" value="new">New</mat-button-toggle> <mat-button-toggle (click)="showNew()" value="new">New</mat-button-toggle>
<mat-button-toggle (click)="showMostLiked()" value="mostliked">Most Liked</mat-button-toggle> <mat-button-toggle (click)="showMostLiked()" value="mostliked">Most Liked</mat-button-toggle>
</mat-button-toggle-group> </mat-button-toggle-group>

@ -14,7 +14,8 @@ import { User } from 'src/app/models/user';
export class FeedComponent implements OnInit { export class FeedComponent implements OnInit {
loading = true; loading = true;
checked: boolean; // if the "I protected the environment."-box is checked checked = false; // if the "I protected the environment."-box is checked
view = 'new';
empty: any; empty: any;
// id of the green activity // id of the green activity
value: any; value: any;
@ -48,14 +49,16 @@ export class FeedComponent implements OnInit {
} }
createPost(pElement, activityId: string) { createPost(pElement, activityId: string) {
if (pElement && activityId) { if (pElement && activityId && this.checked) {
this.feedService.createPostActivity(pElement.value, activityId); this.feedService.createPostActivity(pElement.value, activityId);
pElement.value = ''; pElement.value = '';
this.empty = ''; this.empty = '';
this.view = 'new';
} else if (pElement) { } else if (pElement) {
this.feedService.createPost(pElement.value); this.feedService.createPost(pElement.value);
pElement.value = ''; pElement.value = '';
this.empty = ''; this.empty = '';
this.view = 'new';
} }
} }

@ -58,7 +58,7 @@
{{post.downvotes}} {{post.downvotes}}
<div *ngIf="post.activity" class="activity-info"> <div *ngIf="post.activity" class="activity-info">
<span class="span" [matTooltip]="post.activity.description" matTooltipShowDelay="200"> <span class="span" [matTooltip]="post.activity.description" matTooltipShowDelay="200">
{{post.activity.points}} points earned through {{post.activity.name}} {{post.activity.points}} points earned through <b>{{post.activity.name}}</b>
</span> </span>
</div> </div>
</mat-card-actions> </mat-card-actions>

Loading…
Cancel
Save