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

View File

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