mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 21:38:48 +00:00
Pretty toggle buttons in modal forms
This commit is contained in:
parent
0285d3ee83
commit
3dddb10f5d
@ -43,6 +43,22 @@ function partialMatcher(params, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function attachToggle(modal) {
|
||||||
|
/* Attach 'bootstrap-toggle' functionality to any checkbox in the modal.
|
||||||
|
* This is simple for visual improvement,
|
||||||
|
* and also larger toggle style buttons are easier to press!
|
||||||
|
*/
|
||||||
|
|
||||||
|
$(modal).find("input[type='checkbox']").each(function(x) {
|
||||||
|
$(this).bootstrapToggle({
|
||||||
|
size: 'small',
|
||||||
|
onstyle: 'success',
|
||||||
|
offstyle: 'warning',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function attachSelect(modal) {
|
function attachSelect(modal) {
|
||||||
/* Attach 'select2' functionality to any drop-down list in the modal.
|
/* Attach 'select2' functionality to any drop-down list in the modal.
|
||||||
* Provides search filtering for dropdown items
|
* Provides search filtering for dropdown items
|
||||||
@ -351,6 +367,7 @@ function injectModalForm(modal, form_html) {
|
|||||||
*/
|
*/
|
||||||
$(modal).find('.modal-form-content').html(form_html);
|
$(modal).find('.modal-form-content').html(form_html);
|
||||||
attachSelect(modal);
|
attachSelect(modal);
|
||||||
|
attachToggle(modal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<div>
|
<div>
|
||||||
<input field='{{ field }}' class='slidey' type="checkbox" data-onstyle="success" data-size='small' data-toggle="toggle" {% if disabled %}disabled="disabled" {% endif %}{% if state %}checked="checked"{% endif %}>
|
<input field='{{ field }}' class='slidey' type="checkbox" data-offstyle='warning' data-onstyle="success" data-size='small' data-toggle="toggle" {% if disabled %}disabled="disabled" {% endif %}{% if state %}checked="checked"{% endif %}>
|
||||||
</div>
|
</div>
|
Loading…
x
Reference in New Issue
Block a user