diff --git a/warehouse/__init__.py b/warehouse/__init__.py index 9e5208731d5314cc1e00e5c71007a71f508372d7..1eb99bda67315caabc6430cc35ad083f2b69f304 100644 --- a/warehouse/__init__.py +++ b/warehouse/__init__.py @@ -166,6 +166,22 @@ def item_print_label(item_id): def item_html_label(item_id): return render_template('item/label.html', item=Item.query.get_or_404(item_id)) +@app.route('/item/<item_id>/smalllabel') +def item_smalllabel(item_id): + return render_pdf(render_template('item/smalllabel.html', item=Item.query.get_or_404(item_id))) + +@app.route('/item/<item_id>/print_smalllabel') +def item_print_smalllabel(item_id): + item = Item.query.get_or_404(item_id) + resp = render_pdf(render_template('item/smalllabel.html', item=item)) + print_pdf(resp.data, app.config['LABEL_PRINTER_URL']) + flash('Print job submitted') + return redirect(url_for('item_view', item_id=item.id)) + +@app.route('/item/<item_id>/html_smalllabel') +def item_html_smalllabel(item_id): + return render_template('item/smalllabel.html', item=Item.query.get_or_404(item_id)) + @app.route('/item/<item_id>/edit', methods=['GET', 'POST']) def item_edit(item_id): item = Item.query.get_or_404(item_id) diff --git a/warehouse/templates/item/view.html b/warehouse/templates/item/view.html index e47c3cbcc24757f29900a27d455b064cd031ee40..a436faaa04053571a3ab80d609668a7352c593e6 100644 --- a/warehouse/templates/item/view.html +++ b/warehouse/templates/item/view.html @@ -19,7 +19,9 @@ <span class="visually-hidden">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> - <a href="{{ url_for('item_print_label', item_id=item.id) }}" class="dropdown-item">Print Label</a> + <a href="{{ url_for('item_print_label', item_id=item.id) }}" class="dropdown-item">Print label</a> + <a href="{{ url_for('item_smalllabel', item_id=item.id) }}" class="dropdown-item">Download small label</a> + <a href="{{ url_for('item_print_smalllabel', item_id=item.id) }}" class="dropdown-item">Print small label</a> </ul> </div>