added poll component #93
This commit is contained in:
parent
34644e0652
commit
43ecbde31a
|
@ -60,6 +60,7 @@ import { AccountEmojiPipe } from './pipes/account-emoji.pipe';
|
||||||
import { CardComponent } from './components/stream/status/card/card.component';
|
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 { 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 { 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 = [
|
const routes: Routes = [
|
||||||
{ path: "", redirectTo: "home", pathMatch: "full" },
|
{ path: "", redirectTo: "home", pathMatch: "full" },
|
||||||
|
@ -108,7 +109,8 @@ const routes: Routes = [
|
||||||
AccountEmojiPipe,
|
AccountEmojiPipe,
|
||||||
CardComponent,
|
CardComponent,
|
||||||
ListEditorComponent,
|
ListEditorComponent,
|
||||||
ListAccountComponent
|
ListAccountComponent,
|
||||||
|
PollComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
FontAwesomeModule,
|
FontAwesomeModule,
|
||||||
|
|
|
@ -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>
|
|
@ -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();
|
||||||
|
});
|
||||||
|
});
|
|
@ -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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -67,6 +67,8 @@
|
||||||
(accountSelected)="accountSelected($event)" (hashtagSelected)="hashtagSelected($event)"
|
(accountSelected)="accountSelected($event)" (hashtagSelected)="hashtagSelected($event)"
|
||||||
(textSelected)="textSelected()"></app-databinded-text>
|
(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-card class="status__card" *ngIf="!isContentWarned && displayedStatus.card && !hasAttachments" [card]="displayedStatus.card"></app-card>
|
||||||
|
|
||||||
<app-attachements *ngIf="!isContentWarned && hasAttachments" class="attachments"
|
<app-attachements *ngIf="!isContentWarned && hasAttachments" class="attachments"
|
||||||
|
|
Loading…
Reference in New Issue