Extract registrar controller translations in admin area

#279
This commit is contained in:
Artur Beljajev 2017-02-20 13:00:45 +02:00
parent 6f907e11b5
commit b4b715f405
7 changed files with 61 additions and 11 deletions

View file

@ -23,10 +23,10 @@ class Admin::RegistrarsController < AdminController
@registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
end
flash[:notice] = I18n.t('registrar_added')
flash[:notice] = t('.created')
redirect_to [:admin, @registrar]
rescue ActiveRecord::RecordInvalid
flash.now[:alert] = I18n.t('failed_to_add_registrar')
flash.now[:alert] = t('.not_created')
render 'new'
end
end
@ -35,10 +35,10 @@ class Admin::RegistrarsController < AdminController
def update
if @registrar.update(registrar_params)
flash[:notice] = I18n.t('registrar_updated')
flash[:notice] = t('.updated')
redirect_to [:admin, @registrar]
else
flash.now[:alert] = I18n.t('failed_to_update_registrar')
flash.now[:alert] = t('.not_updated')
render 'edit'
end
end

View file

@ -75,7 +75,7 @@
.col-md-8
.panel.panel-default
.panel-heading.clearfix
.pull-left= t(:misc)
.pull-left= t('.misc')
.panel-body
.form-group
.col-md-4.control-label
@ -91,4 +91,4 @@
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')
= button_tag(t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success')

View file

@ -1,5 +1,5 @@
- content_for :actions do
= link_to(t(:new), new_admin_registrar_path, class: 'btn btn-primary')
= link_to(t('.new_btn'), new_admin_registrar_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:registrars)
.row