Class: Admin::TranslationsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Admin::TranslationsController
- Defined in:
- app/controllers/admin/translations_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from BaseHelper
Instance Method Details
#all ⇒ Object
17 18 19 20 |
# File 'app/controllers/admin/translations_controller.rb', line 17 def all @search = Translation.not_pending.order("created_at desc").search(params[:search]) @translations = @search.where(:locale => params[:language]).page(params[:page]).per(10) end |
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/admin/translations_controller.rb', line 27 def create params[:translations].values.each do |record| logger.debug("DESTROY : #{record[:destroy]}") destroy_record = record.delete(:destroy) if destroy_record == "false" record_id = record.delete(:id) translation = Translation.find(record_id) logger.debug("TRANSLATION : #{translation.inspect}") logger.debug("RECORD : #{record.inspect}") translation.update_attributes(record) end end redirect_to admin_translations_path, :notice => t('translations.notice.translation_added') end |
#destroy ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'app/controllers/admin/translations_controller.rb', line 42 def destroy @translation = Translation.find(params[:id]) @translation.destroy respond_with(@translation) do |format| format.html { redirect_to admin_translations_path(:language => params[:language]) } format.js end end |
#dump ⇒ Object
51 52 53 54 |
# File 'app/controllers/admin/translations_controller.rb', line 51 def dump Translation.dump_all redirect_to admin_translations_path, :notice => t('translations.notice.dumped') end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/admin/translations_controller.rb', line 12 def index @pending_translations = Translation.pending.group_by{|t| t.locale } @all_translations = Translation.not_pending.group_by{|t| t.locale } end |
#pending ⇒ Object
22 23 24 25 |
# File 'app/controllers/admin/translations_controller.rb', line 22 def pending @search = Translation.pending.order("created_at desc").search(params[:search]) @translations = @search.where(:locale => params[:language]).page(params[:page]).per(10) end |