mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Add default values when no value has been selected.
This commit is contained in:
parent
ba87181506
commit
e1cfe7536c
@ -70,12 +70,12 @@ export default Ember.Controller.extend({
|
||||
@computed("isMultiple", "isNumber", "pollOptionsCount", "pollMin", "pollStep")
|
||||
pollMaxOptions(isMultiple, isNumber, count, pollMin, pollStep) {
|
||||
if (!isMultiple && !isNumber) return;
|
||||
const pollMinInt = parseInt(pollMin);
|
||||
const pollMinInt = parseInt(pollMin) || 1;
|
||||
|
||||
if (isMultiple) {
|
||||
return this._comboboxOptions(pollMinInt + 1, count + 1);
|
||||
} else if (isNumber) {
|
||||
const pollStepInt = parseInt(pollStep);
|
||||
const pollStepInt = parseInt(pollStep) || 1;
|
||||
return this._comboboxOptions(pollMinInt + 1, pollMinInt + (this.siteSettings.poll_maximum_options * pollStepInt));
|
||||
}
|
||||
},
|
||||
@ -83,7 +83,7 @@ export default Ember.Controller.extend({
|
||||
@computed("isNumber", "pollMax")
|
||||
pollStepOptions(isNumber, pollMax) {
|
||||
if (!isNumber) return;
|
||||
return this._comboboxOptions(1, parseInt(pollMax) + 1);
|
||||
return this._comboboxOptions(1, (parseInt(pollMax) || 1) + 1);
|
||||
},
|
||||
|
||||
@computed("isNumber", "showMinMax", "pollName", "pollType", "publicPoll", "pollOptions", "pollMin", "pollMax", "pollStep")
|
||||
|
Loading…
Reference in New Issue
Block a user