diff --git a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 index 391a5d76acf..19cfc33d6d2 100644 --- a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 +++ b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 @@ -120,9 +120,20 @@ export default Ember.Controller.extend({ return output; }, - @computed("pollOptionsCount", "isNumber") - disableInsert(count, isNumber) { - return isNumber ? false : (count < 2); + @computed("pollOptionsCount", "isNumber", "pollMin", "pollMax") + disableInsert(count, isNumber, pollMin, pollMax) { + return (pollMin >= pollMax) || (isNumber ? false : (count < 2)); + }, + + @computed("pollMin", "pollMax") + minMaxValueValidation(pollMin, pollMax) { + let options = { ok: true }; + + if (pollMin >= pollMax) { + options = { failed: true, reason: I18n.t("poll.ui_builder.help.invalid_values") }; + } + + return InputValidation.create(options); }, @computed("disableInsert") diff --git a/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs b/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs index a3e7566f58b..50ed74ce9bd 100644 --- a/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs +++ b/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs @@ -11,28 +11,29 @@ {{#if showMinMax}}