complete show order i18n

Conflicts:
	app/helpers/orders_helper.rb
This commit is contained in:
wvengen 2014-01-17 14:25:06 +01:00
parent 42d622d1b2
commit 5b6d1a66a6
3 changed files with 56 additions and 29 deletions

View file

@ -79,4 +79,23 @@ module OrdersHelper
input_html.html_safe
end
def ordergroup_count(order)
group_orders = order.group_orders.includes(:ordergroup)
txt = "#{group_orders.count} #{Ordergroup.model_name.human count: group_orders.count}"
if group_orders.count == 0
return txt
else
desc = group_orders.all.map {|g| g.ordergroup.name}.join(', ')
content_tag(:abbr, txt, title: desc).html_safe
end
end
def supplier_link(order_or_supplier)
if order_or_supplier.kind_of?(Order) and order_or_supplier.stockit?
link_to(order_or_supplier.name, stock_articles_path).html_safe
else
link_to(@order.supplier.name, supplier_path(@order.supplier)).html_safe
end
end
end

View file

@ -1,37 +1,20 @@
- title t('.title', name: @order.name)
- content_for :javascript do
:javascript
function activate_search(view, placeholder) {
new List(document.body, {
valueNames: ['name'],
engine: 'unlist',
plugins: [
['reset', {highlightClass: 'btn-primary'}],
['delay', {delayedSearchTime: 500}],
],
// make large pages work too (as we don't have paging)
page: 10000,
indexAsync: true
});
$('#query').attr('placeholder', placeholder);
}
$(function() {
activate_search('default', '#{j t('.search_placeholder.default')}');
});
.well
%button{type: "button", class: "close", data: {dismiss: 'alert'}}= t('ui.marks.close').html_safe
%p
#{@order.state.capitalize} order from
#{link_to @order.supplier.name, supplier_path(@order.supplier)}
created by #{show_user_link @order.created_by},
open from #{format_time @order.starts} until #{format_time @order.ends}.
= raw t '.description1',
state: t("orders.state.#{@order.state}").capitalize,
supplier: supplier_link(@order),
who: show_user_link(@order.created_by),
starts: format_time(@order.starts),
ends: format_time(@order.ends)
%br
%abbr{title: @order.group_orders.includes(:ordergroup).all.map {|g| g.ordergroup.name}.join(', ')}
#{@order.group_orders.count} #{Ordergroup.model_name.human count: @order.group_orders.count}
ordered #{@order.order_articles.ordered.count} articles with a total value of
#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))} (net / gross).
= raw t '.description2',
ordergroups: ordergroup_count(@order),
article_count: @order.order_articles.ordered.count,
net_sum: number_to_currency(@order.sum(:net)),
gross_sum: number_to_currency(@order.sum(:gross))
- if @note.present?
%p
@ -98,3 +81,24 @@
= render partial: 'shared/comments', locals: { comments: @order.comments }
#new_comment= render partial: 'order_comments/form', locals: { order_comment: @order.comments.build(user: current_user)}
= link_to_top
- content_for :javascript do
:javascript
function activate_search(view, placeholder) {
new List(document.body, {
valueNames: ['name'],
engine: 'unlist',
plugins: [
['reset', {highlightClass: 'btn-primary'}],
['delay', {delayedSearchTime: 500}],
],
// make large pages work too (as we don't have paging)
page: 10000,
indexAsync: true
});
$('#query').attr('placeholder', placeholder);
}
$(function() {
activate_search('default', '#{j t('.search_placeholder.default')}');
});

View file

@ -184,7 +184,9 @@ en:
order: Order
order_article: Order article
order_comment: Order comment
ordergroup: Ordergroup
ordergroup:
one: Ordergroup
other: Ordergroups
stock_article: Stock article
stock_taking: Stock taking
supplier: Supplier
@ -1169,6 +1171,8 @@ en:
confirm_end: ! 'Do you really want to close the order %{order}?
There is no going back.'
description1: ! '%{state} order from %{supplier} created by %{who}, open from %{starts} until %{ends}.'
description2: ! '%{ordergroups} ordered %{article_count} articles, with a total value of %{net_sum} / %{gross_sum} (net / gross).'
download:
article_pdf: Article PDF
download_file: Download file