|
|
|
@ -3,6 +3,7 @@ import {BaseComponent} from "../base-page/base.component";
|
|
|
|
|
import {ConfigService} from "../../services/config.service";
|
|
|
|
|
import {mockPoll3} from "../../config/mocks/mock-poll3";
|
|
|
|
|
import {mockComments} from "../../config/mocks/mock-comments";
|
|
|
|
|
import {ActivatedRoute} from "@angular/router";
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'framadate-poll-display',
|
|
|
|
@ -14,13 +15,28 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
|
|
|
|
|
private pollConfigFetched = mockPoll3;
|
|
|
|
|
private comments = mockComments;
|
|
|
|
|
|
|
|
|
|
constructor(public config: ConfigService) {
|
|
|
|
|
constructor(public config: ConfigService,
|
|
|
|
|
public activeRoute: ActivatedRoute) {
|
|
|
|
|
super(config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
// fetch poll with its ID or slug.
|
|
|
|
|
// store it in the poll property here
|
|
|
|
|
const id = this.activeRoute.snapshot.params.poll;
|
|
|
|
|
if (id) {
|
|
|
|
|
this.config.pollId = id;
|
|
|
|
|
// store it in the poll property here
|
|
|
|
|
this.config.getPollById(id).subscribe(
|
|
|
|
|
(res: any) => {
|
|
|
|
|
this.pollConfigFetched = res;
|
|
|
|
|
}, (e) => {
|
|
|
|
|
// handle need for a password
|
|
|
|
|
this.config.handleError(e)
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|