Fix title of new upload screen

This commit is contained in:
wvengen 2015-03-27 14:38:16 +01:00
parent 26e7012ef0
commit 16e9210035
7 changed files with 41 additions and 45 deletions

View file

@ -139,6 +139,7 @@ class ArticlesController < ApplicationController
def parse_upload
uploaded_file = params[:articles]['file']
options = {filename: uploaded_file.original_filename}
# @todo move parsing to model (concern)
@updated_article_pairs, @outlisted_articles, @new_articles = [], [], []
FoodsoftFile::parse uploaded_file.tempfile, options do |status, new_attrs, line|
article = @supplier.articles.where(order_number: new_attrs[:order_number]).first
@ -162,7 +163,6 @@ class ArticlesController < ApplicationController
end
@ignored_article_count = 0
render :sync
rescue => error
redirect_to upload_supplier_articles_path(@supplier), :alert => I18n.t('errors.general_msg', :msg => error.message)
end

View file

@ -0,0 +1,32 @@
- if @outlisted_articles.any?
%h2= t '.outlist.title'
%p
= t('.outlist.body').html_safe
%ul
- for article in @outlisted_articles
%li
= hidden_field_tag "outlisted_articles[#{article.id}]", '1'
= article.name
- if article.in_open_order
.alert= t '.outlist.alert_used', article: article.name
%hr/
- if @updated_article_pairs.any?
%h2= t '.update.title'
%p
%i
= t '.update.update_msg', count: @updated_article_pairs.size
= t '.update.body'
= render 'sync_table', articles: @updated_article_pairs, field: 'articles', hidden_fields: %w(shared_updated_on)
%hr/
- if @new_articles.any?
%h2= t '.upnew.title'
%p
%i= t '.upnew.body_count', count: @new_articles.length
= render 'sync_table', articles: @new_articles, field: 'new_articles', hidden_fields: %w(shared_updated_on order_number)
%hr/
- if @ignored_article_count > 0
%p
%i= t '.outlist.body_ignored', count: @ignored_article_count

View file

@ -1,11 +1,7 @@
- title t('.title', supplier: @supplier.name)
%p= t('.body').html_safe
= form_tag(create_from_upload_supplier_articles_path(@supplier)) do
= render layout: 'edit_all_table' do |form|
= form.hidden_field :manufacturer
= form.hidden_field :origin
= form_tag update_synchronized_supplier_articles_path(@supplier) do
= render 'sync'
.form-actions
= submit_tag t('.submit', supplier: @supplier.name), class: 'btn btn-primary'
= submit_tag t('.submit'), class: 'btn btn-primary'
= link_to t('ui.or_cancel'), upload_supplier_articles_path(@supplier)

View file

@ -1,39 +1,6 @@
- title t('.title')
= form_tag update_synchronized_supplier_articles_path(@supplier) do
- if @outlisted_articles.any?
%h2= t '.outlist.title'
%p
= t('.outlist.body').html_safe
%ul
- for article in @outlisted_articles
%li
= hidden_field_tag "outlisted_articles[#{article.id}]", '1'
= article.name
- if article.in_open_order
.alert= t '.outlist.alert_used', article: article.name
%hr/
- if @updated_article_pairs.any?
%h2= t '.update.title'
%p
%i
= t '.update.update_msg', count: @updated_article_pairs.size
= t '.update.body'
= render 'sync_table', articles: @updated_article_pairs, field: 'articles', hidden_fields: %w(shared_updated_on)
%hr/
- if @new_articles.any?
%h2= t '.upnew.title'
%p
%i= t '.upnew.body_count', count: @new_articles.length
= render 'sync_table', articles: @new_articles, field: 'new_articles', hidden_fields: %w(shared_updated_on order_number)
%hr/
- if @ignored_article_count > 0
%p
%i= t '.outlist.body_ignored', count: @ignored_article_count
= hidden_field 'supplier', 'id'
= render 'sync'
= submit_tag t('.submit'), class: 'btn btn-primary'
= link_to t('ui.or_cancel'), supplier_articles_path(@supplier)

View file

@ -21,4 +21,5 @@
%label(for="articles_file")= t '.file_label'
= f.file_field "file"
.form-actions
= submit_tag t('.submit'), class: 'btn'
= submit_tag t('.submit'), class: 'btn btn-primary'
= link_to t('ui.or_cancel'), supplier_articles_path(@supplier)

View file

@ -407,7 +407,7 @@ en:
error_nosel: You have selected no articles
parse_upload:
body: "<p><i>Please verify the articles.</i></p> <p><i>Warning, at the moment there is no check for duplicate articles.</i></p>"
submit: Upload
submit: Process upload
title: Upload articles
sync:
outlist:

View file

@ -404,7 +404,7 @@ nl:
error_nosel: Je hebt geen artikelen geselecteerd
parse_upload:
body: "<p><i>Ingelezen artikelen graag controleren.</i></p> <p><i>Let op, momenteel vind er geen controle op dubbele artikelen plaats.</i></p>"
submit: Uploaden
submit: Upload verwerken
title: Artikelen uploaden
sync:
outlist: