mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #4317: Use 2 inputs for min,max in user inputs
This commit is contained in:
parent
65fe0d6085
commit
225b250c62
@ -94,6 +94,11 @@ define(function(require) {
|
||||
|
||||
case "range":
|
||||
case "range-float":
|
||||
var min = $("."+attr.type+" input.user_input_params_min", $(this)).val();
|
||||
var max = $("."+attr.type+" input.user_input_params_max", $(this)).val();
|
||||
attr.params = min + ".." + max;
|
||||
attr.initial = $("."+attr.type+" input.user_input_initial", $(this)).val();
|
||||
break;
|
||||
case "list":
|
||||
attr.params = $("."+attr.type+" input.user_input_params", $(this)).val();
|
||||
attr.initial = $("."+attr.type+" input.user_input_initial", $(this)).val();
|
||||
@ -132,6 +137,19 @@ define(function(require) {
|
||||
|
||||
case "range":
|
||||
case "range-float":
|
||||
var values = attr.params.split(".."); // "2..8"
|
||||
|
||||
if (values.length == 2){
|
||||
$("."+attr.type+" input.user_input_params_min", trcontext).val(values[0]);
|
||||
$("."+attr.type+" input.user_input_params_max", trcontext).val(values[1]);
|
||||
} else {
|
||||
console.error('Wrong user input parameters for "'+key+'". Expected "MIN..MAX", received "'+attr.params+'"');
|
||||
}
|
||||
|
||||
$("."+attr.type+" input.user_input_initial", trcontext).val(attr.initial);
|
||||
|
||||
break;
|
||||
|
||||
case "list":
|
||||
$("."+attr.type+" input.user_input_params", trcontext).val(attr.params);
|
||||
$("."+attr.type+" input.user_input_initial", trcontext).val(attr.initial);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<label>{{tr "Name"}}
|
||||
<input class="user_input_name" type="text" pattern="[^\w+$]+"/>
|
||||
<input class="user_input_name" type="text" pattern="^\w+$"/>
|
||||
<small class="error">{{tr "Can only contain alphanumeric and underscore characters"}}</small>
|
||||
</label>
|
||||
</td>
|
||||
@ -23,24 +23,57 @@
|
||||
<label>{{tr "Description"}}
|
||||
<textarea class="user_input_description"/>
|
||||
</label>
|
||||
<div class="user_input_type_right number number-float">
|
||||
<label class="user_input_opt">{{tr "Default value"}}
|
||||
<input type=text class="user_input_initial" placeholder="42"/>
|
||||
<div class="user_input_type_right number">
|
||||
<label>{{tr "Default value"}}
|
||||
<input type="number" class="user_input_initial" placeholder="42"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="user_input_type_right range range-float">
|
||||
<label class="user_input_opt">{{tr "Options"}}
|
||||
<input type=text class="user_input_params" placeholder="2..16"/>
|
||||
<div class="user_input_type_right number-float">
|
||||
<label{{tr "Default value"}}
|
||||
<input type="number" step="any" class="user_input_initial" placeholder="42.5"/>
|
||||
</label>
|
||||
<label class="user_input_opt">{{tr "Default value"}}
|
||||
<input type=text class="user_input_initial" placeholder="8"/>
|
||||
</div>
|
||||
<div class="user_input_type_right range">
|
||||
<div class="row">
|
||||
<div class="small-6 columns">
|
||||
<label>{{tr "Min"}}
|
||||
<input type="number" class="user_input_params_min" placeholder="2"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="small-6 columns">
|
||||
<label>{{tr "Max"}}
|
||||
<input type="number" class="user_input_params_max" placeholder="16"/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label>{{tr "Default value"}}
|
||||
<input type="number" class="user_input_initial" placeholder="8"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="user_input_type_right range-float">
|
||||
<div class="row">
|
||||
<div class="small-6 columns">
|
||||
<label>{{tr "Min"}}
|
||||
<input type="number" step="any" class="user_input_params_min" placeholder="2"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="small-6 columns">
|
||||
<label>{{tr "Max"}}
|
||||
<input type="number" step="any" class="user_input_params_max" placeholder="16"/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label>{{tr "Default value"}}
|
||||
<input type="number" step="any" class="user_input_initial" placeholder="8.5"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="user_input_type_right list">
|
||||
<label class="user_input_opt">{{tr "Options"}}
|
||||
<label>
|
||||
{{tr "Options"}}
|
||||
{{{tip (tr "Comma-separated list of options for the drop-down select input")}}}
|
||||
<input type=text class="user_input_params" placeholder="optA,optB,optC"/>
|
||||
</label>
|
||||
<label class="user_input_opt">{{tr "Default value"}}
|
||||
<label>{{tr "Default value"}}
|
||||
<input type=text class="user_input_initial" placeholder="optB"/>
|
||||
</label>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user