added poll component #93

This commit is contained in:
Nicolas Constant 2019-06-03 01:33:07 -04:00
parent 34644e0652
commit 43ecbde31a
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
6 changed files with 60 additions and 1 deletions

View File

@ -60,6 +60,7 @@ import { AccountEmojiPipe } from './pipes/account-emoji.pipe';
import { CardComponent } from './components/stream/status/card/card.component';
import { ListEditorComponent } from './components/floating-column/manage-account/my-account/list-editor/list-editor.component';
import { ListAccountComponent } from './components/floating-column/manage-account/my-account/list-editor/list-account/list-account.component';
import { PollComponent } from './components/stream/status/poll/poll.component';
const routes: Routes = [
{ path: "", redirectTo: "home", pathMatch: "full" },
@ -108,7 +109,8 @@ const routes: Routes = [
AccountEmojiPipe,
CardComponent,
ListEditorComponent,
ListAccountComponent
ListAccountComponent,
PollComponent
],
imports: [
FontAwesomeModule,

View File

@ -0,0 +1,8 @@
<div class="poll">
<div *ngFor="let o of poll.options">
<input id="{{o.title}}" type="{{choiceType}}" name="poll" value="{{o.title}}">
<label for="{{o.title}}">{{o.title}}</label>
<br/>
</div>
<a href >Vote</a> <span>{{poll.votes_count}} votes - X days left</span>
</div>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PollComponent } from './poll.component';
xdescribe('PollComponent', () => {
let component: PollComponent;
let fixture: ComponentFixture<PollComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PollComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PollComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,22 @@
import { Component, OnInit, Input } from '@angular/core';
import { Poll } from '../../../../services/models/mastodon.interfaces';
@Component({
selector: 'app-poll',
templateUrl: './poll.component.html',
styleUrls: ['./poll.component.scss']
})
export class PollComponent implements OnInit {
// choiceType: string = 'radio';
choiceType: string = 'checkbox';
@Input() poll: Poll;
constructor() { }
ngOnInit() {
}
}

View File

@ -67,6 +67,8 @@
(accountSelected)="accountSelected($event)" (hashtagSelected)="hashtagSelected($event)"
(textSelected)="textSelected()"></app-databinded-text>
<app-poll *ngIf="!isContentWarned && displayedStatus.poll" [poll]="displayedStatus.poll"></app-poll>
<app-card class="status__card" *ngIf="!isContentWarned && displayedStatus.card && !hasAttachments" [card]="displayedStatus.card"></app-card>
<app-attachements *ngIf="!isContentWarned && hasAttachments" class="attachments"