Cleanup StockArticle creation during delivery

This commit is contained in:
Julius 2013-06-11 15:05:19 +02:00
parent e28f3eda65
commit 49cfa9aded
4 changed files with 10 additions and 20 deletions

View file

@ -87,20 +87,6 @@ class DeliveriesController < ApplicationController
else else
render :action => 'new_stock_article', :layout => false render :action => 'new_stock_article', :layout => false
end end
#render :update do |page|
# if article.save
# logger.debug "new StockArticle: #{article.id}"
# page.insert_html :bottom, 'stock_changes', :partial => 'stock_change',
# :locals => {:stock_change => article.stock_changes.build, :supplier => @supplier}
#
# page.replace_html 'new_stock_article', :partial => 'stock_article_form',
# :locals => {:stock_article => @supplier.stock_articles.build}
# else
# page.replace_html 'new_stock_article', :partial => 'stock_article_form',
# :locals => {:stock_article => article}
# end
#end
end end
def add_stock_change def add_stock_change

View file

@ -12,10 +12,16 @@
}) })
}); });
- content_for :javascript do
:javascript
$(function() {
$('#add-stock-change').click();
});
.well.well-small .well.well-small
.btn-toolbar .btn-toolbar
.btn-group .btn-group
= link_to t('.new_stock_article'), new_stock_article_supplier_deliveries_path(@supplier), remote: true, class: 'btn btn-primary' = link_to t('.new_stock_article'), new_stock_article_supplier_deliveries_path(@supplier), remote: true, class: 'btn'
= simple_form_for [@supplier, @delivery], validate: true do |f| = simple_form_for [@supplier, @delivery], validate: true do |f|
= f.hidden_field :supplier_id = f.hidden_field :supplier_id
@ -28,7 +34,7 @@
= stock_change_form.hidden_field :_destroy = stock_change_form.hidden_field :_destroy
= link_to t('.remove_article'), "#", class: 'destroy_stock_change' = link_to t('.remove_article'), "#", class: 'destroy_stock_change'
%p %p
= link_to t('.add_article'), {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true, class: 'btn btn-small' = link_to t('.add_article'), {action: 'add_stock_change', supplier_id: @supplier.id}, :id => 'add-stock-change', remote: true, class: 'btn btn-small btn-primary'
%hr/ %hr/
= f.input :delivered_on, as: :date_picker = f.input :delivered_on, as: :date_picker
= f.input :note, input_html: {size: '35x4'} = f.input :note, input_html: {size: '35x4'}

View file

@ -2,7 +2,7 @@
= f.hidden_field :supplier_id = f.hidden_field :supplier_id
.modal-header .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
%h3= t '.title' %h3= t 'activerecord.models.stock_article'
.modal-body .modal-body
= f.input :name = f.input :name
= f.input :unit = f.input :unit

View file

@ -417,7 +417,7 @@ de:
year: Jahr year: Jahr
deliveries: deliveries:
add_stock_article: add_stock_article:
notice: ! Neuer Lagerartikel »%{name}« gespeichert. Zum Auswählen bitte <strong>erneut</strong> einen Lagerartikel der Lieferung hinzufügen. notice: Neuer Lagerartikel »%{name}« gespeichert. Zum Auswählen bitte erneut einen Lagerartikel der Lieferung hinzufügen.
create: create:
notice: Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen! notice: Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen!
destroy: destroy:
@ -454,8 +454,6 @@ de:
unit: Einheit unit: Einheit
stock_change: stock_change:
remove_article: Artikel aus Lieferung entfernen remove_article: Artikel aus Lieferung entfernen
stock_article_form:
title: Lagerartikel
suppliers_overview: Lieferantenübersicht suppliers_overview: Lieferantenübersicht
update: update:
notice: Lieferung wurde aktualisiert. notice: Lieferung wurde aktualisiert.