Add archiving items support
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending
This commit is contained in:
parent
ede6c14e37
commit
3b7377581c
@ -259,6 +259,18 @@ def save_inventory_item(item_id=None, **_):
|
|||||||
return render_template("inventory_edit.html", **locals())
|
return render_template("inventory_edit.html", **locals())
|
||||||
return redirect("/m/inventory/%s/view" % item_id)
|
return redirect("/m/inventory/%s/view" % item_id)
|
||||||
|
|
||||||
|
@page_inventory.route("/m/inventory/<item_id>/archive", methods=['POST'])
|
||||||
|
@login_required
|
||||||
|
def archive_inventory_item(item_id):
|
||||||
|
item = db.inventory.find_one({"_id": ObjectId(item_id)})
|
||||||
|
if not item:
|
||||||
|
return abort(404)
|
||||||
|
if not check_edit_permission(item_id):
|
||||||
|
return abort(403)
|
||||||
|
db.archive.insert_one(item);
|
||||||
|
db.inventory.delete_one({"_id": ObjectId(item_id)})
|
||||||
|
return redirect("/m/inventory")
|
||||||
|
|
||||||
@page_inventory.route("/m/inventory/add-slug/<slug>", methods=['GET'])
|
@page_inventory.route("/m/inventory/add-slug/<slug>", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def add_inventory_slug(slug):
|
def add_inventory_slug(slug):
|
||||||
|
@ -206,6 +206,17 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<form action="/m/inventory/{{ item._id }}/archive" method="post" style="display: inline;">
|
||||||
|
<button {% if not can_edit %} disabled="" {% endif %} class="red lighten-1 waves-effect waves-light btn" type="submit">
|
||||||
|
<i class="material-icons left">archive</i>Archive
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if can_audit %}
|
{% if can_audit %}
|
||||||
<div id="audit-modal" class="modal">
|
<div id="audit-modal" class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
Loading…
Reference in New Issue
Block a user