more inputs that can display errors

This commit is contained in:
Jakob Ketterl 2021-03-25 15:02:59 +01:00
parent 69237c0bb4
commit 20cd3f6efe
2 changed files with 11 additions and 7 deletions

View File

@ -45,7 +45,6 @@ $.fn.wsjtDecodingDepthsInput = function() {
}; };
$table.on('change', updateValue); $table.on('change', updateValue);
$el.append($table);
var $addButton = $('<button type="button" class="btn btn-sm btn-primary">Add...</button>'); var $addButton = $('<button type="button" class="btn btn-sm btn-primary">Add...</button>');
$addButton.on('click', function() { $addButton.on('click', function() {
@ -63,6 +62,7 @@ $.fn.wsjtDecodingDepthsInput = function() {
updateValue(); updateValue();
return false; return false;
}); });
$el.append($addButton);
$input.after($table, $addButton);
}); });
}; };

View File

@ -25,16 +25,20 @@ class Q65ModeMatrix(Input):
disabled="" if interval.is_available(mode) and not self.disabled else "disabled", disabled="" if interval.is_available(mode) and not self.disabled else "disabled",
) )
def render_input(self, value, errors): def render_input_group(self, value, errors):
checkboxes = "".join(
self.render_checkbox(mode, interval, value, errors) for interval in Q65Interval for mode in Q65Mode
)
return """ return """
<div class="matrix q65-matrix"> <div class="matrix q65-matrix">
{checkboxes} {checkboxes}
{errors}
</div> </div>
""".format( """.format(
checkboxes=checkboxes checkboxes=self.render_input(value, errors),
errors=self.render_errors(errors),
)
def render_input(self, value, errors):
return "".join(
self.render_checkbox(mode, interval, value, errors) for interval in Q65Interval for mode in Q65Mode
) )
def input_classes(self, error): def input_classes(self, error):