mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for weird button toggles (it was a doozy!)
- Turning off autocomplete seems to have done the job - https://stackoverflow.com/questions/36546775/html-checkboxes-keep-checked-after-refresh#36547079
This commit is contained in:
parent
65bc23a516
commit
aa35c787b2
@ -218,14 +218,13 @@
|
||||
{{ block.super }}
|
||||
|
||||
$(".slidey").change(function() {
|
||||
var field = $(this).attr('field');
|
||||
var field = $(this).attr('fieldname');
|
||||
|
||||
var checked = $(this).prop('checked');
|
||||
|
||||
var data = {};
|
||||
|
||||
data[field] = checked;
|
||||
|
||||
// Update the particular field
|
||||
inventreePut("{% url 'api-part-detail' part.id %}",
|
||||
data,
|
||||
@ -235,50 +234,5 @@
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
$('#activate-part').click(function() {
|
||||
showQuestionDialog(
|
||||
'Activate Part?',
|
||||
'Are you sure you wish to reactivate {{ part.full_name }}?',
|
||||
{
|
||||
accept_text: 'Activate',
|
||||
accept: function() {
|
||||
inventreePut(
|
||||
"{% url 'api-part-detail' part.id %}",
|
||||
{
|
||||
active: true,
|
||||
},
|
||||
{
|
||||
method: 'PATCH',
|
||||
reloadOnSuccess: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
$('#deactivate-part').click(function() {
|
||||
showQuestionDialog(
|
||||
'Deactivate Part?',
|
||||
`Are you sure you wish to deactivate {{ part.full_name }}?<br>
|
||||
`,
|
||||
{
|
||||
accept_text: 'Deactivate',
|
||||
accept: function() {
|
||||
inventreePut(
|
||||
"{% url 'api-part-detail' part.id %}",
|
||||
{
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
method: 'PATCH',
|
||||
reloadOnSuccess: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,3 +1,3 @@
|
||||
<div>
|
||||
<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 %}>
|
||||
<input fieldname='{{ field }}' class='slidey' type="checkbox" data-offstyle='warning' data-onstyle="success" data-size='small' data-toggle="toggle" {% if disabled %}disabled {% endif %}{% if state %}checked=""{% endif %} autocomplete="off">
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user