Translations for articles-pages.
This commit is contained in:
parent
6202e05841
commit
053593f718
12 changed files with 89 additions and 104 deletions
|
@ -28,8 +28,8 @@ class ArticlesController < ApplicationController
|
|||
# if somebody uses the search field:
|
||||
conditions = ["articles.name LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
||||
|
||||
@total = @supplier.articles.not_in_stock.count(:conditions => conditions)
|
||||
@articles = @supplier.articles.not_in_stock.paginate(:order => sort,
|
||||
@total = @supplier.articles.count(:conditions => conditions)
|
||||
@articles = @supplier.articles.paginate(:order => sort,
|
||||
:conditions => conditions,
|
||||
:page => params[:page],
|
||||
:per_page => @per_page,
|
||||
|
@ -136,10 +136,7 @@ class ArticlesController < ApplicationController
|
|||
|
||||
# Renders a form for editing all articles from a supplier
|
||||
def edit_all
|
||||
@articles = @supplier.articles.not_in_stock.find :all,
|
||||
:order => 'article_categories.name, articles.name',
|
||||
:include => [:article_category]
|
||||
|
||||
@articles = @supplier.articles.all
|
||||
end
|
||||
|
||||
# Updates all article of specific supplier
|
||||
|
@ -309,15 +306,15 @@ class ArticlesController < ApplicationController
|
|||
def sync
|
||||
# check if there is an 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)
|
||||
end
|
||||
# sync articles against external database
|
||||
@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)}
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -107,14 +107,18 @@ module ApplicationHelper
|
|||
icons = { :delete => { :file => 'b_drop.png', :alt => 'Löschen'},
|
||||
:edit => { :file => 'b_edit.png', :alt => 'Bearbeiten'}}
|
||||
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
|
||||
end
|
||||
|
||||
# Remote links with default 'loader'.gif during request
|
||||
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))
|
||||
end
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ module ArticlesHelper
|
|||
end
|
||||
|
||||
def row_classes(article)
|
||||
classes = ""
|
||||
classes += ' unavailable' if article.availability
|
||||
classes = " click-me"
|
||||
classes += " unavailable" if !article.availability
|
||||
classes += " just_updated" if @article.recently_updated && @article.availability
|
||||
classes
|
||||
end
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
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)
|
||||
if delivery.invoice
|
||||
|
|
|
@ -35,7 +35,6 @@ class Article < ActiveRecord::Base
|
|||
has_many :article_prices, :order => "created_at"
|
||||
|
||||
named_scope :available, :conditions => {:availability => true}
|
||||
named_scope :not_in_stock, :conditions => {:type => nil}
|
||||
|
||||
# Validations
|
||||
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category_id
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
class Supplier < ActiveRecord::Base
|
||||
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'
|
||||
has_many :stock_articles
|
||||
has_many :stock_articles, :include => [:article_category], :order => 'article_categories.name, articles.name'
|
||||
has_many :orders
|
||||
has_many :deliveries
|
||||
has_many :invoices
|
||||
|
@ -51,13 +51,11 @@ class Supplier < ActiveRecord::Base
|
|||
for article in articles
|
||||
# try to find the associated 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?
|
||||
unless unequal_attributes.blank?
|
||||
# update objekt but don't save it
|
||||
unless unequal_attributes.blank? # skip if shared_article has not been changed
|
||||
|
||||
# try to convert different units
|
||||
new_price, new_unit_quantity = article.convert_units
|
||||
|
|
|
@ -10,23 +10,18 @@
|
|||
<td><%= @article.unit_quantity -%></td>
|
||||
<td class="currency">
|
||||
<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) -%>
|
||||
</acronym>
|
||||
</td>
|
||||
<td><%= number_to_percentage(@article.tax) if @article.tax != 0 -%></td>
|
||||
<td><%= number_to_currency(@article.deposit) if @article.deposit != 0 -%></td>
|
||||
<td>
|
||||
<%= link_to_remote icon(:edit, :onclick => "checkRow('#{@article.id.to_s}')"),
|
||||
:url => edit_supplier_article_path(@supplier, @article),
|
||||
:method => :get,
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %>
|
||||
<%= link_to_remote icon(:delete, :onclick => "checkRow('#{@article.id.to_s}')"),
|
||||
<%= remote_link_to icon(:edit, :onclick => "checkRow('#{@article.id.to_s}')"),
|
||||
:url => edit_supplier_article_path(@supplier, @article) %>
|
||||
<%= remote_link_to icon(:delete, :onclick => "checkRow('#{@article.id.to_s}')"),
|
||||
:url => [@supplier, @article],
|
||||
:method => :delete,
|
||||
:confirm => 'Bist du sicher?',
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %>
|
||||
:confirm => 'Bist du sicher?' %>
|
||||
</td>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
%p
|
||||
=_ 'Number of found articles :'
|
||||
Gefundene Artikel:
|
||||
%b= @total
|
||||
|
||||
%p
|
||||
|
@ -16,18 +16,18 @@
|
|||
%tr
|
||||
%th
|
||||
%th[sort_td_class_helper "name"]
|
||||
= sort_link_helper _("Name"), "name"
|
||||
= sort_link_helper "Name", "name"
|
||||
%th
|
||||
%th[sort_td_class_helper "category"]
|
||||
= sort_link_helper _("Category"), "category"
|
||||
= sort_link_helper "Kategorie", "category"
|
||||
%th[sort_td_class_helper "unit"]
|
||||
= sort_link_helper _("Unit"), "unit"
|
||||
= sort_link_helper "Einheit", "unit"
|
||||
%th[sort_td_class_helper "note"]
|
||||
= sort_link_helper _("Note"), "note"
|
||||
%th{:style => "width: 4em;"}=_ 'UnitQu'
|
||||
%th{:style => "width: 4em;"}=_ 'Price'
|
||||
%th{:style => "width: 3.5em;"}=_ 'Tax'
|
||||
%th{:style => "width: 4em;"}=_ 'Deposit'
|
||||
= sort_link_helper "Notiz", "note"
|
||||
%th{:style => "width: 4em;"} Gebgr.
|
||||
%th{:style => "width: 4em;"} Preis
|
||||
%th{:style => "width: 3.5em;"} MwSt
|
||||
%th{:style => "width: 4em;"} Pfand
|
||||
%th{:style => "width: 3em;"}
|
||||
|
||||
%tbody#listbody
|
||||
|
@ -47,14 +47,10 @@
|
|||
%option{:value => "setAvailable", :onclick => 'formSubmit();'} Artikel sind verfügbar
|
||||
|
||||
= hidden_field_tag 'supplier_id', @supplier.id
|
||||
%p
|
||||
= pagination_links_remote @articles, :params => {:sort => params[:sort]}
|
||||
|
||||
:plain
|
||||
<script type="text/javascript">
|
||||
function formSubmit() {
|
||||
$("articlesInListForm").submit()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
%p= pagination_links_remote @articles, :params => {:sort => params[:sort]}
|
||||
|
||||
:javascript
|
||||
function formSubmit() {
|
||||
$("articlesInListForm").submit()
|
||||
}
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
// import menu
|
||||
- unless @supplier.shared_supplier.nil?
|
||||
.menu{:style => 'width: 14em'}
|
||||
.menu{:style => 'width: 16em'}
|
||||
%ul
|
||||
%li
|
||||
=_ 'External database'
|
||||
Zugriff auf externe Datenbank
|
||||
%ul
|
||||
%li= link_to_function _('search/import'), "Element.toggle('import')"
|
||||
%li= link_to _('sync'), sync_supplier_articles_path(@supplier), :method => :post
|
||||
%li= link_to_function "Suchen/Importieren", "Element.toggle('import')"
|
||||
%li= link_to "Synchronisieren", sync_supplier_articles_path(@supplier), :method => :post
|
||||
|
||||
|
||||
#change_supplier{:style => "padding:0 0 0.5em 0.7em;"}
|
||||
%span{:style => "float:left"}
|
||||
=_ 'Change supplier:'
|
||||
Lieferant wechseln:
|
||||
- form_tag do
|
||||
= select_tag :switch_supplier, |
|
||||
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?
|
||||
#import.single_column{:style => "display:none; clear:both"}
|
||||
.box_title
|
||||
%h2=_ 'Import articles'
|
||||
%h2 Artikel importieren
|
||||
.column_content
|
||||
#search{:style => "padding-bottom:3em"}
|
||||
- form_remote_tag :url => shared_supplier_articles_path(@supplier), |
|
||||
:before => "Element.show('loader')", :success => "Element.hide('loader')", |
|
||||
:method => :get do |
|
||||
= text_field_tag :import_query, params['import_query'], :size => 10
|
||||
= submit_tag _('Search articles')
|
||||
= submit_tag "Suchen"
|
||||
- if @supplier.shared_supplier.lists
|
||||
=_ "Search in following lists: "
|
||||
Suche in folgenden Listen:
|
||||
- @supplier.shared_supplier.lists.each do |token, name|
|
||||
= check_box_tag "lists[#{token}]", "1", true
|
||||
= name
|
||||
|
|
||||
=_ "only regional:"
|
||||
Nur aus der Region:
|
||||
= check_box_tag "regional", "1", false
|
||||
#search_results
|
||||
// "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'}
|
||||
.box_title
|
||||
.column_content
|
||||
#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_search_form{:style=>"display:inline;"}
|
||||
- form_remote_tag :url => supplier_articles_path(@supplier), |
|
||||
:before => "Element.show('loader')", :success => "Element.hide('loader')", |
|
||||
: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 )
|
||||
= submit_tag _('Search')
|
||||
= submit_tag "Suchen"
|
||||
|
||||
%form{ :action => url_for(update_selected_supplier_articles_path(@supplier)), :method => "post", :id => "articlesInListForm" }
|
||||
#table= render :partial => 'articles'
|
||||
|
||||
%br/
|
||||
= link_to _('Back'), :action => 'index'
|
||||
#edit_article{:style => "display:none"}
|
||||
= link_to "Zurück", :action => 'index'
|
||||
#edit_article{:style => "display:none"}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
- title "#{@supplier.name} / Artikel hochladen"
|
||||
%p
|
||||
%i
|
||||
=_ "Please check the parsed articles and choose a supplier at the end of page."
|
||||
Bitte überprüfe die eingelesenen Artikel.
|
||||
%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
|
||||
%table
|
||||
%tr
|
||||
%th=_ "Number"
|
||||
%th=_ "Name"
|
||||
%th=_ "Note"
|
||||
%th=_ "Manufacturer"
|
||||
%th=_ "Origin"
|
||||
%th=_ "Unit"
|
||||
%th=_ "Net price"
|
||||
%th=_ "Tax"
|
||||
%th=_ "Deposit"
|
||||
%th=_ "Unit quantity"
|
||||
%th=_ "Category"
|
||||
%th Nummer
|
||||
%th Name
|
||||
%th Notiz
|
||||
%th Hersteller
|
||||
%th Herkunft
|
||||
%th Einheit
|
||||
%th Nettopreis
|
||||
%th MwSt
|
||||
%th Pfand
|
||||
%th Gebindegröße
|
||||
%th Kategorie
|
||||
- for article in @articles
|
||||
- fields_for "articles[]", article do |form|
|
||||
%tr{:class => cycle('even', 'odd')}
|
||||
|
@ -34,7 +34,7 @@
|
|||
%td= form.text_field 'unit_quantity', :size => 4
|
||||
%td= form.select 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }
|
||||
%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)
|
||||
|
|
@ -1,18 +1,23 @@
|
|||
- title "#{@supplier.name} / Artikel hochladen"
|
||||
%p
|
||||
%i
|
||||
=_ 'The file-type must be "csv" (textfile). Use a semicolon (";") to seperate the fields and double quotes ("Bananas...") for the text.'
|
||||
%i
|
||||
Die Datei muss eine Textdatei mit der Endung '.csv' sein. Die erste Zeile
|
||||
wird beim Einlesen ignoriert.
|
||||
%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
|
||||
%i
|
||||
=_ "Correct order of the columns:"
|
||||
Korrekte Reihenfolge der Spalten:
|
||||
%br/
|
||||
= [_("Status (x=outlistet)"), _("Number"), _("Name"), _("Note"), _("Manufacturer"), _("Origin"), |
|
||||
_("Unit"), _("Net price"), _("Tax"), _("Deposit"), _("Unit quantity"), |
|
||||
_("Scale quantity"), _("Scale price"), _("Category")].join(" | ") |
|
||||
= ["Status (x=ausgelistet)", "Bestellnummer", "Name", "Notiz", "Hersteller", "Herkunft", |
|
||||
"Einheit", "Preis(netto)", "MwSt", "Pfand", "Gebindegröße", |
|
||||
"Staffelmenge", "Staffelpreis", "Kategorie"].join(" | ") |
|
||||
|
||||
#uploadArticles.uploadForm
|
||||
- form_for(:articles, :url => parse_upload_supplier_articles_path(@supplier), :html => { :multipart => true }) do |form|
|
||||
%p= form.file_field("file")
|
||||
%p= submit_tag _("Upload articles")
|
||||
- form_for :articles, :url => parse_upload_supplier_articles_path(@supplier), |
|
||||
:html => { :multipart => true } do |form| |
|
||||
%p= form.file_field "file"
|
||||
%p= submit_tag "Datei hochladen"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
%tbody
|
||||
- for supplier in @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.customer_number
|
||||
%td= link_to "Anzeigen", supplier
|
||||
|
|
Loading…
Reference in a new issue