Changed combo-box to number inputs for min, max and step values.
This commit is contained in:
parent
911d6abfad
commit
c423544208
|
@ -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")
|
||||
|
|
|
@ -11,28 +11,29 @@
|
|||
{{#if showMinMax}}
|
||||
<div class="input-group">
|
||||
<label class="input-group-label">{{i18n 'poll.ui_builder.poll_config.min'}}</label>
|
||||
{{combo-box content=pollMinOptions
|
||||
value=pollMin
|
||||
valueAttribute="value"
|
||||
class="poll-options-min"}}
|
||||
{{input type='number'
|
||||
value=pollMin
|
||||
valueAttribute="value"
|
||||
class="poll-options-min"}}
|
||||
{{input-tip validation=minMaxValueValidation}}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-group">
|
||||
<label class="input-group-label">{{i18n 'poll.ui_builder.poll_config.max'}}</label>
|
||||
{{combo-box content=pollMaxOptions
|
||||
value=pollMax
|
||||
valueAttribute="value"
|
||||
class="poll-options-max"}}
|
||||
{{input type='number'
|
||||
value=pollMax
|
||||
valueAttribute="value"
|
||||
class="poll-options-max"}}
|
||||
</div>
|
||||
|
||||
{{#if isNumber}}
|
||||
<div class="input-group">
|
||||
<label class="input-group-label">{{i18n 'poll.ui_builder.poll_config.step'}}</label>
|
||||
{{combo-box content=pollStepOptions
|
||||
value=pollStep
|
||||
valueAttribute="value"
|
||||
class="poll-options-step"}}
|
||||
{{input type='number'
|
||||
value=pollStep
|
||||
valueAttribute="value"
|
||||
class="poll-options-step"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
@ -74,6 +74,7 @@ en:
|
|||
insert: Insert Poll
|
||||
help:
|
||||
options_count: Enter at least 2 options
|
||||
invalid_values: Minimum value must be smaller than the maximum value.
|
||||
poll_type:
|
||||
label: Type
|
||||
regular: Single Choice
|
||||
|
|
Loading…
Reference in New Issue