mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Simplification
This commit is contained in:
parent
641785a02b
commit
e1784c93b2
@ -134,16 +134,11 @@
|
|||||||
|
|
||||||
<div class='panel panel-hidden' id='panel-part-notes'>
|
<div class='panel panel-hidden' id='panel-part-notes'>
|
||||||
<div class='panel-heading'>
|
<div class='panel-heading'>
|
||||||
<div class='row'>
|
<div class='d-flex flex-wrap'>
|
||||||
<div class='col-sm-6'>
|
<h4>{% trans "Notes" %}</h4>
|
||||||
<h4>{% trans "Notes" %}</h4>
|
{% include "spacer.html" %}
|
||||||
</div>
|
<div class='btn-group' role='group'>
|
||||||
<div class='col-sm-6'>
|
{% include "notes_buttons.html" %}
|
||||||
<div class='btn-group float-right'>
|
|
||||||
<button type='button' id='save-notes' title='{% trans "Save" %}' class='btn btn-success'>
|
|
||||||
<span class='fas fa-save'></span> {% trans "Save Changes" %}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -424,7 +419,6 @@
|
|||||||
'{% url "api-part-detail" part.pk %}',
|
'{% url "api-part-detail" part.pk %}',
|
||||||
{
|
{
|
||||||
editable: true,
|
editable: true,
|
||||||
save_button: '#save-notes',
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -266,16 +266,31 @@ function setupNotesField(element, url, options={}) {
|
|||||||
shortcuts: [],
|
shortcuts: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
mde.togglePreview();
|
|
||||||
|
|
||||||
if (!editable) {
|
if (!editable) {
|
||||||
|
// Set readonly
|
||||||
mde.codemirror.setOption('readOnly', true);
|
mde.codemirror.setOption('readOnly', true);
|
||||||
$('#editor-toolbar').hide();
|
|
||||||
}
|
// Hide the toolbar
|
||||||
|
$(`#${element}`).next('.EasyMDEContainer').find('.editor-toolbar').hide();
|
||||||
|
|
||||||
|
// Hide the "edit" and "save" buttons
|
||||||
|
$('#edit-notes').hide();
|
||||||
|
$('#save-notes').hide();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mde.togglePreview();
|
||||||
|
|
||||||
// Add callback for "save" button
|
// Add callback for "edit" button
|
||||||
if (options.save_button) {
|
$('#edit-notes').click(function() {
|
||||||
$(options.save_button).click(function() {
|
$('#edit-notes').hide();
|
||||||
|
$('#save-notes').show();
|
||||||
|
|
||||||
|
mde.togglePreview();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add callback for "save" button
|
||||||
|
$('#save-notes').click(function() {
|
||||||
|
|
||||||
var data = {};
|
var data = {};
|
||||||
|
|
||||||
|
8
InvenTree/templates/notes_buttons.html
Normal file
8
InvenTree/templates/notes_buttons.html
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
<button type='button' id='edit-notes' title='{% trans "Edit" %}' class='btn btn-primary'>
|
||||||
|
<span class='fas fa-edit'></span> {% trans "Edit" %}
|
||||||
|
</button>
|
||||||
|
<button type='button' id='save-notes' title='{% trans "Save" %}' class='btn btn-success' style='display: none;'>
|
||||||
|
<span class='fas fa-save'></span> {% trans "Save" %}
|
||||||
|
</button>
|
Loading…
x
Reference in New Issue
Block a user