i18n financial_transactions + controller
This commit is contained in:
parent
8722a5ed36
commit
640e9799aa
7 changed files with 59 additions and 27 deletions
|
@ -34,7 +34,7 @@ class Finance::FinancialTransactionsController < ApplicationController
|
|||
@financial_transaction = FinancialTransaction.new(params[:financial_transaction])
|
||||
@financial_transaction.user = current_user
|
||||
@financial_transaction.add_transaction!
|
||||
redirect_to finance_ordergroup_transactions_url(@ordergroup), :notice => "Die Transaktion wurde gespeichert."
|
||||
redirect_to finance_ordergroup_transactions_url(@ordergroup), notice: t('finance.financial_transactions.create.notice')
|
||||
rescue ActiveRecord::RecordInvalid => error
|
||||
flash.now[:alert] = error.message
|
||||
render :action => :new
|
||||
|
@ -51,9 +51,9 @@ class Finance::FinancialTransactionsController < ApplicationController
|
|||
Ordergroup.find(trans[:ordergroup_id]).add_financial_transaction!(trans[:amount], params[:note], @current_user)
|
||||
end
|
||||
end
|
||||
redirect_to finance_ordergroups_url, notice: "Alle Transaktionen wurden gespeichert."
|
||||
redirect_to finance_ordergroups_url, notice: t('finance.create_collection.create.notice')
|
||||
rescue => error
|
||||
redirect_to finance_new_transaction_collection_url, alert: "Ein Fehler ist aufgetreten: " + error.to_s
|
||||
redirect_to finance_new_transaction_collection_url, alert: t('finance.create_collection.create.alert', error: error.to_s)
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
= select_tag 'financial_transactions[][ordergroup_id]',
|
||||
options_for_select(Ordergroup.order(:name).all.map { |g| [ g.name, g.id ] })
|
||||
%td= text_field_tag 'financial_transactions[][amount]', nil, class: 'input-small'
|
||||
%td= link_to "Entfernen", "#", :title => "Gruppe enfernen", 'data-remove-transaction' => true,
|
||||
%td= link_to t('.remove'), "#", :title => t('.remove_group'), 'data-remove-transaction' => true,
|
||||
class: 'btn btn-small'
|
|
@ -4,10 +4,10 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%td= sort_link_helper "Datum", "date"
|
||||
%td Wer
|
||||
%td= sort_link_helper "Notiz", "note"
|
||||
%td= sort_link_helper "Betrag", "amount"
|
||||
%td= sort_link_helper t('.date'), "date"
|
||||
%td= t('.who')
|
||||
%td= sort_link_helper t('.note'), "note"
|
||||
%td= sort_link_helper t('amount'), "amount"
|
||||
%tbody
|
||||
- @financial_transactions.each do |t|
|
||||
%tr
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
- title "Kontoauszug für #{@ordergroup.name}"
|
||||
- title t('.title', name: @ordergroup.name)
|
||||
|
||||
- content_for :actionbar do
|
||||
= link_to 'Neue Transaktion anlegen', new_finance_ordergroup_transaction_path(@ordergroup), class: 'btn btn-primary'
|
||||
= link_to t('.new_transaction'), new_finance_ordergroup_transaction_path(@ordergroup), class: 'btn btn-primary'
|
||||
|
||||
- content_for :sidebar do
|
||||
.well.well-small
|
||||
%strong Kontostand: #{number_to_currency(@ordergroup.account_balance)}
|
||||
%strong= t('.balance', balance: number_to_currency(@ordergroup.account_balance))
|
||||
%br/
|
||||
%small (zuletzt aktualisiert vor #{distance_of_time_in_words(Time.now, @ordergroup.account_updated)})
|
||||
%small= t('.last_updated_at', when: distance_of_time_in_words(Time.now, @ordergroup.account_updated))
|
||||
.well.well-small
|
||||
= form_tag finance_ordergroup_transactions_path(@ordergroup), :method => :get, :remote => true,
|
||||
'data-submit-onchange' => true, class: 'form-search' do
|
||||
= text_field_tag :query, params[:query], class: 'input-medium search-query',
|
||||
placeholder: 'Suchen ...'
|
||||
placeholder: t('.search_placeholder')
|
||||
|
||||
|
||||
#transactions= render 'transactions'
|
|
@ -1,6 +1,6 @@
|
|||
- title "Neue Transaktion"
|
||||
- title t('.title')
|
||||
|
||||
%p Hier kannst du der Bestellgruppe <b>#{@ordergroup.name}</b> Geld gutschreiben/abziehen.
|
||||
%p!= t('.paragraph', name: @ordergroup.name)
|
||||
|
||||
= simple_form_for @financial_transaction, :url => finance_ordergroup_transactions_path(@ordergroup),
|
||||
:validate => true do |f|
|
||||
|
@ -9,4 +9,4 @@
|
|||
= f.input :note, :as => :text
|
||||
.form-actions
|
||||
= f.submit class: 'btn btn-primary'
|
||||
= link_to "oder abbrechen", finance_ordergroup_transactions_path(@ordergroup)
|
||||
= link_to t('.or_cancel'), finance_ordergroup_transactions_path(@ordergroup)
|
|
@ -1,4 +1,4 @@
|
|||
- title "Mehrere Konten aktualisieren"
|
||||
- title t('.title')
|
||||
|
||||
- content_for :javascript do
|
||||
:javascript
|
||||
|
@ -17,22 +17,20 @@
|
|||
});
|
||||
|
||||
- content_for :sidebar do
|
||||
.well.well-small
|
||||
Hier kannst Du mehrere Konten gleichzeitig aktualsieren.
|
||||
Z.B. alle Überweisungen der Bestellgruppen aus einem Kontoauszug.
|
||||
.well.well-small= t('.sidebar')
|
||||
|
||||
= form_tag finance_create_transaction_collection_path do
|
||||
%p
|
||||
%b Notiz
|
||||
%b= t('.note')
|
||||
= text_field_tag :note, params[:note], class: 'input-xlarge', required: 'required'
|
||||
%p
|
||||
%table#ordergroups{:style => "width:20em"}
|
||||
%tr
|
||||
%th Bestellgruppe
|
||||
%th Betrag
|
||||
%th= t('.ordergroup')
|
||||
%th= t('.amount')
|
||||
= render :partial => 'ordergroup', :collection => [1, 2, 3]
|
||||
%p
|
||||
= link_to "Weitere Bestellgruppe hinzufügen", '#', 'data-add-transaction' => true, class: 'btn'
|
||||
= link_to t('.new_ordergroup'), '#', 'data-add-transaction' => true, class: 'btn'
|
||||
.form-actions
|
||||
= submit_tag "Transaktionen speichern", class: 'btn btn-primary'
|
||||
= link_to "oder abbrechen", finance_ordergroups_path
|
||||
= submit_tag t('.save'), class: 'btn btn-primary'
|
||||
= link_to t('.or_cancel'), finance_ordergroups_path
|
|
@ -96,3 +96,37 @@ de:
|
|||
tax: 'MwSt'
|
||||
refund: 'Pfand'
|
||||
add_article: 'Artikel hinzufügen'
|
||||
financial_transactions:
|
||||
create:
|
||||
notice: "Die Transaktion wurde gespeichert."
|
||||
create_collection:
|
||||
notice: "Alle Transaktionen wurden gespeichert."
|
||||
alert: "Ein Fehler ist aufgetreten: %{error}"
|
||||
ordergroup:
|
||||
remove: "Entfernen"
|
||||
remove_group: "Gruppe enfernen"
|
||||
transactions:
|
||||
date: "Datum"
|
||||
who: "Wer"
|
||||
note: "Notiz"
|
||||
amount: "Betrag"
|
||||
index:
|
||||
title: "Kontoauszug für %{name}"
|
||||
new_transaction: 'Neue Transaktion anlegen'
|
||||
balance: 'Kontostand: %{balance}'
|
||||
last_updated_at: '(zuletzt aktualisiert vor %{when})'
|
||||
search_placeholder: 'Suchen ...'
|
||||
new_collection:
|
||||
title: "Mehrere Konten aktualisieren"
|
||||
sidebar: 'Hier kannst Du mehrere Konten gleichzeitig aktualsieren. Z.B. alle Überweisungen der Bestellgruppen aus einem Kontoauszug.'
|
||||
new_ordergroup: 'Weitere Bestellgruppe hinzufügen'
|
||||
ordergroup: 'Bestellgruppe'
|
||||
note: 'Notiz'
|
||||
amount: 'Betrag'
|
||||
save: "Transaktionen speichern"
|
||||
or_cancel: 'oder abbrechen'
|
||||
new:
|
||||
title: "Neue Transaktion"
|
||||
paragraph: 'Hier kannst du der Bestellgruppe <b>%{name}</b> Geld gutschreiben/abziehen.'
|
||||
or_cancel: "oder abbrechen"
|
||||
|
Loading…
Reference in a new issue