From 730dc7cf2a6c177e2f5ac1a6aed907f10112c8da Mon Sep 17 00:00:00 2001 From: Julius Date: Sat, 13 Jul 2013 09:32:27 +0200 Subject: [PATCH] Move StockChanges#index to StockArticles#history --- app/controllers/stock_changes_controller.rb | 8 -------- app/controllers/stockit_controller.rb | 5 +++++ .../index.html.haml => stockit/history.haml} | 0 app/views/stockit/index.html.haml | 2 +- config/locales/de.yml | 19 +++++++++---------- config/locales/en.yml | 19 +++++++++---------- config/routes.rb | 2 +- 7 files changed, 25 insertions(+), 30 deletions(-) delete mode 100644 app/controllers/stock_changes_controller.rb rename app/views/{stock_changes/index.html.haml => stockit/history.haml} (100%) diff --git a/app/controllers/stock_changes_controller.rb b/app/controllers/stock_changes_controller.rb deleted file mode 100644 index 4f91a07c..00000000 --- a/app/controllers/stock_changes_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -#encoding: utf-8 -class StockChangesController < ApplicationController - - def index - @stock_article = StockArticle.undeleted.find(params[:stock_article_id]) - @stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC').each {|s| s.readonly!} - end -end diff --git a/app/controllers/stockit_controller.rb b/app/controllers/stockit_controller.rb index 9ee40efe..3e3b43b2 100644 --- a/app/controllers/stockit_controller.rb +++ b/app/controllers/stockit_controller.rb @@ -55,4 +55,9 @@ class StockitController < ApplicationController render :partial => 'form', :locals => {:stock_article => stock_article} end + + def history + @stock_article = StockArticle.undeleted.find(params[:stock_article_id]) + @stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC').each {|s| s.readonly!} + end end diff --git a/app/views/stock_changes/index.html.haml b/app/views/stockit/history.haml similarity index 100% rename from app/views/stock_changes/index.html.haml rename to app/views/stockit/history.haml diff --git a/app/views/stockit/index.html.haml b/app/views/stockit/index.html.haml index c2966ace..4673b967 100644 --- a/app/views/stockit/index.html.haml +++ b/app/views/stockit/index.html.haml @@ -56,7 +56,7 @@ %td= article.article_category.name %td = link_to t('ui.edit'), edit_stock_article_path(article), class: 'btn btn-mini' - = link_to t('ui.history'), stock_article_stock_changes_path(article), class: 'btn btn-mini' + = link_to t('ui.history'), stock_article_history_path(article), class: 'btn btn-mini' = link_to t('ui.delete'), article, :method => :delete, :confirm => t('.confirm_delete'), class: 'btn btn-mini btn-danger', :remote => true %p diff --git a/config/locales/de.yml b/config/locales/de.yml index e0c13be1..092f5a5f 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1637,16 +1637,6 @@ de: mark: ! '*' text: benötigt 'yes': Ja - stock_changes: - index: - change_quantity: Veränderung - datetime: Zeitpunkt - delivery: Lieferung - new_quantity: Neuer Bestand - order: Bestellung - reason: Ereignis - stock_changes: Verlauf anzeigen für »%{article_name}« - stock_taking: Inventur stock_takings: create: notice: Inventur wurde erfolgreich angelegt. @@ -1687,6 +1677,15 @@ de: title: Lagerartikel bearbeiten form: price_hint: Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten Lagerartikeln nicht mehr verändert werden. + history: + change_quantity: Veränderung + datetime: Zeitpunkt + delivery: Lieferung + new_quantity: Neuer Bestand + order: Bestellung + reason: Ereignis + stock_changes: Verlauf anzeigen für »%{article_name}« + stock_taking: Inventur index: article: article: Artikel diff --git a/config/locales/en.yml b/config/locales/en.yml index 562d5194..535986e8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1639,16 +1639,6 @@ en: mark: ! '*' text: required 'yes': 'Yes' - stock_changes: - index: - change_quantity: Change - datetime: Time - delivery: Delivery - new_quantity: New quantity - order: Order - reason: Reason - stock_changes: Stock quantity changes of ‘%{article_name}’ - stock_taking: Inventory stock_takings: create: notice: Inventory was created successfully. @@ -1689,6 +1679,15 @@ en: title: Edit stock articles form: price_hint: To avoid choas, it is not possible to edit the prices of already added stock articles until further notice. + history: + change_quantity: Change + datetime: Time + delivery: Delivery + new_quantity: New quantity + order: Order + reason: Reason + stock_changes: Stock quantity changes of ‘%{article_name}’ + stock_taking: Inventory index: article: article: Article diff --git a/config/routes.rb b/config/routes.rb index 34a77b05..094ef4cb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -97,7 +97,7 @@ Foodsoft::Application.routes.draw do get :fill_new_stock_article_form end - resources :stock_changes, :only => [:index], :to => 'stock_changes' + get :history end resources :suppliers do