Move 'duplicate' button to the Part options drop-down

This commit is contained in:
Oliver Walters 2019-04-26 23:39:33 +10:00
parent 948c118695
commit 69b34a0ff2
2 changed files with 14 additions and 13 deletions

View File

@ -14,6 +14,7 @@
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href='#' id='duplicate-part' title='Duplicate Part'>Duplicate</a></li>
<li><a href="#" id='edit-part' title='Edit part'>Edit</a></li>
<li><a href='#' id='stocktake-part' title='Stocktake'>Stocktake</a></li>
<li><a href="#" id='delete-part' title='Delete part'>Delete</a></li>
@ -119,6 +120,19 @@
{% block js_ready %}
{{ block.super }}
$("#duplicate-part").click(function() {
launchModalForm(
"{% url 'part-create' %}",
{
follow: true,
data: {
copy: {{ part.id }},
},
}
);
});
$("#edit-part").click(function() {
launchModalForm(
"{% url 'part-edit' part.id %}",

View File

@ -32,7 +32,6 @@
<td><a href="{{ part.URL }}">{{ part.URL }}</a></td>
</tr>
{% endif %}
<button class='btn btn-success' id='duplicate-part'>Copy Part</button>
</div>
</div>
</div>
@ -96,16 +95,4 @@
);
});
$("#duplicate-part").click(function() {
launchModalForm(
"{% url 'part-create' %}",
{
follow: true,
data: {
copy: {{ part.id }},
},
}
);
});
{% endblock %}