finish i18n of models without view
This commit is contained in:
parent
75a1051668
commit
f81e315d6f
7 changed files with 44 additions and 16 deletions
|
@ -6,7 +6,7 @@ class Membership < ActiveRecord::Base
|
||||||
before_destroy :check_last_admin
|
before_destroy :check_last_admin
|
||||||
|
|
||||||
# messages
|
# messages
|
||||||
ERR_NO_ADMIN_MEMBER_DELETE = "Mitgliedschaft kann nicht beendet werden. Du bist die letzte Administratorin"
|
ERR_NO_ADMIN_MEMBER_DELETE = I18n.t('model.membership.no_admin_delete')
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,9 @@ class Order < ActiveRecord::Base
|
||||||
|
|
||||||
# Sets order.status to 'close' and updates all Ordergroup.account_balances
|
# Sets order.status to 'close' and updates all Ordergroup.account_balances
|
||||||
def close!(user)
|
def close!(user)
|
||||||
raise "Bestellung wurde schon abgerechnet" if closed?
|
raise I18n.t('orders.model.error_closed') if closed?
|
||||||
transaction_note = "Bestellung: #{name}, bis #{ends.strftime('%d.%m.%Y')}"
|
transaction_note = I18n.t('orders.model.notice_close', :name => name,
|
||||||
|
:ends => ends.strftime(I18n.t('date.formats.default')))
|
||||||
|
|
||||||
gos = group_orders.all(:include => :ordergroup) # Fetch group_orders
|
gos = group_orders.all(:include => :ordergroup) # Fetch group_orders
|
||||||
gos.each { |group_order| group_order.update_price! } # Update prices of group_orders
|
gos.each { |group_order| group_order.update_price! } # Update prices of group_orders
|
||||||
|
@ -201,18 +202,18 @@ class Order < ActiveRecord::Base
|
||||||
|
|
||||||
# Close the order directly, without automaticly updating ordergroups account balances
|
# Close the order directly, without automaticly updating ordergroups account balances
|
||||||
def close_direct!(user)
|
def close_direct!(user)
|
||||||
raise "Bestellung wurde schon abgerechnet" if closed?
|
raise I18n.t('orders.model.error_closed') if closed?
|
||||||
update_attributes! state: 'closed', updated_by: user
|
update_attributes! state: 'closed', updated_by: user
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def starts_before_ends
|
def starts_before_ends
|
||||||
errors.add(:ends, "muss nach dem Bestellstart liegen (oder leer bleiben)") if (ends && starts && ends <= starts)
|
errors.add(:ends, I18n.t('articles.model.error_starts_before_ends')) if (ends && starts && ends <= starts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_articles
|
def include_articles
|
||||||
errors.add(:articles, "Es muss mindestens ein Artikel ausgewählt sein") if article_ids.empty?
|
errors.add(:articles, I18n.t('articles.model.error_nosel')) if article_ids.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_order_articles
|
def save_order_articles
|
||||||
|
|
|
@ -136,7 +136,7 @@ class OrderArticle < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def article_and_price_exist
|
def article_and_price_exist
|
||||||
errors.add(:article, "muss angegeben sein und einen aktuellen Preis haben") if !(article = Article.find(article_id)) || article.fc_price.nil?
|
errors.add(:article, I18n.t('model.order_article.error_price')) if !(article = Article.find(article_id)) || article.fc_price.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Associate with current article price if created in a finished order
|
# Associate with current article price if created in a finished order
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Page < ActiveRecord::Base
|
||||||
unless old_title.blank?
|
unless old_title.blank?
|
||||||
Page.create :redirect => id,
|
Page.create :redirect => id,
|
||||||
:title => old_title,
|
:title => old_title,
|
||||||
:body => "Weiterleitung auf [[#{title}]]..",
|
:body => I18n.t('model.page.redirect', :title => title),
|
||||||
:permalink => Page.permalink(old_title),
|
:permalink => Page.permalink(old_title),
|
||||||
:updated_by => updated_by
|
:updated_by => updated_by
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,13 +44,13 @@ class User < ActiveRecord::Base
|
||||||
# returns the User-settings and the translated description
|
# returns the User-settings and the translated description
|
||||||
def self.setting_keys
|
def self.setting_keys
|
||||||
{
|
{
|
||||||
"notify.orderFinished" => 'Informier mich über meine Bestellergebnisse (nach Ende der Bestellung).',
|
"notify.orderFinished" => I18n.t('model.user.notify.order_finished'),
|
||||||
"notify.negativeBalance" => 'Informiere mich, falls meine Bestellgruppe ins Minus rutscht.',
|
"notify.negativeBalance" => I18n.t('model.user.notify.negative_balance'),
|
||||||
"notify.upcoming_tasks" => 'Erinnere mich an anstehende Aufgaben.',
|
"notify.upcoming_tasks" => I18n.t('model.user.notify.upcoming_tasks'),
|
||||||
"messages.sendAsEmail" => 'Bekomme Nachrichten als Emails.',
|
"messages.sendAsEmail" => I18n.t('model.user.notify.send_as_email'),
|
||||||
"profile.phoneIsPublic" => 'Telefon ist für Mitglieder sichtbar',
|
"profile.phoneIsPublic" => I18n.t('model.user.notify.phone_is_public'),
|
||||||
"profile.emailIsPublic" => 'E-Mail ist für Mitglieder sichtbar',
|
"profile.emailIsPublic" => I18n.t('model.user.notify.email_is_public'),
|
||||||
"profile.nameIsPublic" => 'Name ist für Mitglieder sichtbar'
|
"profile.nameIsPublic" => I18n.t('model.user.notify.name_is_public')
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
# retuns the default setting for a NEW user
|
# retuns the default setting for a NEW user
|
||||||
|
@ -132,7 +132,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def ordergroup_name
|
def ordergroup_name
|
||||||
ordergroup ? ordergroup.name : "keine Bestellgruppe"
|
ordergroup ? ordergroup.name : I18n.t('model.user.no_ordergroup')
|
||||||
end
|
end
|
||||||
|
|
||||||
# returns true if user is a member of a given group
|
# returns true if user is a member of a given group
|
||||||
|
|
|
@ -257,6 +257,25 @@ de:
|
||||||
amount: Betrag
|
amount: Betrag
|
||||||
note: Notiz
|
note: Notiz
|
||||||
|
|
||||||
|
# messages in model that don't have a corresponding view
|
||||||
|
model:
|
||||||
|
membership:
|
||||||
|
no_admin_delete: 'Mitgliedschaft kann nicht beendet werden. Du bist die letzte Administratorin'
|
||||||
|
order_article:
|
||||||
|
error_price: 'muss angegeben sein und einen aktuellen Preis haben'
|
||||||
|
page:
|
||||||
|
redirect: 'Weiterleiting auf [[%{title}]]...'
|
||||||
|
user:
|
||||||
|
notify:
|
||||||
|
order_finished: 'Informier mich über meine Bestellergebnisse (nach Ende der Bestellung).'
|
||||||
|
negative_balance: 'Informiere mich, falls meine Bestellgruppe ins Minus rutscht.'
|
||||||
|
upcoming_tasks: 'Erinnere mich an anstehende Aufgaben.'
|
||||||
|
send_as_email: 'Bekomme Nachrichten als Emails.'
|
||||||
|
phone_is_public: 'Telefon ist für Mitglieder sichtbar'
|
||||||
|
email_is_public: 'E-Mail ist für Mitglieder sichtbar'
|
||||||
|
name_is_public: 'Name ist für Mitglieder sichtbar'
|
||||||
|
no_ordergroup: 'keine Bestellgruppe'
|
||||||
|
|
||||||
helpers:
|
helpers:
|
||||||
select:
|
select:
|
||||||
prompt: Bitte wählen
|
prompt: Bitte wählen
|
||||||
|
|
|
@ -85,3 +85,11 @@ de:
|
||||||
number: 'Nummer'
|
number: 'Nummer'
|
||||||
amount: 'Menge'
|
amount: 'Menge'
|
||||||
name: 'Name'
|
name: 'Name'
|
||||||
|
|
||||||
|
# used by model
|
||||||
|
model:
|
||||||
|
notice_close: 'Bestellung: %{name}, bis %{ends}'
|
||||||
|
error_closed: 'Bestellung wurde schon abgerechnet'
|
||||||
|
error_starts_before_ends: 'muss nach dem Bestellstart liegen (oder leer bleiben)'
|
||||||
|
error_nosel: 'Es muss mindestens ein Artikel ausgewählt sein'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue