Skip to content

Commit

Permalink
Merge pull request #220 from wvengen/feature-i18n-cleanup
Browse files Browse the repository at this point in the history
Some more i18n cleanup
  • Loading branch information
wvengen committed Dec 17, 2013
2 parents b26b124 + 94b2c8e commit f47413a
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 320 deletions.
5 changes: 5 additions & 0 deletions app/models/ordergroup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def non_members
User.natural_order.all.reject { |u| (users.include?(u) || u.ordergroup) }
end

# the most recent order this ordergroup was participating in
def last_order
orders.order('orders.starts DESC').first
end

def value_of_open_orders(exclude = nil)
group_orders.in_open_orders.reject{|go| go == exclude}.collect(&:price).sum
end
Expand Down
10 changes: 5 additions & 5 deletions app/views/admin/ordergroups/_ordergroups.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
%table.table.table-striped
%thead
%tr
%th= t '.name'
%th= t '.contact'
%th= t '.address'
%th= t '.members'
%th= t 'admin.actions'
%th= heading_helper Ordergroup, :name
%th= heading_helper Ordergroup, :contact
%th= heading_helper Ordergroup, :contact_address
%th= heading_helper Ordergroup, :user_tokens
%th= t 'ui.actions'
%tbody
- for ordergroup in @ordergroups
%tr{:class => cycle('even','odd', :name => 'groups')}
Expand Down
10 changes: 5 additions & 5 deletions app/views/admin/users/_users.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
%thead
%tr
- if FoodsoftConfig[:use_nick]
%th= t '.login'
%th= t '.name'
%th= t '.email'
%th= heading_helper User, :nick
%th= heading_helper User, :name
%th= heading_helper User, :email
%th= t 'admin.access_to'
%th= t '.last_login'
%th(colspan="2")= t 'admin.actions'
%th= heading_helper User, :last_login
%th(colspan="2")= t 'ui.actions'
%tbody
- for user in @users
%tr
Expand Down
8 changes: 4 additions & 4 deletions app/views/admin/users/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
%p= t '.member_since', time: distance_of_time_in_words(Time.now, @user.created_on)
%dl
- if FoodsoftConfig[:use_nick]
%dt= t '.nick'
%dt= heading_helper User, :nick
%dd= @user.nick
%dt= t '.name'
%dt= heading_helper User, :name
%dd= h @user.name
%dt= t '.email'
%dt= heading_helper User, :email
%dd= @user.email
%dt= t '.phone'
%dt= heading_helper User, :phone
%dd= @user.phone
%dt= t 'admin.access_to'
%dd= format_roles(@user)
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/workgroups/_workgroups.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%th= t '.name'
%th= t '.members'
%th= t 'admin.access_to'
%th= t 'admin.actions'
%th= t 'ui.actions'
%tbody
- for workgroup in @workgroups
%tr
Expand Down
20 changes: 10 additions & 10 deletions app/views/deliveries/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
%table#stock_articles_for_adding.table.table-hover.stupidtable
%thead
%tr
%th.default-sort{:data => {:sort => 'string'}}= t '.article'
%th= t '.price'
%th= t '.unit'
%th= t '.category'
%th= t '.actions'
%th.default-sort{:data => {:sort => 'string'}}= Article.model_name.human
%th= heading_helper StockArticle, :price
%th= heading_helper StockArticle, :unit
%th= heading_helper StockArticle, :article_category
%th= t 'ui.actions'
%tfoot
%tr
%th{:colspan => 5}
Expand All @@ -127,11 +127,11 @@
%table.table#stock_changes.stupidtable
%thead
%tr
%th.default-sort{:data => {:sort => 'string'}}= t '.article'
%th= t '.price'
%th= t '.unit'
%th= t '.quantity'
%th= t '.actions'
%th.default-sort{:data => {:sort => 'string'}}= Article.model_name.human
%th= heading_helper StockArticle, :price
%th= heading_helper StockArticle, :unit
%th= heading_helper GroupOrderArticle, :quantity # quantity to order, although technically this will be a StockChange
%th= t 'ui.actions'
%tbody
= f.simple_fields_for :stock_changes do |stock_change_form|
= render :partial => 'stock_change_fields', :locals => {:f => stock_change_form}
Expand Down
8 changes: 4 additions & 4 deletions app/views/deliveries/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
%table.table.table-striped(style="width:500px")
%thead
%tr
%th= t '.article'
%th= t '.unit'
%th.numeric= t '.amount'
%th.numeric= t '.price'
%th= Article.model_name.human
%th= heading_helper StockArticle, :unit
%th.numeric= heading_helper GroupOrderArticle, :quantity # quantity to order, although technically this will be a StockChange
%th.numeric= heading_helper Article, :price
%th.numeric= t '.sum'
%tbody
- total_net, total_gross = 0,0
Expand Down
10 changes: 5 additions & 5 deletions app/views/finance/balancing/_edit_results_by_articles.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
%table.ordered-articles.table.table-striped
%thead
%tr
%th= sort_link_helper t('.article'), "name"
%th= sort_link_helper t('.number'), "order_number"
%th= sort_link_helper Article.model_name.human, "name"
%th= sort_link_helper Article.human_attribute_name(:order_number_short), "order_number"
%th= t('.amount')
%th= t('.amount_per_unit')
%th= heading_helper Article, :units
%th= t('.net')
%th= t('.gross')
%th= t('.tax')
%th= t('.refund')
%th= heading_helper Article, :tax
%th= heading_helper Article, :deposit
%th{:colspan => "2"}
= link_to t('.add_article'), new_finance_order_order_article_path(@order), remote: true,
class: 'btn btn-small'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%thead
%tr
%td
%td{:style => "width:8em"}= t('.group')
%td{:style => "width:8em"}= Ordergroup.model_name.human
%td= t('.units')
%td= t('.total')
%td{:colspan => "3",:style => "width:14em"}
Expand Down
4 changes: 2 additions & 2 deletions app/views/finance/balancing/_order_article.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
= order_article.units_to_order
- unless order_article.ordered_quantities_equal_to_group_orders?
%span{:style => "color:red;font-weight: bold"} !
%td= order_article.price.unit_quantity.to_s + ' * ' + order_article.article.unit.to_s
%td #{order_article.price.unit_quantity} × #{order_article.article.unit}
%td
= number_to_currency(order_article.price.price, :unit => "")
:plain
Expand All @@ -16,7 +16,7 @@
:plain
/
= number_to_currency(order_article.total_gross_price, :unit => "")
%td= order_article.price.tax
%td #{order_article.price.tax}%
%td= order_article.price.deposit
%td
= link_to t('ui.edit'), edit_finance_order_order_article_path(order_article.order, order_article), remote: true,
Expand Down
20 changes: 10 additions & 10 deletions app/views/finance/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
%table.table.table-striped
%thead
%tr
%th= t('.date')
%th.numeric= t('.amount')
%th= t('.supplier')
%th= heading_helper Invoice, :date
%th.numeric= heading_helper Invoice, :amount
%th= heading_helper Invoice, :supplier
%th
%tbody
- for invoice in @unpaid_invoices
Expand All @@ -26,10 +26,10 @@
%table.table.table-striped
%thead
%tr
%th= t('.date')
%th= t('.group')
%th= t('.note')
%th.numeric= t('.amount')
%th= heading_helper FinancialTransaction, :created_on
%th= heading_helper FinancialTransaction, :ordergroup
%th= heading_helper FinancialTransaction, :note
%th.numeric= heading_helper FinancialTransaction, :amount
%tbody
- @financial_transactions.each do |ft|
%tr
Expand All @@ -45,8 +45,8 @@
%table.table.table-striped
%thead
%tr
%th= t('.supplier')
%th= t('.end')
%th= heading_helper Order, :name
%th= t '.end'
%th.numeric= t('.amount_fc')
%th
%tbody
Expand All @@ -55,6 +55,6 @@
%td= order.name
%td= format_date(order.ends)
%td.numeric= number_to_currency(order.sum(:fc))
%td= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini'
%td= link_to t('finance.balancing.orders.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini'
- else
= t('.everything_cleared')
2 changes: 1 addition & 1 deletion app/views/finance/invoices/_invoices.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
%td= format_date invoice.date
%td= format_date invoice.paid_on
%td= number_to_currency invoice.amount
%td= link_to t('.delivery'), [invoice.supplier,invoice.delivery] if invoice.delivery
%td= link_to Delivery.model_name.human, [invoice.supplier,invoice.delivery] if invoice.delivery
%td= link_to format_date(invoice.order.ends), new_finance_order_path(order_id: invoice.order_id) if invoice.order
%td= truncate(invoice.note)
%td= link_to t('ui.edit'), edit_finance_invoice_path(invoice), class: 'btn btn-mini'
Expand Down
6 changes: 3 additions & 3 deletions app/views/finance/ordergroups/_ordergroups.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
%table.table.table-striped
%thead
%tr
%th= sort_link_helper t('.name'), "name", :per_page => @per_page
%th= t '.contact'
%th.numeric= sort_link_helper t('.account_balance'), "account_balance", :per_page => @per_page
%th= sort_link_helper heading_helper(Ordergroup, :name), "name", :per_page => @per_page
%th= heading_helper Ordergroup, :contact
%th.numeric= sort_link_helper heading_helper(Ordergroup, :account_balance), "account_balance", :per_page => @per_page
%th
%tbody
- for ordergroup in @ordergroups
Expand Down
8 changes: 4 additions & 4 deletions app/views/foodcoop/ordergroups/_ordergroups.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
%table.table.table-striped
%thead
%tr
%th= t '.name'
%th= t '.user'
%th= t '.last_ordered'
%th= heading_helper Ordergroup, :name
%th= heading_helper Ordergroup, :user_tokens
%th= heading_helper Ordergroup, :last_order

%tbody
- for ordergroup in @ordergroups
%tr
%td= ordergroup.name
%td=h ordergroup.users.collect { |u| show_user(u) }.join(", ")
%td= format_date ordergroup.orders.order('orders.starts DESC').first.try(:starts)
%td= format_date ordergroup.last_order.try(:starts)
%td= link_to_new_message(message_params: {group_id: ordergroup.id})

4 changes: 2 additions & 2 deletions app/views/shared/_articles_by_groups.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%table.table.table-hover
%thead
%tr
%th{:style => "width:40%"}= t '.name'
%th{:style => "width:40%"}= heading_helper Article, :name
%th
%acronym{:title => t('shared.articles.ordered_desc')}= t 'shared.articles.ordered'
%th
Expand All @@ -10,7 +10,7 @@
%acronym{:title => t('.fc_price_desc')}= t '.fc_price'
%th
%acronym{:title => t('.unit_quantity_desc')}= t '.unit_quantity'
%th= t '.unit'
%th= heading_helper Article, :unit
%th= t '.price'

- for group_order in order.group_orders.ordered
Expand Down
8 changes: 4 additions & 4 deletions app/views/shared/_group.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
%dl
%dt= t('.description') + ':'
%dt= heading_helper(Ordergroup, :description) + ':'
%dd=h group.description
- if group.is_a?(Ordergroup) and (@current_user.role_admin? or @current_user.role_finance?)
%dt= t('.contact') + ':'
%dt= heading_helper(Ordergroup, :contact) + ':'
%dd=h group.contact
%dt= t('.address') + ':'
%dt= heading_helper(Ordergroup, :contact_address) + ':'
%dd= link_to_gmaps group.contact_address
%dt= t('.access') + ':'
%dd= format_roles(group)
%dt= t('.members') + ':'
%dt= heading_helper(Ordergroup, :user_tokens) + ':'
%dd
- members = group.users
= "(#{members.size})"
Expand Down

0 comments on commit f47413a

Please sign in to comment.