improved posts

master
Max 5 years ago
parent 41e8ce01ac
commit 740efb49ba

@ -9,14 +9,14 @@
</button>
</mat-form-field>
<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>
<mat-form-field id="action-chooser" *ngIf="checked">
<mat-label>What did you do?</mat-label>
<mat-select [(ngModel)]="activityId" name="action">
<mat-option>nothing ;)</mat-option>
<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-select>
</mat-form-field>
@ -37,7 +37,7 @@
</div>
<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)="showMostLiked()" value="mostliked">Most Liked</mat-button-toggle>
</mat-button-toggle-group>

@ -14,7 +14,8 @@ import { User } from 'src/app/models/user';
export class FeedComponent implements OnInit {
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;
// id of the green activity
value: any;
@ -48,14 +49,16 @@ export class FeedComponent implements OnInit {
}
createPost(pElement, activityId: string) {
if (pElement && activityId) {
if (pElement && activityId && this.checked) {
this.feedService.createPostActivity(pElement.value, activityId);
pElement.value = '';
this.empty = '';
this.view = 'new';
} else if (pElement) {
this.feedService.createPost(pElement.value);
pElement.value = '';
this.empty = '';
this.view = 'new';
}
}

@ -58,7 +58,7 @@
{{post.downvotes}}
<div *ngIf="post.activity" class="activity-info">
<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>
</div>
</mat-card-actions>

Loading…
Cancel
Save