From fc1d13011309fba37967547556913b415de51171 Mon Sep 17 00:00:00 2001 From: benni Date: Fri, 27 May 2011 14:09:01 +0200 Subject: [PATCH] Refactored stockit, delivery an stock_takings. --- app/controllers/deliveries_controller.rb | 6 +- app/controllers/stock_takings_controller.rb | 67 ++----------------- app/controllers/stockit_controller.rb | 26 +++---- app/helpers/deliveries_helper.rb | 2 +- app/models/stock_article.rb | 2 + app/views/deliveries/_form.html.haml | 55 +++++++-------- .../deliveries/_stock_article_form.html.haml | 44 +++--------- app/views/deliveries/_stock_change.html.haml | 4 +- app/views/deliveries/add_stock_change.js.erb | 1 + .../_stock_article_form.html.haml | 45 +++---------- .../stock_takings/_stock_change.html.haml | 12 ++-- app/views/stock_takings/edit.html.haml | 19 ++---- app/views/stock_takings/index.html.haml | 4 +- app/views/stock_takings/new.html.haml | 37 +++------- app/views/stockit/_form.html.haml | 56 ++++------------ app/views/stockit/index.html.haml | 19 +++--- app/views/stockit/new.html.haml | 22 +++--- config/locales/de.yml | 12 ++++ config/routes.rb | 2 +- public/javascripts/application.js | 6 ++ 20 files changed, 145 insertions(+), 296 deletions(-) create mode 100644 app/views/deliveries/add_stock_change.js.erb diff --git a/app/controllers/deliveries_controller.rb b/app/controllers/deliveries_controller.rb index 76b0fa9a..3c70e001 100644 --- a/app/controllers/deliveries_controller.rb +++ b/app/controllers/deliveries_controller.rb @@ -92,11 +92,7 @@ class DeliveriesController < ApplicationController end def add_stock_change - - render :update do |page| - page.insert_html :bottom, 'stock_changes', :partial => 'stock_change', - :locals => {:stock_change => StockChange.new, :supplier => @supplier} - end + render :layout => false end def fill_new_stock_article_form diff --git a/app/controllers/stock_takings_controller.rb b/app/controllers/stock_takings_controller.rb index 4b6004cf..84b8a797 100644 --- a/app/controllers/stock_takings_controller.rb +++ b/app/controllers/stock_takings_controller.rb @@ -1,76 +1,17 @@ class StockTakingsController < ApplicationController - - def index - @stock_takings = StockTaking.find(:all) - - respond_to do |format| - format.html # index.html.erb - format.xml { render :xml => @stock_takings } - end - end - - def show - @stock_taking = StockTaking.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.xml { render :xml => @stock_taking } - end - end + inherit_resources def new @stock_taking = StockTaking.new - StockArticle.without_deleted.each { |a| @stock_taking.stock_changes.build(:stock_article => a) } - - respond_to do |format| - format.html # new.html.erb - format.xml { render :xml => @stock_taking } - end - end - - - def edit - @stock_taking = StockTaking.find(params[:id]) + StockArticle.all.each { |a| @stock_taking.stock_changes.build(:stock_article => a) } end def create - @stock_taking = StockTaking.new(params[:stock_taking]) - - respond_to do |format| - if @stock_taking.save - flash[:notice] = 'StockTaking was successfully created.' - format.html { redirect_to(@stock_taking) } - format.xml { render :xml => @stock_taking, :status => :created, :location => @stock_taking } - else - format.html { render :action => "new" } - format.xml { render :xml => @stock_taking.errors, :status => :unprocessable_entity } - end - end + create!(:notice => "Inventur wurde erfolgreich angelegt.") end def update - @stock_taking = StockTaking.find(params[:id]) - - respond_to do |format| - if @stock_taking.update_attributes(params[:stock_taking]) - flash[:notice] = 'StockTaking was successfully updated.' - format.html { redirect_to(@stock_taking) } - format.xml { head :ok } - else - format.html { render :action => "edit" } - format.xml { render :xml => @stock_taking.errors, :status => :unprocessable_entity } - end - end - end - - def destroy - @stock_taking = StockTaking.find(params[:id]) - @stock_taking.destroy - - respond_to do |format| - format.html { redirect_to(stock_takings_url) } - format.xml { head :ok } - end + update!(:notice => "Inventur wurde aktualisiert.") end def fill_new_stock_article_form diff --git a/app/controllers/stockit_controller.rb b/app/controllers/stockit_controller.rb index 83cf7ce1..40f790e8 100644 --- a/app/controllers/stockit_controller.rb +++ b/app/controllers/stockit_controller.rb @@ -1,10 +1,8 @@ class StockitController < ApplicationController def index - @stock_articles = StockArticle.without_deleted.all( - :include => [:supplier, :article_category], - :order => 'suppliers.name, article_categories.name, articles.name' - ) + @stock_articles = StockArticle.joins(:supplier, :article_category). + order('suppliers.name, article_categories.name, articles.name') end def new @@ -14,8 +12,7 @@ class StockitController < ApplicationController def create @stock_article = StockArticle.new(params[:stock_article]) if @stock_article.save - flash[:notice] = "Lagerartikel wurde gespeichert." - redirect_to stock_articles_path + redirect_to stock_articles_path, :notice => "Lagerartikel wurde gespeichert." else render :action => 'new' end @@ -28,8 +25,7 @@ class StockitController < ApplicationController def update @stock_article = StockArticle.find(params[:id]) if @stock_article.update_attributes(params[:stock_article]) - flash[:notice] = "Lagerartikel wurde gespeichert." - redirect_to stock_articles_path + redirect_to stock_articles_path, :notice => "Lagerartikel wurde gespeichert." else render :action => 'edit' end @@ -43,16 +39,10 @@ class StockitController < ApplicationController redirect_to stock_articles_path end - def auto_complete_for_article_name - conditions = [ "LOWER(articles.name) LIKE ?", '%' + params[:article][:name].downcase + '%' ] - - if params[:supplier_id] - @supplier = Supplier.find(params[:supplier_id]) - @articles = @supplier.articles.without_deleted.all(:conditions => conditions, :limit => 8) - else - @articles = Article.without_deleted.not_in_stock.all(:conditions => conditions, :limit => 8) - end - render :partial => 'shared/auto_complete_articles' + #TODO: Fix this!! + def articles_search + @articles = Article.not_in_stock.limit(8).where(:name.matches => params[:term]) + render :json => @articles.map(&:name) end def fill_new_stock_article_form diff --git a/app/helpers/deliveries_helper.rb b/app/helpers/deliveries_helper.rb index d6e9ed65..543cf27c 100644 --- a/app/helpers/deliveries_helper.rb +++ b/app/helpers/deliveries_helper.rb @@ -10,7 +10,7 @@ module DeliveriesHelper end def stock_articles_for_select(supplier) - supplier.stock_articles.without_deleted.collect {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] } + supplier.stock_articles.map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] } end end diff --git a/app/models/stock_article.rb b/app/models/stock_article.rb index ce091bed..eca476fb 100644 --- a/app/models/stock_article.rb +++ b/app/models/stock_article.rb @@ -1,4 +1,6 @@ class StockArticle < Article + acts_as_paranoid + has_many :stock_changes scope :available, :conditions => "quantity > 0" diff --git a/app/views/deliveries/_form.html.haml b/app/views/deliveries/_form.html.haml index a533be60..7c8fead4 100644 --- a/app/views/deliveries/_form.html.haml +++ b/app/views/deliveries/_form.html.haml @@ -1,52 +1,49 @@ -.left_column(style="width:55%") - - form_for([@supplier,@delivery]) do |f| +- content_for :head do + :javascript + $(function() { + $('.destroy_stock_change').live('click', function() { + $(this).prev('input').val('1').parent().hide(); + return false; + }); + + $('.remove_new_stock_change').live('click', function() { + $(this).parent().remove(); + return false; + }) + }); + +.left_column(style="width:50%") + = simple_form_for [@supplier,@delivery], :validate => true do |f| .box_title %h2 Lieferung anlegen .column_content - = f.error_messages = f.hidden_field :supplier_id %b Lagerartikel des Lieferanten #stock_changes - - f.fields_for :stock_changes do |stock_change_form| + = f.fields_for :stock_changes do |stock_change_form| %p = stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier) Menge = stock_change_form.text_field :quantity, :size => 5, :autocomplete => 'off' - = stock_change_form.hidden_field :_delete - = link_to_function "Artikel aus Lieferung entfernen", "$(this).previous('input').value = 1; $(this).up('p').hide();" + = stock_change_form.hidden_field :_destroy + = link_to "Artikel aus Lieferung entfernen", "#", :class => 'destroy_stock_change' %p - = remote_link_to "Lagerartikel der Lieferung hinzufügen", :url => {:action => 'add_stock_change', :supplier_id => @supplier.id} + = link_to "Lagerartikel der Lieferung hinzufügen", {:action => 'add_stock_change', :supplier_id => @supplier.id}, :remote => true %hr/ - %p - %b= f.label :delivered_on, "Lieferdatum" - = f.date_select :delivered_on - %p - %b= f.label :note, "Notiz" - %br/ - = f.text_area :note, :size => "35x4" - %p - = f.submit "Lieferung speichern" - oder - = link_to "Abbrechen", supplier_deliveries_path(@supplier) + = f.input :delivered_on + = f.input :note, :input_html => {:size => '35x4'} + = f.submit -.right_column{:style => "width:35%;"} +.right_column{:style => "width:45%;"} .box_title %h2 Neuen Lagerartikel anlegen .column_content %p - :javascript - function fillNewStockArticle(text, li) { - new Ajax.Updater('stock_article_form', '#{url_for(:controller => "deliveries", :action => "fill_new_stock_article_form")}', { - method: 'get', - parameters: {article_id: li.id} - }); - } + //TODO: Fix this!! Suche nach Artikeln aus dem %i= @supplier.name Katalog: - = text_field_with_auto_complete :article, :name, {}, | - {:url => {:controller => 'stockit', :action => 'auto_complete_for_article_name', :supplier_id => @supplier.id}, | - :after_update_element => 'fillNewStockArticle', :method => :get} | + = text_field_tag 'article_name' %hr/ #stock_article_form = render :partial => 'stock_article_form', :locals => {:stock_article => @supplier.stock_articles.build} diff --git a/app/views/deliveries/_stock_article_form.html.haml b/app/views/deliveries/_stock_article_form.html.haml index 6cb13334..9a67faac 100644 --- a/app/views/deliveries/_stock_article_form.html.haml +++ b/app/views/deliveries/_stock_article_form.html.haml @@ -1,33 +1,11 @@ -- remote_form_for stock_article, :url => add_stock_article_supplier_deliveries_path(@supplier) do |form| - = form.error_messages - = form.hidden_field :supplier_id - - %p - Name - %br/ - = form.text_field :name - %p - Einheit - %br/ - = form.text_field :unit - %p - Notiz - %br/ - = form.text_field :note - %p - Preis - %br/ - = form.text_field :price - %p - MwSt - %br/ - = form.text_field :tax, :value => (stock_article.tax || 7.0) - %p - Pfand - %br/ - = form.text_field :deposit - %p - Kategorie: - = form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] } - %p - = submit_tag "Lagerartikel speichern" \ No newline at end of file += simple_form_for stock_article, add_stock_article_supplier_deliveries_path(@supplier), :remote => true, + :validate => true do |f| + = f.hidden_field :supplier_id + = f.input :name + = f.input :unit + = f.input :note + = f.input :price + = f.input :tax + = f.input :deposit + = f.association :article_category + = f.submit \ No newline at end of file diff --git a/app/views/deliveries/_stock_change.html.haml b/app/views/deliveries/_stock_change.html.haml index 932903da..aafb3d17 100644 --- a/app/views/deliveries/_stock_change.html.haml +++ b/app/views/deliveries/_stock_change.html.haml @@ -1,6 +1,6 @@ %p - - fields_for "delivery[new_stock_changes][]", stock_change do |form| + = fields_for "delivery[new_stock_changes][]", stock_change do |form| = form.select :stock_article_id, stock_articles_for_select(supplier) Menge = form.text_field :quantity, :size => 5, :autocomplete => 'off' - = link_to_function "Artikel aus Lieferung entfernen", "$(this).up('p').remove()" + = link_to "Artikel aus Lieferung entfernen", "#", :class => 'remove_new_stock_change' diff --git a/app/views/deliveries/add_stock_change.js.erb b/app/views/deliveries/add_stock_change.js.erb new file mode 100644 index 00000000..d6262fee --- /dev/null +++ b/app/views/deliveries/add_stock_change.js.erb @@ -0,0 +1 @@ +$('#stock_changes').append('<%= escape_javascript(render(:partial => 'stock_change', :locals => {:stock_change => StockChange.new, :supplier => @supplier})) %>'); \ No newline at end of file diff --git a/app/views/stock_takings/_stock_article_form.html.haml b/app/views/stock_takings/_stock_article_form.html.haml index a1f05557..41f074a2 100644 --- a/app/views/stock_takings/_stock_article_form.html.haml +++ b/app/views/stock_takings/_stock_article_form.html.haml @@ -1,35 +1,10 @@ -- remote_form_for stock_article, :url => add_stock_article_stock_takings_path do |form| - = form.error_messages - %p - Lieferantin - %br/ - = form.select :supplier_id, Supplier.without_deleted(:order => 'name').collect{ |s| [s.name, s.id] } - %p - Name - %br/ - = form.text_field :name - %p - Einheit - %br/ - = form.text_field :unit - %p - Notiz - %br/ - = form.text_field :note - %p - Nettopreis - %br/ - = form.text_field :price - %p - MwSt - %br/ - = form.text_field :tax, :value => (stock_article.tax || 7.0) - %p - Pfand - %br/ - = form.text_field :deposit - %p - Kategorie: - = form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] } - %p - = submit_tag "Lagerartikel hinzufügen" \ No newline at end of file +- simple_form_for stock_article, add_stock_article_stock_takings_path, :remote => true do |f| + = f.association :supplier + = f.input :name + = f.input :unit + = f.input :note + = f.input :price + = f.input :tax + = f.input :deposit + = f.association :article_category + = f.submit \ No newline at end of file diff --git a/app/views/stock_takings/_stock_change.html.haml b/app/views/stock_takings/_stock_change.html.haml index 1cb10164..0c3d766e 100644 --- a/app/views/stock_takings/_stock_change.html.haml +++ b/app/views/stock_takings/_stock_change.html.haml @@ -1,9 +1,7 @@ %p - - fields_for "stock_taking[stock_change_attributes][]", stock_change do |form| - - article = stock_change.stock_article - + = simple_fields_for "stock_taking[stock_change_attributes][]", stock_change do |form| = form.hidden_field :stock_article_id - = "Menge (#{article.quantity_available})" - = form.text_field :quantity, :size => 5, :autocomplete => 'off' - %b=h truncate(article.name) - = "(#{number_to_currency(article.price)} / #{article.unit})" + = "Menge (#{stock_change.stock_article.quantity_available})" + = form.text_field :quantity, :size => 5, :autocomplete => 'off' + %b=h truncate(stock_change.stock_article.name) + = "(#{number_to_currency(stock_change.stock_article.price)} / #{stock_change.stock_article.unit})" diff --git a/app/views/stock_takings/edit.html.haml b/app/views/stock_takings/edit.html.haml index 55e4ef73..dd0e4b19 100644 --- a/app/views/stock_takings/edit.html.haml +++ b/app/views/stock_takings/edit.html.haml @@ -1,16 +1,7 @@ - title "Inventur bearbeiten" -- form_for(@stock_taking) do |f| - = f.error_messages - %p - %b Datum - %br/ - = f.date_select :date - %p - %b Notiz - %br/ - = f.text_area :note, :size => "28x7" - %p - = f.submit "Invenur speichern" - | - = link_to "Abbrechen", stock_takings_path \ No newline at end of file +- simple_form_for(@stock_taking) do |f| + = f.input :date + = f.input :note + = f.submit + = link_to "oder abbrechen", stock_takings_path \ No newline at end of file diff --git a/app/views/stock_takings/index.html.haml b/app/views/stock_takings/index.html.haml index b02e2f3e..07f47445 100644 --- a/app/views/stock_takings/index.html.haml +++ b/app/views/stock_takings/index.html.haml @@ -1,7 +1,7 @@ - title "Inventurübersicht" %p - = link_to "Neue Iniventur anlegen", new_stock_taking_path + = link_to "Neue Inventur anlegen", new_stock_taking_path | = link_to "Lager", stock_articles_path @@ -17,7 +17,7 @@ - for stock_taking in @stock_takings %tr %td= link_to format_date(stock_taking.date), stock_taking - %td=h truncate stock_taking.note + %td= truncate stock_taking.note %td= link_to 'Anzeigen', stock_taking %td= link_to 'Bearbeiten', edit_stock_taking_path(stock_taking) %td= link_to 'Löschen', stock_taking, :confirm => 'Are you sure?', :method => :delete diff --git a/app/views/stock_takings/new.html.haml b/app/views/stock_takings/new.html.haml index c134e978..a6976ac2 100644 --- a/app/views/stock_takings/new.html.haml +++ b/app/views/stock_takings/new.html.haml @@ -1,19 +1,12 @@ - title "Neue Inventur anlegen" -.left_column{:style => "width:40em;"} - - form_for(@stock_taking) do |f| +.left_column{:style => "width:50%;"} + = simple_form_for(@stock_taking) do |f| .box_title %h2 Inventur anlegen .column_content - = f.error_messages - %p - %b Datum - %br/ - = f.date_select :date - %p - %b Notiz - %br/ - = f.text_area :note, :size => "28x7", :value => "#{@current_user.nick}: ..." + = f.input :date + = f.input :note, :input_html => {:size => "28x7", :value => "#{@current_user.nick}: ..."} %h2 Lagerartikel %p %i @@ -21,28 +14,18 @@ = link_to "vorläufigen Lagerbestand", stock_articles_path ein. Bei Schwund benutze einfach ein Minus vor der Zahl. #stock_changes - = render :partial => 'stock_change', :collection => @stock_taking.stock_changes - %p - = f.submit "Inventur anlegen" - | - = link_to "Abbrechen", stock_takings_path + = render :partial => 'stock_change', :collection => @stock_taking.stock_changes + = f.submit + = link_to "oder abbrechen", stock_takings_path -.right_column{:style => "width:30em;"} +.right_column{:style => "width:45%;"} .box_title %h2 Neuen Lagerartikel anlegen .column_content %p - :javascript - function fillNewStockArticle(text, li) { - new Ajax.Updater('stock_article_form', '/stock_takings/fill_new_stock_article_form', { - method: 'get', - parameters: {article_id: li.id} - }); - } + // FIx this! Suche nach Artikeln aus dem allen Katalogen: - = text_field_with_auto_complete :article, :name, {}, | - {:url => {:controller => 'stockit', :action => 'auto_complete_for_article_name' }, | - :after_update_element => 'fillNewStockArticle', :method => :get} | + = text_field_tag :article_name %hr/ #stock_article_form = render :partial => 'stock_article_form', :locals => {:stock_article => StockArticle.new} \ No newline at end of file diff --git a/app/views/stockit/_form.html.haml b/app/views/stockit/_form.html.haml index 62cf2e9d..48fa0a83 100644 --- a/app/views/stockit/_form.html.haml +++ b/app/views/stockit/_form.html.haml @@ -1,44 +1,16 @@ -- form_for stock_article do |form| - = form.error_messages - %p - Lieferantin - %br/ - = form.select :supplier_id, Supplier.without_deleted(:order => 'name').collect{ |s| [s.name, s.id] } - %p - Name - %br/ - = form.text_field :name - %p - Einheit - %br/ - = form.text_field :unit - %p - Notiz - %br/ - = form.text_field :note +- simple_form_for stock_article, :validate => true do |f| + = f.association :supplier + = f.input :name + = f.input :unit + = f.input :note + - if stock_article.new_record? - %p - Nettopreis - %br/ - = form.text_field :price - %p - MwSt - %br/ - = form.text_field :tax, :value => (stock_article.tax || 7.0) - %p - Pfand - %br/ - = form.text_field :deposit + = f.input :price + = f.input :tax + = f.input :deposit - else - %p - Preis: - %br/ - Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten - Lagerartikeln nicht mehr verändert werden. - %p - Kategorie: - = form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] } - %p - = submit_tag "Lagerartikel speichern" - | - = link_to "Abbrechen", stock_articles_path \ No newline at end of file + = f.input :price, :input_html => {:disabled => 'disabled'}, + :hint => "Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten Lagerartikeln nicht mehr verändert werden." + = f.association :article_category + = f.submit + = link_to "oder abbrechen", stock_articles_path \ No newline at end of file diff --git a/app/views/stockit/index.html.haml b/app/views/stockit/index.html.haml index 654e32c5..1ae13a85 100644 --- a/app/views/stockit/index.html.haml +++ b/app/views/stockit/index.html.haml @@ -1,23 +1,26 @@ - title "Lagerübersicht: #{StockArticle.available.count} Artikel im Lager" - +- content_for :head do + :javascript + $(function() { + $('tr.unavailable').hide(); + }) .menu - form_tag do %ul %li Ansichtsoptionen %ul - %li= link_to_function "Nicht verfügbare Artikel zeigen/verstecken", | - "$$('tr.unavailable').invoke('toggleClassName', 'hidden');", :style => "width:15em" | + %li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable', + :style => "width:15em" %div{:style => "padding:0 0 0.5em 0.7em;margin-bottom:2em"} %span{:style => "float:left"} - form_tag do Neue Lieferung anlegen für: - = select_tag :new_delivery, | - options_for_select([[" -- Lieferantin wählen --", ""]] + | - Supplier.without_deleted.collect {|s| [ s.name, url_for(new_supplier_delivery_path(s))] }), | - :onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;" | + = select_tag :new_delivery, + options_for_select([[" -- Lieferantin wählen --", ""]] + Supplier.all.map {|s| [ s.name, new_supplier_delivery_url(s)]}), + 'data-redirect-to' => true, :style => "font-size: 0.9em;margin-left:1em;" .single_column{:style => 'width:100%; clear:both'} .box_title @@ -48,7 +51,7 @@ %tbody - for article in @stock_articles - class_name = cycle :even, :odd - - class_name += " unavailable hidden" if article.quantity_available <= 0 + - class_name += " unavailable" if article.quantity_available <= 0 - class_name += " supplier_#{article.supplier.id}" %tr{:class => class_name} %td=h article.name diff --git a/app/views/stockit/new.html.haml b/app/views/stockit/new.html.haml index 560ae635..6b844353 100644 --- a/app/views/stockit/new.html.haml +++ b/app/views/stockit/new.html.haml @@ -1,16 +1,20 @@ - title "Neuen Lagerartikel anlegen" -:javascript - function fillNewStockArticle(text, li) { - new Ajax.Updater('stock_article_form', '/stockit/fill_new_stock_article_form', { - parameters: {article_id: li.id} - }); - } +- content_for :head do + :javascript + $(function() { + $('#article_search').autocomplete({ + source: '#{articles_search_stock_articles_path}', + select: function(e, ui) { + alert(ui.item.value); + //location.href = '#{nil}' + ui.item.value; + } + }); + }) + %p Suche nach Artikeln aus allen Katalogen: - = text_field_with_auto_complete :article, :name, {}, | - {:url => {:action => 'auto_complete_for_article_name'}, | - :after_update_element => 'fillNewStockArticle'} | + = text_field_tag 'article_search' #stock_article_form = render :partial => 'form', :locals => {:stock_article => @stock_article} \ No newline at end of file diff --git a/config/locales/de.yml b/config/locales/de.yml index 042f7409..c8a57967 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -160,6 +160,9 @@ de: task: Aufgabe message: Nachricht article_category: Artikelkategorie + stock_article: Lagerartikel + delivery: Lieferung + stock_taking: Inventur attributes: article: price: Nettopreis @@ -210,6 +213,8 @@ de: description: 'Beschreibung' title: 'Titel' email: 'E-Mail' + note: 'Notiz' + date: 'Datum' workgroup: weekly_task: 'Monatlichen Job definieren?' weekday: 'Wochentag' @@ -257,7 +262,12 @@ de: order_number: 'Bestellnummer' tax: 'MwSt' deposit: 'Pfand' + stock_article: + supplier: 'Lieferant' + delivery: + delivered_on: 'Lieferdatum' hints: + tax: 'In Prozent, Standard sind 7,0' task: duration: 'Wie lange dauert die Aufgabe, 1-3 Stunden' required_users: 'Wieviel Benutzerinnen werden insgesamt benötigt?' @@ -265,3 +275,5 @@ de: min_order_quantity: 'Die Mindestbestellmenge wird während der Bestellung angezeigt und soll motivieren' article: unit: 'z.B. KG oder 1L oder 500g' + stock_article: + supplier: '' diff --git a/config/routes.rb b/config/routes.rb index cad8ccac..1c0d0b01 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,7 +77,7 @@ Foodsoft::Application.routes.draw do resources :stock_articles, :to => 'stockit' do collection do - get :auto_complete_for_article_name + get :articles_search get :fill_new_stock_article_form end end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index e4059468..fa74ae80 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -7,6 +7,12 @@ $(function() { return false; }); + // Remove this item from DOM + $('a[data-remove-this').click(function() { + $($(this).data('remove-this')).remove(); + return false; + }); + // Check/Uncheck a single checkbox $('[data-check-this]').live('click', function() { var checkbox = $($(this).data('check-this'));