Add possibility to copy an order

If a supplier has a long list of articles, which are all available, but
the order should contain only a subset of them, selecting them for every
order can take a long time. Starting with a copy of an existing order
can safe a lot of time.
This commit is contained in:
Patrick Gansterer 2015-02-18 21:56:56 +01:00
parent 65c7673a41
commit e57fd500fc
7 changed files with 13 additions and 8 deletions

View file

@ -63,6 +63,7 @@ class OrdersController < ApplicationController
# Page to create a new order. # Page to create a new order.
def new def new
@order = Order.new(supplier_id: params[:supplier_id]).init_dates @order = Order.new(supplier_id: params[:supplier_id]).init_dates
@order.article_ids = Order.find(params[:order_id]).article_ids if params[:order_id]
end end
# Save a new order. # Save a new order.

View file

@ -58,7 +58,7 @@
= link_to t('.action_receive'), receive_order_path(order), class: 'btn btn-small btn-success' = link_to t('.action_receive'), receive_order_path(order), class: 'btn btn-small btn-success'
%td %td
= link_to t('ui.edit'), '#', class: 'btn btn-small disabled', tabindex: -1 = link_to t('ui.copy'), new_order_path(order_id: order, supplier_id: order.supplier), class: 'btn btn-small'
= link_to t('ui.show'), order, class: 'btn btn-small' = link_to t('ui.show'), order, class: 'btn btn-small'
= link_to t('ui.delete'), order, data: {confirm: t('.confirm_delete')}, method: :delete, = link_to t('ui.delete'), order, data: {confirm: t('.confirm_delete')}, method: :delete,
class: 'btn btn-small btn-danger' class: 'btn btn-small btn-danger'

View file

@ -1,10 +1,10 @@
- title t('.title') - title t('.title')
= render 'form' = render 'form'
- if @order.article_ids.empty?
- content_for :javascript do - content_for :javascript do
:javascript :javascript
// select all articles by default // select all articles by default
$(function() { $(function() {
$('#checkall').click(); $('#checkall').click();
}); });

View file

@ -1649,6 +1649,7 @@ de:
actions: Aktionen actions: Aktionen
cancel: Abbrechen cancel: Abbrechen
close: Schließen close: Schließen
copy: Kopieren
delete: Löschen delete: Löschen
edit: Bearbeiten edit: Bearbeiten
marks: marks:

View file

@ -1658,6 +1658,7 @@ en:
actions: Actions actions: Actions
cancel: Cancel cancel: Cancel
close: Close close: Close
copy: Copy
delete: Delete delete: Delete
edit: Edit edit: Edit
marks: marks:

View file

@ -1668,6 +1668,7 @@ fr:
actions: Actions actions: Actions
cancel: Annuler cancel: Annuler
close: Fermer close: Fermer
copy: Copier
delete: Supprimer delete: Supprimer
edit: Modifier edit: Modifier
marks: marks:

View file

@ -1653,6 +1653,7 @@ nl:
actions: Acties actions: Acties
cancel: Annuleren cancel: Annuleren
close: Sluiten close: Sluiten
copy: Kopiëren
delete: Verwijder delete: Verwijder
edit: Bewerk edit: Bewerk
marks: marks: