Sha256: 52b2fb107fa6e7eead00f3aace7f8f2d784e527645efe1ac0b1cd36619dc8673

Contents?: true

Size: 859 Bytes

Versions: 4

Compression:

Stored size: 859 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] ||= :en
      I18n.locale = session[:lang_from] || I18n.default_locale
    end

    protected
    
    def can_admin?
      current_user.can_admin_translations?
    end

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

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
translation_center-1.6.1 app/controllers/translation_center/application_controller.rb
translation_center-1.6.0 app/controllers/translation_center/application_controller.rb
translation_center-1.5.9 app/controllers/translation_center/application_controller.rb
translation_center-1.5.8 app/controllers/translation_center/application_controller.rb