Sha256: 7ab215af6d00e58d24e8c5386ee78522e0228a8959defb83b2e9743b95300c84

Contents?: true

Size: 957 Bytes

Versions: 2

Compression:

Stored size: 957 Bytes

Contents

module TranslationCenter
  class ApplicationController < ActionController::Base
    before_filter :translation_langs_filters
    before_filter :authenticate_user!

    if Rails.env.development?

      # if an exception happens show the error page
      rescue_from Exception do |exception|
        @exception = exception
        @path = request.path

        render "translation_center/errors/exception"
      end
      
    end

    # defaults
    def translation_langs_filters
      session[:current_filter] ||= 'untranslated'
      session[:lang_from] = :pt
      session[:lang_to] = app_params[:lang_to] || session[:lang_to] || :en
      I18n.locale = session[:lang_from] || I18n.default_locale
    end

    protected
    
    def can_admin?
      current_user.can_admin_translations?
    end

    def set_page_number
      app_params[:page] ||= 1
      @page = app_params[:page].to_i
    end

    def app_params
      params.permit!
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
afalkear_translation_center-1.8.4 app/controllers/translation_center/application_controller.rb
afalkear_translation_center-1.8.3 app/controllers/translation_center/application_controller.rb