Sha256: 7860b10caf667676d9109dee439e64ff8237dc57fdd40d4e9f11b4aab8fbc3f4

Contents?: true

Size: 959 Bytes

Versions: 7

Compression:

Stored size: 959 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] ||= :en
      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

7 entries across 7 versions & 1 rubygems

Version Path
afalkear_translation_center-1.8.2 app/controllers/translation_center/application_controller.rb
afalkear_translation_center-1.8.1 app/controllers/translation_center/application_controller.rb
afalkear_translation_center-1.8.0 app/controllers/translation_center/application_controller.rb
afalkear_translation_center-1.7.9 app/controllers/translation_center/application_controller.rb
afalkear_translation_center-1.7.8 app/controllers/translation_center/application_controller.rb
afalkear_translation_center-0.0.0 app/controllers/translation_center/application_controller.rb
afalkear_translation_center-1.7.7 app/controllers/translation_center/application_controller.rb