mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 20:21:25 +08:00
REFACTOR: use tables instead of custom fields for polls (#6359)
Co-authored-by: Guo Xiang Tan <tgx_world@hotmail.com>
This commit is contained in:
@ -9,6 +9,10 @@ export default Ember.Controller.extend({
|
||||
numberPollType: "number",
|
||||
multiplePollType: "multiple",
|
||||
|
||||
alwaysPollResult: "always",
|
||||
votePollResult: "on_vote",
|
||||
closedPollResult: "on_close",
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
this._setupPoll();
|
||||
@ -32,6 +36,24 @@ export default Ember.Controller.extend({
|
||||
];
|
||||
},
|
||||
|
||||
@computed("alwaysPollResult", "votePollResult", "closedPollResult")
|
||||
pollResults(alwaysPollResult, votePollResult, closedPollResult) {
|
||||
return [
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_result.always"),
|
||||
value: alwaysPollResult
|
||||
},
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_result.vote"),
|
||||
value: votePollResult
|
||||
},
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_result.closed"),
|
||||
value: closedPollResult
|
||||
}
|
||||
];
|
||||
},
|
||||
|
||||
@computed("pollType", "regularPollType")
|
||||
isRegular(pollType, regularPollType) {
|
||||
return pollType === regularPollType;
|
||||
@ -128,6 +150,7 @@ export default Ember.Controller.extend({
|
||||
"isNumber",
|
||||
"showMinMax",
|
||||
"pollType",
|
||||
"pollResult",
|
||||
"publicPoll",
|
||||
"pollOptions",
|
||||
"pollMin",
|
||||
@ -141,6 +164,7 @@ export default Ember.Controller.extend({
|
||||
isNumber,
|
||||
showMinMax,
|
||||
pollType,
|
||||
pollResult,
|
||||
publicPoll,
|
||||
pollOptions,
|
||||
pollMin,
|
||||
@ -167,6 +191,7 @@ export default Ember.Controller.extend({
|
||||
}
|
||||
|
||||
if (pollType) pollHeader += ` type=${pollType}`;
|
||||
if (pollResult) pollHeader += ` results=${pollResult}`;
|
||||
if (pollMin && showMinMax) pollHeader += ` min=${pollMin}`;
|
||||
if (pollMax) pollHeader += ` max=${pollMax}`;
|
||||
if (isNumber) pollHeader += ` step=${step}`;
|
||||
|
Reference in New Issue
Block a user