diff --git a/js/src/forum/components/PollView.tsx b/js/src/forum/components/PollView.tsx index 620dc0bf..29a0b0d9 100644 --- a/js/src/forum/components/PollView.tsx +++ b/js/src/forum/components/PollView.tsx @@ -38,9 +38,7 @@ export default class PollView extends Component { {/*
*/} -
- {this.createMainView().toArray()} -
+
{this.createMainView().toArray()}
); } @@ -48,18 +46,9 @@ export default class PollView extends Component { createMainView(): ItemList { const items = new ItemList(); const poll = this.attrs.poll; - items.add( - 'title', -

{poll.question()}

- ); - items.add( - 'subtitle', -

{poll.subtitle()}

- ); - items.add( - 'form', - this.createFormView() - ); + items.add('title',

{poll.question()}

); + items.add('subtitle',

{poll.subtitle()}

); + items.add('form', this.createFormView()); return items; } @@ -68,18 +57,25 @@ export default class PollView extends Component { const poll = this.attrs.poll; const infoItems = this.infoItems(poll.maxVotes()); - return (
-
- Antworten - -
-
- {!infoItems.isEmpty() &&
{infoItems.toArray()}
} - -
-
) + return ( +
+
+ Antworten + +
+
+ {!infoItems.isEmpty() &&
{infoItems.toArray()}
} + +
+
+ ); } deletePoll(): void { @@ -92,17 +88,17 @@ export default class PollView extends Component { controlsView(controls: Mithril.ChildArray): Mithril.Children { return ( - !!controls.length && ( - - {controls} - - ) + !!controls.length && ( + + {controls} + + ) ); } diff --git a/js/src/forum/components/PollViewPage.tsx b/js/src/forum/components/PollViewPage.tsx index b3dd0794..acff8a7e 100644 --- a/js/src/forum/components/PollViewPage.tsx +++ b/js/src/forum/components/PollViewPage.tsx @@ -1,46 +1,46 @@ -import type Mithril from "mithril"; +import type Mithril from 'mithril'; import app from 'flarum/forum/app'; -import Page from "flarum/common/components/Page"; -import PollModel from "../models/Poll"; -import extractText from "flarum/common/utils/extractText"; -import LoadingIndicator from "flarum/common/components/LoadingIndicator"; -import PollView from "./PollView"; +import Page from 'flarum/common/components/Page'; +import PollModel from '../models/Poll'; +import extractText from 'flarum/common/utils/extractText'; +import LoadingIndicator from 'flarum/common/components/LoadingIndicator'; +import PollView from './PollView'; export default class PollViewPage extends Page { - poll: PollModel | null = null; - loading: boolean = false; + poll: PollModel | null = null; + loading: boolean = false; - oninit(vnode: Mithril.Vnode) { - super.oninit(vnode); + oninit(vnode: Mithril.Vnode) { + super.oninit(vnode); - const editId = m.route.param('id'); - this.poll = app.store.getById('poll', editId) as PollModel; + const editId = m.route.param('id'); + this.poll = app.store.getById('poll', editId) as PollModel; - if (!this.poll) { - this.loading = true; + if (!this.poll) { + this.loading = true; - app.store.find('fof/polls', editId).then((item) => { - this.poll = item; - this.loading = false; - app.setTitle(extractText(app.translator.trans('fof-polls.forum.page.poll_detail'))); - m.redraw(); - }); - } + app.store.find('fof/polls', editId).then((item) => { + this.poll = item; + this.loading = false; + app.setTitle(extractText(app.translator.trans('fof-polls.forum.page.poll_detail'))); + m.redraw(); + }); } + } - view(): Mithril.Children { - if (this.loading) { - return ; - } + view(): Mithril.Children { + if (this.loading) { + return ; + } - if (this.poll) { - return ( -
-
- -
-
- ); - } + if (this.poll) { + return ( +
+
+ +
+
+ ); } -} \ No newline at end of file + } +} diff --git a/js/src/forum/extend.ts b/js/src/forum/extend.ts index 1900d23d..9442fe09 100644 --- a/js/src/forum/extend.ts +++ b/js/src/forum/extend.ts @@ -8,7 +8,7 @@ import PollOption from './models/PollOption'; import PollVote from './models/PollVote'; import PollsPage from './components/PollsPage'; import ComposePollPage from './components/ComposePollPage'; -import PollViewPage from "./components/PollViewPage"; +import PollViewPage from './components/PollViewPage'; export default [ new Extend.Routes() // diff --git a/js/src/forum/states/PollState.ts b/js/src/forum/states/PollState.ts index 7b11ba53..4da94b00 100644 --- a/js/src/forum/states/PollState.ts +++ b/js/src/forum/states/PollState.ts @@ -64,11 +64,11 @@ export default class PollState { m.redraw(); } - hasSelectedOptions():boolean { + hasSelectedOptions(): boolean { return this.pendingSubmit; } - onsubmit():Promise { + onsubmit(): Promise { return this.submit(this.pendingOptions!, () => { this.pendingOptions = null; this.pendingSubmit = false;