mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +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,
|
_pk: row.pk,
|
||||||
_title: 'Quantity',
|
_title: 'Quantity',
|
||||||
|
enabled: {{ editing_enabled }},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -101,6 +102,7 @@
|
|||||||
_pk: row.pk,
|
_pk: row.pk,
|
||||||
_title: 'Note',
|
_title: 'Note',
|
||||||
_empty: 'Enter note',
|
_empty: 'Enter note',
|
||||||
|
enabled: {{ editing_enabled }},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -127,29 +129,6 @@
|
|||||||
url: "{% url 'api-bom-list' %}"
|
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 %}
|
{% if editing_enabled %}
|
||||||
$("#editing-finish").click(function() {
|
$("#editing-finish").click(function() {
|
||||||
alert("Finished!");
|
alert("Finished!");
|
||||||
@ -161,9 +140,6 @@
|
|||||||
location.href = "{% url 'part-bom' part.id %}";
|
location.href = "{% url 'part-bom' part.id %}";
|
||||||
});
|
});
|
||||||
|
|
||||||
// Inline mode
|
|
||||||
//$.fn.editable.defaults.mode = 'inline';
|
|
||||||
|
|
||||||
$("#bom-table").on('load-success.bs.table', function() {
|
$("#bom-table").on('load-success.bs.table', function() {
|
||||||
// Make the table elements editable
|
// Make the table elements editable
|
||||||
$("#bom-table").find('.editable-item').editable();
|
$("#bom-table").find('.editable-item').editable();
|
||||||
|
@ -95,9 +95,9 @@ class PartDetail(DetailView):
|
|||||||
context = super(PartDetail, self).get_context_data(**kwargs)
|
context = super(PartDetail, self).get_context_data(**kwargs)
|
||||||
|
|
||||||
if str(self.request.GET.get('edit', None)) == '1':
|
if str(self.request.GET.get('edit', None)) == '1':
|
||||||
context['editing_enabled'] = True
|
context['editing_enabled'] = 1
|
||||||
else:
|
else:
|
||||||
context['editing_enabled'] = False
|
context['editing_enabled'] = 0
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -25,8 +25,16 @@ function renderEditable(text, options) {
|
|||||||
* _empty - placeholder text to show when field is empty
|
* _empty - placeholder text to show when field is empty
|
||||||
* _class - html class (default = 'editable-item')
|
* _class - html class (default = 'editable-item')
|
||||||
* _id - id
|
* _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)
|
// Default values (if not supplied)
|
||||||
var _type = options._type || 'text';
|
var _type = options._type || 'text';
|
||||||
var _class = options._class || 'editable-item';
|
var _class = options._class || 'editable-item';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user