Translations for articles-pages.

This commit is contained in:
Benjamin Meichsner 2009-02-10 13:26:10 +01:00
parent 6202e05841
commit 053593f718
12 changed files with 89 additions and 104 deletions

View File

@ -28,8 +28,8 @@ class ArticlesController < ApplicationController
# if somebody uses the search field: # if somebody uses the search field:
conditions = ["articles.name LIKE ?", "%#{params[:query]}%"] unless params[:query].nil? conditions = ["articles.name LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
@total = @supplier.articles.not_in_stock.count(:conditions => conditions) @total = @supplier.articles.count(:conditions => conditions)
@articles = @supplier.articles.not_in_stock.paginate(:order => sort, @articles = @supplier.articles.paginate(:order => sort,
:conditions => conditions, :conditions => conditions,
:page => params[:page], :page => params[:page],
:per_page => @per_page, :per_page => @per_page,
@ -136,10 +136,7 @@ class ArticlesController < ApplicationController
# Renders a form for editing all articles from a supplier # Renders a form for editing all articles from a supplier
def edit_all def edit_all
@articles = @supplier.articles.not_in_stock.find :all, @articles = @supplier.articles.all
:order => 'article_categories.name, articles.name',
:include => [:article_category]
end end
# Updates all article of specific supplier # Updates all article of specific supplier
@ -309,15 +306,15 @@ class ArticlesController < ApplicationController
def sync def sync
# check if there is an shared_supplier # check if there is an shared_supplier
unless @supplier.shared_supplier unless @supplier.shared_supplier
flash[:error]= @supplier.name + _(" ist not assigned to an external database.") flash[:error]= "#{@supplier.name} ist nicht mit einer externen Datenbank verknüpft."
redirect_to supplier_articles_path(@supplier) redirect_to supplier_articles_path(@supplier)
end end
# sync articles against external database # sync articles against external database
@updated_articles, @outlisted_articles = @supplier.sync_all @updated_articles, @outlisted_articles = @supplier.sync_all
# convert to db-compatible-string # convert to db-compatible-string
@updated_articles.each {|a, b| a.shared_updated_on = a.shared_updated_on.to_formatted_s(:db)} @updated_articles.each {|a, b| a.shared_updated_on = a.shared_updated_on.to_formatted_s(:db)}
if @updated_articles.empty? && @outlisted_articles.empty? if @updated_articles.empty? && @outlisted_articles.empty?
flash[:notice] = _("The database is up to date.") flash[:notice] = "Der Katalog ist aktuell."
redirect_to supplier_articles_path(@supplier) redirect_to supplier_articles_path(@supplier)
end end
end end

View File

@ -107,14 +107,18 @@ module ApplicationHelper
icons = { :delete => { :file => 'b_drop.png', :alt => 'Löschen'}, icons = { :delete => { :file => 'b_drop.png', :alt => 'Löschen'},
:edit => { :file => 'b_edit.png', :alt => 'Bearbeiten'}} :edit => { :file => 'b_edit.png', :alt => 'Bearbeiten'}}
options.merge!({:size => '16x16',:border => "0"}) options.merge!({:size => '16x16',:border => "0"})
options.merge!({:alt => icons[name][:alt]}) unless options[:alt] options.merge!({:alt => icons[name][:alt], :title => icons[name][:alt]}) unless options[:alt]
image_tag icons[name][:file], options image_tag icons[name][:file], options
end end
# Remote links with default 'loader'.gif during request # Remote links with default 'loader'.gif during request
def remote_link_to(text, options={}) def remote_link_to(text, options={})
remote_options = {:before => "Element.show('loader')", :success => "Element.hide('loader')"} remote_options = {
:before => "Element.show('loader')",
:success => "Element.hide('loader')",
:method => :get
}
link_to_remote(text, remote_options.merge(options)) link_to_remote(text, remote_options.merge(options))
end end

View File

@ -6,8 +6,8 @@ module ArticlesHelper
end end
def row_classes(article) def row_classes(article)
classes = "" classes = " click-me"
classes += ' unavailable' if article.availability classes += " unavailable" if !article.availability
classes += " just_updated" if @article.recently_updated && @article.availability classes += " just_updated" if @article.recently_updated && @article.availability
classes classes
end end

View File

@ -1,13 +1,4 @@
module DeliveriesHelper module DeliveriesHelper
def articles_for_select(supplier)
supplier.articles.find(:all, :limit => 10).collect { |a| [truncate(a.name), a.id] }
end
def add_article_link
link_to_function "Artikel hinzufügen", nil, { :accesskey => 'n', :title => "ALT + SHIFT + N" } do |page|
page.insert_html :bottom, :stock_changes, :partial => 'stock_change', :object => StockChange.new
end
end
def link_to_invoice(delivery) def link_to_invoice(delivery)
if delivery.invoice if delivery.invoice

View File

@ -35,7 +35,6 @@ class Article < ActiveRecord::Base
has_many :article_prices, :order => "created_at" has_many :article_prices, :order => "created_at"
named_scope :available, :conditions => {:availability => true} named_scope :available, :conditions => {:availability => true}
named_scope :not_in_stock, :conditions => {:type => nil}
# Validations # Validations
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category_id validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category_id

View File

@ -24,9 +24,9 @@
class Supplier < ActiveRecord::Base class Supplier < ActiveRecord::Base
acts_as_paranoid # Avoid deleting the supplier for consistency of order-results acts_as_paranoid # Avoid deleting the supplier for consistency of order-results
has_many :articles, :dependent => :destroy, has_many :articles, :dependent => :destroy, :conditions => {:type => nil},
:include => [:article_category], :order => 'article_categories.name, articles.name' :include => [:article_category], :order => 'article_categories.name, articles.name'
has_many :stock_articles has_many :stock_articles, :include => [:article_category], :order => 'article_categories.name, articles.name'
has_many :orders has_many :orders
has_many :deliveries has_many :deliveries
has_many :invoices has_many :invoices
@ -51,13 +51,11 @@ class Supplier < ActiveRecord::Base
for article in articles for article in articles
# try to find the associated shared_article # try to find the associated shared_article
shared_article = article.shared_article shared_article = article.shared_article
if shared_article
# article will be updated if shared_article # article will be updated
# skip if shared_article has not been changed
unequal_attributes = article.shared_article_changed? unequal_attributes = article.shared_article_changed?
unless unequal_attributes.blank? unless unequal_attributes.blank? # skip if shared_article has not been changed
# update objekt but don't save it
# try to convert different units # try to convert different units
new_price, new_unit_quantity = article.convert_units new_price, new_unit_quantity = article.convert_units

View File

@ -10,23 +10,18 @@
<td><%= @article.unit_quantity -%></td> <td><%= @article.unit_quantity -%></td>
<td class="currency"> <td class="currency">
<acronym title="zuletzt geändert: <%= format_date(@article.updated_at) -%> <acronym title="zuletzt geändert: <%= format_date(@article.updated_at) -%>
| Brutto: <%= number_to_currency(@article.fc_price) -%>"> | Brutto: <%= number_to_currency(@article.gross_price) -%>">
<%= number_to_currency(@article.price) -%> <%= number_to_currency(@article.price) -%>
</acronym> </acronym>
</td> </td>
<td><%= number_to_percentage(@article.tax) if @article.tax != 0 -%></td> <td><%= number_to_percentage(@article.tax) if @article.tax != 0 -%></td>
<td><%= number_to_currency(@article.deposit) if @article.deposit != 0 -%></td> <td><%= number_to_currency(@article.deposit) if @article.deposit != 0 -%></td>
<td> <td>
<%= link_to_remote icon(:edit, :onclick => "checkRow('#{@article.id.to_s}')"), <%= remote_link_to icon(:edit, :onclick => "checkRow('#{@article.id.to_s}')"),
:url => edit_supplier_article_path(@supplier, @article), :url => edit_supplier_article_path(@supplier, @article) %>
:method => :get, <%= remote_link_to icon(:delete, :onclick => "checkRow('#{@article.id.to_s}')"),
:before => "Element.show('loader')",
:success => "Element.hide('loader')" %>
<%= link_to_remote icon(:delete, :onclick => "checkRow('#{@article.id.to_s}')"),
:url => [@supplier, @article], :url => [@supplier, @article],
:method => :delete, :method => :delete,
:confirm => 'Bist du sicher?', :confirm => 'Bist du sicher?' %>
:before => "Element.show('loader')",
:success => "Element.hide('loader')" %>
</td> </td>

View File

@ -1,5 +1,5 @@
%p %p
=_ 'Number of found articles :' Gefundene Artikel:
%b= @total %b= @total
%p %p
@ -16,18 +16,18 @@
%tr %tr
%th %th
%th[sort_td_class_helper "name"] %th[sort_td_class_helper "name"]
= sort_link_helper _("Name"), "name" = sort_link_helper "Name", "name"
%th %th
%th[sort_td_class_helper "category"] %th[sort_td_class_helper "category"]
= sort_link_helper _("Category"), "category" = sort_link_helper "Kategorie", "category"
%th[sort_td_class_helper "unit"] %th[sort_td_class_helper "unit"]
= sort_link_helper _("Unit"), "unit" = sort_link_helper "Einheit", "unit"
%th[sort_td_class_helper "note"] %th[sort_td_class_helper "note"]
= sort_link_helper _("Note"), "note" = sort_link_helper "Notiz", "note"
%th{:style => "width: 4em;"}=_ 'UnitQu' %th{:style => "width: 4em;"} Gebgr.
%th{:style => "width: 4em;"}=_ 'Price' %th{:style => "width: 4em;"} Preis
%th{:style => "width: 3.5em;"}=_ 'Tax' %th{:style => "width: 3.5em;"} MwSt
%th{:style => "width: 4em;"}=_ 'Deposit' %th{:style => "width: 4em;"} Pfand
%th{:style => "width: 3em;"} %th{:style => "width: 3em;"}
%tbody#listbody %tbody#listbody
@ -47,14 +47,10 @@
%option{:value => "setAvailable", :onclick => 'formSubmit();'} Artikel sind verfügbar %option{:value => "setAvailable", :onclick => 'formSubmit();'} Artikel sind verfügbar
= hidden_field_tag 'supplier_id', @supplier.id = hidden_field_tag 'supplier_id', @supplier.id
%p
= pagination_links_remote @articles, :params => {:sort => params[:sort]} %p= pagination_links_remote @articles, :params => {:sort => params[:sort]}
:plain :javascript
<script type="text/javascript"> function formSubmit() {
function formSubmit() { $("articlesInListForm").submit()
$("articlesInListForm").submit() }
}
</script>

View File

@ -2,18 +2,18 @@
// import menu // import menu
- unless @supplier.shared_supplier.nil? - unless @supplier.shared_supplier.nil?
.menu{:style => 'width: 14em'} .menu{:style => 'width: 16em'}
%ul %ul
%li %li
=_ 'External database' Zugriff auf externe Datenbank
%ul %ul
%li= link_to_function _('search/import'), "Element.toggle('import')" %li= link_to_function "Suchen/Importieren", "Element.toggle('import')"
%li= link_to _('sync'), sync_supplier_articles_path(@supplier), :method => :post %li= link_to "Synchronisieren", sync_supplier_articles_path(@supplier), :method => :post
#change_supplier{:style => "padding:0 0 0.5em 0.7em;"} #change_supplier{:style => "padding:0 0 0.5em 0.7em;"}
%span{:style => "float:left"} %span{:style => "float:left"}
=_ 'Change supplier:' Lieferant wechseln:
- form_tag do - form_tag do
= select_tag :switch_supplier, | = select_tag :switch_supplier, |
options_for_select( Supplier.all(:order => 'name').collect {|s| [s.name, url_for(supplier_articles_path(s))] }, | options_for_select( Supplier.all(:order => 'name').collect {|s| [s.name, url_for(supplier_articles_path(s))] }, |
@ -24,50 +24,50 @@
- unless @supplier.shared_supplier.nil? - unless @supplier.shared_supplier.nil?
#import.single_column{:style => "display:none; clear:both"} #import.single_column{:style => "display:none; clear:both"}
.box_title .box_title
%h2=_ 'Import articles' %h2 Artikel importieren
.column_content .column_content
#search{:style => "padding-bottom:3em"} #search{:style => "padding-bottom:3em"}
- form_remote_tag :url => shared_supplier_articles_path(@supplier), | - form_remote_tag :url => shared_supplier_articles_path(@supplier), |
:before => "Element.show('loader')", :success => "Element.hide('loader')", | :before => "Element.show('loader')", :success => "Element.hide('loader')", |
:method => :get do | :method => :get do |
= text_field_tag :import_query, params['import_query'], :size => 10 = text_field_tag :import_query, params['import_query'], :size => 10
= submit_tag _('Search articles') = submit_tag "Suchen"
- if @supplier.shared_supplier.lists - if @supplier.shared_supplier.lists
=_ "Search in following lists: " Suche in folgenden Listen:
- @supplier.shared_supplier.lists.each do |token, name| - @supplier.shared_supplier.lists.each do |token, name|
= check_box_tag "lists[#{token}]", "1", true = check_box_tag "lists[#{token}]", "1", true
= name = name
| |
=_ "only regional:" Nur aus der Region:
= check_box_tag "regional", "1", false = check_box_tag "regional", "1", false
#search_results #search_results
// "import_search_results" will be rendered // "import_search_results" will be rendered
= link_to_function _('Close'), "Element.hide('import')" = link_to_function "Schließen", "Element.hide('import')"
.single_column{:style => 'width:100%; clear:both'} .single_column{:style => 'width:100%; clear:both'}
.box_title .box_title
.column_content .column_content
#links #links
%b= link_to_remote _('New article'), :url => new_supplier_article_path(@supplier), :before => "Element.show('loader')", :success => "Element.hide('loader')", :method => :get %b= remote_link_to "Neuer Artikel", :url => new_supplier_article_path(@supplier)
| |
= link_to _('Edit all'), edit_all_supplier_articles_path(@supplier) = link_to "Alle bearbeiten", edit_all_supplier_articles_path(@supplier)
| |
= link_to _('Upload articles'), upload_supplier_articles_path(@supplier) = link_to "Artikel hochladen", upload_supplier_articles_path(@supplier)
| |
= link_to_if @current_user.role_orders?, _('Create order'), {:controller => 'orders', :action => 'new', :supplier_id => @supplier } = link_to_if @current_user.role_orders?, "Bestellung anlegen", {:controller => 'orders', :action => 'new', :supplier_id => @supplier }
#article_filter #article_filter
#article_search_form{:style=>"display:inline;"} #article_search_form{:style=>"display:inline;"}
- form_remote_tag :url => supplier_articles_path(@supplier), | - form_remote_tag :url => supplier_articles_path(@supplier), |
:before => "Element.show('loader')", :success => "Element.hide('loader')", | :before => "Element.show('loader')", :success => "Element.hide('loader')", |
:method => :get do | :method => :get do |
%label{:for => 'article_name'}=_ "Search in article name: " %label{:for => 'article_name'} Suche im Artikelnamen:
= text_field_tag("query", params['query'], :size => 10 ) = text_field_tag("query", params['query'], :size => 10 )
= submit_tag _('Search') = submit_tag "Suchen"
%form{ :action => url_for(update_selected_supplier_articles_path(@supplier)), :method => "post", :id => "articlesInListForm" } %form{ :action => url_for(update_selected_supplier_articles_path(@supplier)), :method => "post", :id => "articlesInListForm" }
#table= render :partial => 'articles' #table= render :partial => 'articles'
%br/ %br/
= link_to _('Back'), :action => 'index' = link_to "Zurück", :action => 'index'
#edit_article{:style => "display:none"} #edit_article{:style => "display:none"}

View File

@ -1,24 +1,24 @@
- title "#{@supplier.name} / Artikel hochladen" - title "#{@supplier.name} / Artikel hochladen"
%p %p
%i %i
=_ "Please check the parsed articles and choose a supplier at the end of page." Bitte überprüfe die eingelesenen Artikel.
%br/ %br/
=_ "At the moment there is no checking of dublicate articles." Achtung, momentan gibt es keine Überprüfung auf doppelte Artikel.
- form_tag(create_from_upload_supplier_articles_path(@supplier)) do - form_tag(create_from_upload_supplier_articles_path(@supplier)) do
%table %table
%tr %tr
%th=_ "Number" %th Nummer
%th=_ "Name" %th Name
%th=_ "Note" %th Notiz
%th=_ "Manufacturer" %th Hersteller
%th=_ "Origin" %th Herkunft
%th=_ "Unit" %th Einheit
%th=_ "Net price" %th Nettopreis
%th=_ "Tax" %th MwSt
%th=_ "Deposit" %th Pfand
%th=_ "Unit quantity" %th Gebindegröße
%th=_ "Category" %th Kategorie
- for article in @articles - for article in @articles
- fields_for "articles[]", article do |form| - fields_for "articles[]", article do |form|
%tr{:class => cycle('even', 'odd')} %tr{:class => cycle('even', 'odd')}
@ -34,7 +34,7 @@
%td= form.text_field 'unit_quantity', :size => 4 %td= form.text_field 'unit_quantity', :size => 4
%td= form.select 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] } %td= form.select 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }
%p %p
= submit_tag "Save new Articles for #{@supplier.name}" = submit_tag "Speichere neue Artikel für #{@supplier.name}"
| |
= link_to _("Back"), upload_supplier_articles_path(@supplier) = link_to "Zurück", upload_supplier_articles_path(@supplier)

View File

@ -1,18 +1,23 @@
- title "#{@supplier.name} / Artikel hochladen" - title "#{@supplier.name} / Artikel hochladen"
%p %p
%i %i
=_ 'The file-type must be "csv" (textfile). Use a semicolon (";") to seperate the fields and double quotes ("Bananas...") for the text.' Die Datei muss eine Textdatei mit der Endung '.csv' sein. Die erste Zeile
wird beim Einlesen ignoriert.
%br/ %br/
=_ 'The character-set has to be "UTF-8". The first row, maybe used for headers, will be ignored.' Die Felder müssen mit einem Semikolon (';') getrennt und der Text mit doppelten
Anführungszeichen ("Text...") umklammert werden.
%br/
Als Zeichensatz wird UTF-8 erwartet.
%p %p
%i %i
=_ "Correct order of the columns:" Korrekte Reihenfolge der Spalten:
%br/ %br/
= [_("Status (x=outlistet)"), _("Number"), _("Name"), _("Note"), _("Manufacturer"), _("Origin"), | = ["Status (x=ausgelistet)", "Bestellnummer", "Name", "Notiz", "Hersteller", "Herkunft", |
_("Unit"), _("Net price"), _("Tax"), _("Deposit"), _("Unit quantity"), | "Einheit", "Preis(netto)", "MwSt", "Pfand", "Gebindegröße", |
_("Scale quantity"), _("Scale price"), _("Category")].join(" | ") | "Staffelmenge", "Staffelpreis", "Kategorie"].join(" | ") |
#uploadArticles.uploadForm #uploadArticles.uploadForm
- form_for(:articles, :url => parse_upload_supplier_articles_path(@supplier), :html => { :multipart => true }) do |form| - form_for :articles, :url => parse_upload_supplier_articles_path(@supplier), |
%p= form.file_field("file") :html => { :multipart => true } do |form| |
%p= submit_tag _("Upload articles") %p= form.file_field "file"
%p= submit_tag "Datei hochladen"

View File

@ -21,7 +21,7 @@
%tbody %tbody
- for supplier in @suppliers - for supplier in @suppliers
%tr{:class => cycle('even','odd', :name => 'suppliers')} %tr{:class => cycle('even','odd', :name => 'suppliers')}
%td= link_to "<b>#{h(supplier.name)}</b> (#{supplier.articles.not_in_stock.count})", supplier_articles_path(supplier) %td= link_to "<b>#{h(supplier.name)}</b> (#{supplier.articles.count})", supplier_articles_path(supplier)
%td=h supplier.phone %td=h supplier.phone
%td=h supplier.customer_number %td=h supplier.customer_number
%td= link_to "Anzeigen", supplier %td= link_to "Anzeigen", supplier