Skip to content

Commit

Permalink
Merge pull request #212 from foodcoop-adam/i18n-cleanup
Browse files Browse the repository at this point in the history
i18n cleanup + small fixes
  • Loading branch information
wvengen committed Nov 25, 2013
2 parents ad2822d + 935fded commit 9c3eb9e
Show file tree
Hide file tree
Showing 20 changed files with 205 additions and 459 deletions.
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def heading_helper(model, attribute, options = {})
i18nopts = options.select {|a| !['short'].include?(a) }
s = model.human_attribute_name(attribute, i18nopts)
if options[:short]
sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({defaults: ''}))
s = raw "<abbr title='#{s}'>#{sshort}</abbr>" unless sshort.empty?
sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({fallback: true, default: ''}))
s = raw "<abbr title='#{s}'>#{sshort}</abbr>" unless sshort.blank?
end
s
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
%table.table.table-striped
%thead
%tr
%td= sort_link_helper t('.date'), "date"
%td= t('.who')
%td= sort_link_helper t('.note'), "note"
%td= sort_link_helper t('.amount'), "amount"
%th= sort_link_helper heading_helper(FinancialTransaction, :created_on), "date"
%th= heading_helper FinancialTransaction, :user
%th= sort_link_helper heading_helper(FinancialTransaction, :note), "note"
%th= sort_link_helper heading_helper(FinancialTransaction, :amount), "amount"
%tbody
- @financial_transactions.each do |t|
%tr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

= form_tag finance_create_transaction_collection_path do
%p
%b= t('.note')
%b= heading_helper FinancialTransaction, :note
= text_field_tag :note, params[:note], class: 'input-xlarge', required: 'required'
%p
%table#ordergroups{:style => "width:20em"}
%tr
%th= t('.ordergroup')
%th= t('.amount')
%th= heading_helper FinancialTransaction, :ordergroup
%th= heading_helper FinancialTransaction, :amount
= render :partial => 'ordergroup', :collection => [1, 2, 3]
%p
= link_to t('.new_ordergroup'), '#', 'data-add-transaction' => true, class: 'btn'
Expand Down
45 changes: 23 additions & 22 deletions app/views/group_orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@
%h2= @order.name
%dl.dl-horizontal
- unless @order.note.blank?
%dt= t '.note'
%dt= heading_helper Order, :note
%dd= @order.note
%dt= t '.created_by'
%dt= heading_helper Order, :created_by
%dd= show_user_link(@order.created_by)
%dt= t '.ending'
%dt= heading_helper Order, :ends
%dd= format_time(@order.ends)
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
%dt= t '.min_quantity'
%dt= heading_helper Supplier, :min_order_quantity, short: true
%dd= @order.supplier.min_order_quantity
%dt= t '.sum_amount'
%dd= number_to_currency @order.sum
%dt= t '.last_update'
%dd
= show_user(@group_order.updated_by) if @group_order.updated_by
(#{format_time(@group_order.updated_on)})
%dt= t '.funds'
- unless @group_order.new_record?
%dt= heading_helper GroupOrder, :updated_by
%dd
= show_user(@group_order.updated_by)
(#{format_time(@group_order.updated_on)})
%dt= heading_helper Ordergroup, :available_funds
%dd= number_to_currency(@ordering_data[:available_funds])

.well.pull-right
Expand All @@ -65,20 +66,20 @@
%table.table.table-hover
%thead
%tr
%th= t '.name'
%th= heading_helper Article, :name
- if @order.stockit?
%th{style: 'width:120px'}= t '.supplier'
%th{style: 'width:120px'}= heading_helper StockArticle, :supplier
%th{style: "width:13px;"}
%th{style: "width:4.5em;"}= t '.price'
%th{style: "width:4.5em;"}= t '.unit'
%th{style: "width:4.5em;"}= heading_helper Article, :unit
- unless @order.stockit?
%th{style: "width:70px;"}= t '.unit_missing'
%th#col_required= t '.amount'
%th#col_tolerance= t '.tolerance'
%th{style: "width:70px;"}= heading_helper OrderArticle, :missing_units, short: true
%th#col_required= heading_helper GroupOrderArticle, :quantity
%th#col_tolerance= heading_helper GroupOrderArticle, :tolerance
- else
%th(style="width:20px")= t '.available'
%th#col_required= t '.amount'
%th{style: "width:15px;"}= t '.sum'
%th(style="width:20px")= heading_helper StockArticle, :available
%th#col_required= heading_helper GroupOrderArticle, :quantity
%th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price
%tbody.list
- @order.articles_grouped_by_category.each do |category, order_articles|
%tr.list-heading.article-category
Expand Down Expand Up @@ -132,11 +133,11 @@
%span{id: "t_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] + @ordering_data[:order_articles][order_article.id][:others_tolerance]
%br/
.pull-left
#{t '.manufacturer'}: #{order_article.article.manufacturer}
#{heading_helper Article, :manufacturer}: #{order_article.article.manufacturer}
%br/
#{t '.units'}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit}
#{heading_helper Article, :units}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit}
%br/
#{t '.note'}: #{order_article.article.note}
#{heading_helper Article, :note}: #{order_article.article.note}
%br/
#order-footer
#info-box
Expand All @@ -147,7 +148,7 @@
%td.currency
%span#total_price= number_to_currency(@group_order.price)
%tr
%td= t('.available_funds') + ':'
%td= heading_helper(Ordergroup, :available_funds) + ':'
%td.currency= number_to_currency(@ordering_data[:available_funds])
%tr
%td= t('.new_funds') + ':'
Expand Down
6 changes: 3 additions & 3 deletions app/views/group_orders/_orders.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%table.table.table-striped
%thead
%tr
%th= t '.supplier'
%th= t '.ending'
%th= t '.sum'
%th= heading_helper Order, :name
%th= heading_helper Order, :ends
%th= heading_helper GroupOrder, :price
%tbody
- for order in orders
- group_order = order.group_order(@ordergroup) # Get GroupOrder if possible
Expand Down
10 changes: 5 additions & 5 deletions app/views/group_orders/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
%h2= t '.funds.title'
%table.table.table-striped
%tr
%td= t('.funds.account_balance') + ':'
%td= heading_helper Ordergroup, :account_balance
%td.numeric{:style => "width:5em"}= number_to_currency(@ordergroup.account_balance)
%tr
%td= '- ' + t('.funds.open_orders') + ':'
%td= '- ' + t('.funds.open_orders')
%td.numeric= number_to_currency(@ordergroup.value_of_open_orders)
%tr
%td= '- ' + t('.funds.finished_orders') + ':'
%td= '- ' + t('.funds.finished_orders')
%td.numeric= number_to_currency(@ordergroup.value_of_finished_orders)
%tr
%th= t('.funds.available_funds') + ':'
%th= heading_helper Ordergroup, :available_funds
%th.numeric= number_to_currency(@ordergroup.get_available_funds)

= render :partial => "shared/open_orders", :locals => {:ordergroup => @ordergroup}

// finished orders
- unless Order.finished.empty?
- unless Order.finished_not_closed.empty?
%section
%h2= t '.finished_orders.title'
= render :partial => "orders", :locals => {:orders => Order.finished_not_closed, :pagination => false}
Expand Down
88 changes: 0 additions & 88 deletions app/views/group_orders/order.html.haml

This file was deleted.

23 changes: 12 additions & 11 deletions app/views/group_orders/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@
.well
// Order summary
%dl.dl-horizontal
%dt= t '.supplier'
%dt= heading_helper Order, :name
%dd= @order.name
%dt= t '.note'
%dt= heading_helper Order, :note
%dd= @order.note
%dt= t '.ending'
%dt= heading_helper Order, :ends
%dd= format_time(@order.ends)
%dt= t '.order_sum'
%dt= heading_helper GroupOrder, :price
%dd
- if @group_order
= number_to_currency(@group_order.price)
- else
= t '.not_ordered'
- if @order.closed?
%p= t '.closed_by', user: show_user(@order.updated_by)
= link_to t('.comment'), "#comments"
%dt= heading_helper Order, :closed_by
%dd= show_user_link @order.updated_by
%p= link_to t('.comment'), "#comments"

// Article box
%section
Expand All @@ -35,8 +36,8 @@
%table.table.table-hover
%thead
%tr
%th{style: "width:40%"}= t '.articles.name'
%th= t '.articles.units'
%th{style: "width:40%"}= heading_helper Article, :name
%th= heading_helper Article, :units
%th= t '.articles.unit_price'
%th
%abbr{title: t('.articles.ordered_title')}= t '.articles.ordered'
Expand All @@ -46,7 +47,7 @@
= t '.articles.order_open'
- else
= t '.articles.order_not_open'
%th= t '.articles.total_price'
%th= heading_helper GroupOrderArticle, :total_price
%tbody
- for category_name, order_articles in @order.articles_grouped_by_category
%tr.article-category
Expand All @@ -61,7 +62,7 @@
%td{style: "width:40%"}
= oa.article.name
- unless oa.article.note.blank?
= image_tag("lamp_grey.png", {alt: "Notiz anzeigen", size: "15x16", border: "0", onmouseover: "$('note_#{oa.id}').show();", onmouseout: "$('note_#{oa.id}').hide();"})
= image_tag("lamp_grey.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"})
%td= "#{oa.price.unit_quantity} x #{oa.article.unit}"
%td= number_to_currency(oa.price.fc_price)
%td
Expand All @@ -73,7 +74,7 @@
%tr{id: "note_#{oa.id}", class: "note even", style: "display:none"}
%td{colspan: "6"}=h oa.article.note
%tr{class: cycle('even', 'odd', name: 'articles')}
%th{colspan: "5"}= t '.articles.sum'
%th{colspan: "5"}= heading_helper GroupOrder, :price
%th= number_to_currency(@group_order.price)
%br/
= link_to_top
Expand Down
8 changes: 4 additions & 4 deletions app/views/home/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
%h3= t '.my_ordergroup.transactions.title'
%table.table.table-striped
%tr
%th= t '.my_ordergroup.transactions.when'
%th= t '.my_ordergroup.transactions.where'
%th= t '.my_ordergroup.transactions.note'
%th= t '.my_ordergroup.transactions.amount'
%th= heading_helper FinancialTransaction, :created_on
%th= heading_helper FinancialTransaction, :user
%th= heading_helper FinancialTransaction, :note
%th= heading_helper FinancialTransaction, :amount
- for ft in current_user.ordergroup.financial_transactions.limit(5).order('created_on DESC')
%tr
%td= format_time(ft.created_on)
Expand Down
4 changes: 2 additions & 2 deletions app/views/home/ordergroup.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
- unless @ordergroup.description.blank?
%p= @ordergroup.description
%p
%b= Ordergroup.human_attribute_name(:available_funds) + ':'
%b= heading_helper(Ordergroup, :available_funds) + ':'
= number_to_currency(@ordergroup.get_available_funds())
%p
%b= Ordergroup.human_attribute_name(:user_tokens) + ':'
%b= heading_helper(Ordergroup, :user_tokens) + ':'
= @ordergroup.memberships.map{|m| show_user m.user}.join(', ')
= link_to t('.invite'), new_invite_path(:id => @ordergroup), :remote => true, class: 'btn btn-primary'
.span8
Expand Down
4 changes: 2 additions & 2 deletions app/views/orders/_articles.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
%table.table.table-hover
%thead
%tr
%th= t '.name'
%th= t '.unit_quantity'
%th= heading_helper Article, :name
%th= heading_helper Article, :unit_quantity
%th= t '.prices'
%th= t '.units_ordered'
- unless order.stockit?
Expand Down
10 changes: 5 additions & 5 deletions app/views/orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
%table.table.table-hover#articleList
%tr
%th= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' }
%th= t '.name'
%th= t '.note'
%th= heading_helper Article, :name
%th= heading_helper Article, :note
- if @order.stockit?
%th= t '.stockit'
- else
%th= t '.origin'
%th= t '.supplier'
%th= t '.unit_quantity'
%th= heading_helper Article, :origin
%th= heading_helper Article, :manufacturer
%th= heading_helper Article, :unit_quantity
%th= t '.prices'
- for category_name, articles in @order.articles_for_ordering
%tr.article-category
Expand Down
Loading

0 comments on commit 9c3eb9e

Please sign in to comment.