Class: Kakimasu::TranslationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Kakimasu::TranslationsController
show all
- Includes:
- PaginationHelper
- Defined in:
- app/controllers/kakimasu/translations_controller.rb
Instance Method Summary
collapse
#get_page_size, #set_page_size, #total_pages
Instance Method Details
#create ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/kakimasu/translations_controller.rb', line 19
def create
authorize :translation, :create?
I18n.available_locales.each do |l|
params[l]&.gsub!("'", "'")
I18n.backend.store_translations(l, { params[:key] => params[l] }, escape: false) unless params[l].blank?
end
params[:value]&.gsub!("'", "'")
I18n.backend.store_translations(params[:language], { params[:key] => params[:value] }, escape: false) if params[:language]
if request.xhr?
respond_to do |format|
format.js {}
end
else
redirect_to :back
end
end
|
#index ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/kakimasu/translations_controller.rb', line 6
def index
authorize :translation, :index?
policy_scope(Translation)
@translations = TRANSLATION_STORE @grouped_keys = @translations.keys.group_by { |key| key.partition('.').last } @active_tab = 'translations'
set_page_size(10) params[:page] = 1 unless params[:page] end
|