Fixed articles sync view.

This commit is contained in:
Benjamin Meichsner 2013-03-17 17:47:37 +01:00
parent c05b3e0e19
commit 329c451774

View file

@ -1,6 +1,6 @@
%h1 Artikel mit externer Datenbank synchronisieren - title 'Artikel mit externer Datenbank synchronisieren'
- form_tag update_all_supplier_articles_path(@supplier, :sync => "1") do = form_tag update_all_supplier_articles_path(@supplier, :sync => "1") do
%h2 Auslisten ... %h2 Auslisten ...
%p %p
- unless @outlisted_articles.empty? - unless @outlisted_articles.empty?
@ -25,7 +25,8 @@
Werten vorausgefüllt. Werten vorausgefüllt.
%br/ %br/
Abweichungen zu den alten Artikeln sind gelb markiert. Abweichungen zu den alten Artikeln sind gelb markiert.
%table %table.table
%thead
%tr %tr
%th Name %th Name
%th Notiz %th Notiz
@ -37,8 +38,9 @@
%th MwSt. %th MwSt.
%th Pfand %th Pfand
%th Kategorie %th Kategorie
- @updated_articles.each do |@article, unequal_attributes| %tbody
- article = Article.find(@article.id) - @updated_articles.each do |updated_article, attrs|
- article = Article.find(updated_article.id)
%tr{:style => 'color:grey'} %tr{:style => 'color:grey'}
%td= article.name %td= article.name
%td= article.note %td= article.note
@ -51,21 +53,21 @@
%td= article.deposit %td= article.deposit
%td= article.article_category.name if article.article_category %td= article.article_category.name if article.article_category
%tr %tr
- fields_for 'articles[]', @article do |form| = fields_for 'articles[]', updated_article do |form|
%td{:style => highlight_new(unequal_attributes, :name)} %td{:style => highlight_new(attrs, :name)}
= form.text_field 'name', :size => 0 = form.text_field 'name', :size => 0
= form.hidden_field 'shared_updated_on' = form.hidden_field 'shared_updated_on'
%td{:style => highlight_new(unequal_attributes, :note)}= form.text_field 'note', :size => 15 %td{:style => highlight_new(attrs, :note)}= form.text_field 'note', class: 'input-small'
%td{:style => highlight_new(unequal_attributes, :manufacturer)}= form.text_field 'manufacturer', :size => 10 %td{:style => highlight_new(attrs, :manufacturer)}= form.text_field 'manufacturer', class: 'input-small'
%td{:style => highlight_new(unequal_attributes, :origin)}= form.text_field 'origin', :size => 5 %td{:style => highlight_new(attrs, :origin)}= form.text_field 'origin', class: 'input-mini'
%td{:style => highlight_new(unequal_attributes, :unit)}= form.text_field 'unit', :size => 5 %td{:style => highlight_new(attrs, :unit)}= form.text_field 'unit', class: 'input-mini'
%td{:style => highlight_new(unequal_attributes, :unit_quantity)}= form.text_field 'unit_quantity', :size => 5 %td{:style => highlight_new(attrs, :unit_quantity)}= form.text_field 'unit_quantity', class: 'input-mini'
%td{:style => highlight_new(unequal_attributes, :price)}= form.text_field 'price', :size => 5 %td{:style => highlight_new(attrs, :price)}= form.text_field 'price', class: 'input-mini'
%td{:style => highlight_new(unequal_attributes, :tax)}= form.text_field 'tax', :size => 4 %td{:style => highlight_new(attrs, :tax)}= form.text_field 'tax', class: 'input-mini'
%td{:style => highlight_new(unequal_attributes, :deposit)}= form.text_field 'deposit', :size => 4 %td{:style => highlight_new(attrs, :deposit)}= form.text_field 'deposit', class: 'input-mini'
%td= select 'article[]', 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }, { :include_blank => true } %td= form.select :article_category_id, ArticleCategory.all.map {|a| [ a.name, a.id ] },
{include_blank: true}, class: 'input-small'
%hr/ %hr/
= hidden_field 'supplier', 'id' = hidden_field 'supplier', 'id'
= submit_tag 'Alle löschen/aktualisieren' = submit_tag 'Alle löschen/aktualisieren', class: 'btn btn-primary'
| = link_to 'oder abbrechen', supplier_articles_path(@supplier)
= link_to 'Abbrechen', supplier_articles_path(@supplier)