mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Don't render editable items when ont in editing mode
This commit is contained in:
parent
ec98f7829e
commit
b522ca5b29
@ -86,6 +86,7 @@
|
||||
{
|
||||
_pk: row.pk,
|
||||
_title: 'Quantity',
|
||||
enabled: {{ editing_enabled }},
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -101,6 +102,7 @@
|
||||
_pk: row.pk,
|
||||
_title: 'Note',
|
||||
_empty: 'Enter note',
|
||||
enabled: {{ editing_enabled }},
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -127,29 +129,6 @@
|
||||
url: "{% url 'api-bom-list' %}"
|
||||
});
|
||||
|
||||
/*
|
||||
$('#bom-table').on('click', '.delete-button', function () {
|
||||
var button = $(this);
|
||||
|
||||
launchDeleteForm(
|
||||
button.attr('url'),
|
||||
{
|
||||
success: reloadBom
|
||||
});
|
||||
});
|
||||
|
||||
$("#bom-table").on('click', '.edit-button', function () {
|
||||
var button = $(this);
|
||||
|
||||
launchModalForm(
|
||||
button.attr('url'),
|
||||
{
|
||||
success: reloadBom
|
||||
});
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
{% if editing_enabled %}
|
||||
$("#editing-finish").click(function() {
|
||||
alert("Finished!");
|
||||
@ -161,9 +140,6 @@
|
||||
location.href = "{% url 'part-bom' part.id %}";
|
||||
});
|
||||
|
||||
// Inline mode
|
||||
//$.fn.editable.defaults.mode = 'inline';
|
||||
|
||||
$("#bom-table").on('load-success.bs.table', function() {
|
||||
// Make the table elements editable
|
||||
$("#bom-table").find('.editable-item').editable();
|
||||
|
@ -95,9 +95,9 @@ class PartDetail(DetailView):
|
||||
context = super(PartDetail, self).get_context_data(**kwargs)
|
||||
|
||||
if str(self.request.GET.get('edit', None)) == '1':
|
||||
context['editing_enabled'] = True
|
||||
context['editing_enabled'] = 1
|
||||
else:
|
||||
context['editing_enabled'] = False
|
||||
context['editing_enabled'] = 0
|
||||
|
||||
return context
|
||||
|
||||
|
@ -25,8 +25,16 @@ function renderEditable(text, options) {
|
||||
* _empty - placeholder text to show when field is empty
|
||||
* _class - html class (default = 'editable-item')
|
||||
* _id - id
|
||||
*
|
||||
* And some further parameters:
|
||||
* enabled - if 1 or true, render the editable.
|
||||
* otherwise, just return the supplied text
|
||||
*/
|
||||
|
||||
if (!options.enabled) {
|
||||
return text;
|
||||
}
|
||||
|
||||
// Default values (if not supplied)
|
||||
var _type = options._type || 'text';
|
||||
var _class = options._class || 'editable-item';
|
||||
|
Loading…
Reference in New Issue
Block a user