From 83e741c1afe8d26c6c7cefb4367ca7a9ccd87f18 Mon Sep 17 00:00:00 2001 From: Benjamin Meichsner Date: Wed, 12 Aug 2009 13:38:03 +0200 Subject: [PATCH] Improved delivery creating/updating prozess. --- app/controllers/deliveries_controller.rb | 6 +++--- app/views/deliveries/_form.html.haml | 14 ++++++++------ app/views/deliveries/_stock_change.html.haml | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/controllers/deliveries_controller.rb b/app/controllers/deliveries_controller.rb index 5dc2d70b..76b0fa9a 100644 --- a/app/controllers/deliveries_controller.rb +++ b/app/controllers/deliveries_controller.rb @@ -22,7 +22,6 @@ class DeliveriesController < ApplicationController def new @delivery = @supplier.deliveries.build - @delivery.stock_changes.build(:stock_article => @supplier.stock_articles.first) respond_to do |format| format.html # new.html.erb @@ -35,7 +34,7 @@ class DeliveriesController < ApplicationController respond_to do |format| if @delivery.save - flash[:notice] = 'Delivery was successfully created.' + flash[:notice] = 'Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen!' format.html { redirect_to([@supplier,@delivery]) } format.xml { render :xml => @delivery, :status => :created, :location => @delivery } else @@ -54,7 +53,7 @@ class DeliveriesController < ApplicationController respond_to do |format| if @delivery.update_attributes(params[:delivery]) - flash[:notice] = 'Delivery was successfully updated.' + flash[:notice] = 'Lieferung wurde aktualisiert.' format.html { redirect_to([@supplier,@delivery]) } format.xml { head :ok } else @@ -68,6 +67,7 @@ class DeliveriesController < ApplicationController @delivery = Delivery.find(params[:id]) @delivery.destroy + flash[:notice] = "Lieferung wurde gelöscht." respond_to do |format| format.html { redirect_to(supplier_deliveries_url(@supplier)) } format.xml { head :ok } diff --git a/app/views/deliveries/_form.html.haml b/app/views/deliveries/_form.html.haml index 28eebf1e..476360b2 100644 --- a/app/views/deliveries/_form.html.haml +++ b/app/views/deliveries/_form.html.haml @@ -1,4 +1,4 @@ -.left_column +.left_column(style="width:55%") - form_for([@supplier,@delivery]) do |f| .box_title %h2 Lieferung anlegen @@ -12,10 +12,10 @@ = stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier) Menge = stock_change_form.text_field :quantity, :size => 5, :autocomplete => 'off' - Entfernen - = stock_change_form.check_box :_delete + = stock_change_form.hidden_field :_delete + = link_to_function "Artikel aus Lieferung entfernen", "$(this).previous('input').value = 1; $(this).up('p').hide();" %p - = remote_link_to "Lagerartikel hinzufügen", :url => {:action => 'add_stock_change', :supplier_id => @supplier.id} + = remote_link_to "Lagerartikel der Lieferung hinzufügen", :url => {:action => 'add_stock_change', :supplier_id => @supplier.id} %hr/ %p %b= f.label :delivered_on, "Lieferdatum" @@ -23,11 +23,13 @@ %p %b= f.label :note, "Notiz" %br/ - = f.text_area :note, :size => "35x8" + = f.text_area :note, :size => "35x4" %p = f.submit "Lieferung speichern" + oder + = link_to "Abbrechen", supplier_deliveries_path(@supplier) -.right_column{:style => "width:35em;"} +.right_column{:style => "width:35%;"} .box_title %h2 Neuen Lagerartikel anlegen .column_content diff --git a/app/views/deliveries/_stock_change.html.haml b/app/views/deliveries/_stock_change.html.haml index 4a80c739..932903da 100644 --- a/app/views/deliveries/_stock_change.html.haml +++ b/app/views/deliveries/_stock_change.html.haml @@ -3,4 +3,4 @@ = form.select :stock_article_id, stock_articles_for_select(supplier) Menge = form.text_field :quantity, :size => 5, :autocomplete => 'off' - = link_to_function "entfernen", "$(this).up('p').remove()" + = link_to_function "Artikel aus Lieferung entfernen", "$(this).up('p').remove()"