diff --git a/app/helpers/orders_helper.rb b/app/helpers/orders_helper.rb
index 4203723b..3e91848d 100644
--- a/app/helpers/orders_helper.rb
+++ b/app/helpers/orders_helper.rb
@@ -32,48 +32,47 @@ module OrdersHelper
# sensible in tables with multiple columns calling `pkg_helper`
def pkg_helper(article, options={})
return nil if article.unit_quantity == 1
- uq_text = "× #{article.unit_quantity}"
- uq_text = "#{uq_text}" if options[:soft_uq]
+ uq_text = "× #{article.unit_quantity}".html_safe
+ uq_text = content_tag(:span, uq_text, class: 'hidden-phone') if options[:soft_uq]
if options[:icon].nil? or options[:icon]
- pkg_helper_icon(uq_text).html_safe
+ pkg_helper_icon(uq_text)
else
- pkg_helper_icon(uq_text, tag: 'span').html_safe
+ pkg_helper_icon(uq_text, tag: :span)
end
end
def pkg_helper_icon(c=nil, options={})
options = {tag: 'i', class: ''}.merge(options)
if c.nil?
- c = " "
+ c = " ".html_safe
options[:class] += " icon-only"
end
- "<#{options[:tag]} class='package #{options[:class]}'>#{c}#{options[:tag]}>"
+ content_tag(options[:tag], c, class: "package #{options[:class]}").html_safe
end
def article_price_change_hint(order_article, gross=false)
return nil if order_article.article.price == order_article.price.price
title = "#{t('helpers.orders.old_price')}: #{number_to_currency order_article.article.price}"
title += " / #{number_to_currency order_article.article.gross_price}" if gross
- "".html_safe
+ content_tag(:i, nil, class: 'icon-asterisk', title: j(title)).html_safe
end
def receive_input_field(form)
order_article = form.object
units_expected = (order_article.units_billed or order_article.units_to_order)
- # unlock button, to prevent overwriting if it was manually distributed
- input_html = ''
- if order_article.result_manually_changed?
- input_html += '' +
- button_tag(nil, type: :button, class: 'btn unlocker', title: t('.locked_to_protect_unlock_button')) {''.html_safe}
- end
-
- input_html += form.text_field :units_received, class: 'input input-nano package units_received',
+ input_html = form.text_field :units_received, class: 'input input-nano package units_received',
data: {'units-expected' => units_expected},
disabled: order_article.result_manually_changed?,
- title: order_article.result_manually_changed? ? t('.locked_to_protect_manual_update') : nil,
autocomplete: 'off'
- input_html += '' if order_article.result_manually_changed?
+ if order_article.result_manually_changed?
+ input_html = content_tag(:span, class: 'input-prepend intable', title: t('.field_locked_title', default: '')) {
+ button_tag(nil, type: :button, class: 'btn unlocker') {
+ content_tag(:i, nil, class: 'icon icon-unlock')
+ } + input_html
+ }
+ end
+
input_html.html_safe
end
end
diff --git a/app/views/orders/_edit_amounts.html.haml b/app/views/orders/_edit_amounts.html.haml
index 2afbd58c..74e5653a 100644
--- a/app/views/orders/_edit_amounts.html.haml
+++ b/app/views/orders/_edit_amounts.html.haml
@@ -66,6 +66,7 @@
function unlock_receive_input_field() {
$('.units_received', $(this).closest('tr')).prop('disabled', false).focus();
+ $(this).closest('.input-prepend').prop('title', I18n.t('orders.edit_amount.field_unlocked_title'));
$(this).replaceWith('');
}
diff --git a/config/i18n-js.yml b/config/i18n-js.yml
index 76af6fda..c1d71d19 100644
--- a/config/i18n-js.yml
+++ b/config/i18n-js.yml
@@ -1,4 +1,10 @@
# only serve selected strings for i18n-js to keep filesize down
translations:
- file: 'app/assets/javascripts/i18n/translations.js'
- only: ['*.js.*', '*.number.*', '*.date.formats.*']
+ only: [
+ '*.js.*',
+ '*.number.*',
+ '*.date.formats.*',
+ # foodsoft-specific texts to keep js with normal translations
+ '*.orders.edit_amount.*'
+ ]
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 31c7d47c..87e325ff 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -750,7 +750,7 @@ en:
new_invoice: New invoice
show_invoice: Show invoice
orders:
- old_price: Old price
+ old_price: Old price
option_choose: Choose supplier/stock
option_stock: Stock
order_pdf: Create PDF
@@ -1113,8 +1113,8 @@ en:
edit:
title: Edit order
edit_amount:
- locked_to_protect_manual_update: The distribution of this article among the ordergroups was changed manually. This field was locked in order to protect those changes. To redistribute anyway, press the unlock button and change the amount.
- locked_to_protect_unlock_button: Press this button to unlock the received field. Any previous manual changes will be overwritten and the article will be redistributed over the ordergroups.
+ field_locked_title: The distribution of this article among the ordergroups was changed manually. This field is locked to protect those changes. To redistribute and overwrite those changes, press the unlock button and change the amount.
+ field_unlocked_title: The distribution of this article among the ordergroups was changed manually. When you change the amount, those manual changes will be overwritten.
fax:
amount: Amount
articles: Articles