-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
76 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
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 |
---|---|---|
@@ -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<PollModel>('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<PollModel>('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 <LoadingIndicator/>; | ||
} | ||
view(): Mithril.Children { | ||
if (this.loading) { | ||
return <LoadingIndicator />; | ||
} | ||
|
||
if (this.poll) { | ||
return ( | ||
<div className="PollsPage"> | ||
<div className="container"> | ||
<PollView poll={this.poll}/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
if (this.poll) { | ||
return ( | ||
<div className="PollsPage"> | ||
<div className="container"> | ||
<PollView poll={this.poll} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
} | ||
} |
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