-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from Morphclue/fix/poll-info
New Poll Info in Dashboard and Poll View
- Loading branch information
Showing
7 changed files
with
111 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
apps/frontend/src/app/core/info-table/info-table.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<table class="w-100"> | ||
@if (poll.location; as location) { | ||
<tr> | ||
<th> | ||
<i [class]="location | locationIcon" ngbTooltip="Location"></i> | ||
</th> | ||
<td> | ||
<app-location-link [location]="location"></app-location-link> | ||
</td> | ||
</tr> | ||
} | ||
@if (poll.settings.deadline; as deadline) { | ||
<tr> | ||
<th> | ||
<i class="bi-calendar" ngbTooltip="Deadline"></i> | ||
</th> | ||
<td> | ||
{{ deadline | date: 'medium' }} | ||
</td> | ||
</tr> | ||
} | ||
@if (description && poll.description; as description) { | ||
<tr> | ||
<th> | ||
<i class="bi-text-paragraph" ngbTooltip="Description"></i> | ||
</th> | ||
<td> | ||
<app-markdown [text]="description"></app-markdown> | ||
</td> | ||
</tr> | ||
} | ||
<tr> | ||
<th> | ||
<i class="bi-link" ngbTooltip="Link"></i> | ||
</th> | ||
<td> | ||
<a routerLink="." class="text-truncate">{{ url }}</a> | ||
| ||
<button class="btn p-0 btn-link bi-clipboard" ngbTooltip="Copy to clipboard" | ||
(click)="copyToClipboard()"></button> | ||
</td> | ||
</tr> | ||
@if (stats) { | ||
<tr> | ||
<th> | ||
<i class="bi-calendar-check"></i> | ||
</th> | ||
<td> | ||
{{ poll.events }} {poll.events, plural, =1 {Option} other {Options}} | ||
</td> | ||
</tr> | ||
<tr> | ||
<th> | ||
<i class="bi-person-check"></i> | ||
</th> | ||
<td> | ||
{{ poll.participants }} {poll.participants, plural, =1 {Participant} other {Participants}} | ||
</td> | ||
</tr> | ||
} | ||
</table> |
5 changes: 5 additions & 0 deletions
5
apps/frontend/src/app/core/info-table/info-table.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
table > tr > th:first-child { | ||
width: 2rem; | ||
padding: 0; | ||
vertical-align: top; | ||
} |
34 changes: 34 additions & 0 deletions
34
apps/frontend/src/app/core/info-table/info-table.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Component, Input, OnInit} from '@angular/core'; | ||
import {ToastService} from '@mean-stream/ngbx'; | ||
|
||
import {ReadPoll} from '../../model'; | ||
|
||
@Component({ | ||
selector: 'apollusia-info-table', | ||
templateUrl: './info-table.component.html', | ||
styleUrl: './info-table.component.scss', | ||
}) | ||
export class InfoTableComponent implements OnInit { | ||
@Input({required: true}) poll: ReadPoll; | ||
@Input() description = true; | ||
@Input() stats = false; | ||
|
||
url = ''; | ||
|
||
constructor( | ||
private toastService: ToastService, | ||
) { | ||
} | ||
|
||
ngOnInit() { | ||
this.url = `${document.baseURI}poll/${this.poll.id}/participate`; | ||
} | ||
|
||
copyToClipboard() { | ||
navigator.clipboard.writeText(this.url).then(() => { | ||
this.toastService.success('Copy Poll Link', 'Successfully copied link to clipboard'); | ||
}).catch(e => { | ||
this.toastService.error('Copy Poll Link', 'Failed to copy link to clipboard', e); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters