Sha256: 709f8c7927ff8cf79f866ba2c20c3279e01e2ab9cc3393a8e27033411c8db958

Contents?: true

Size: 898 Bytes

Versions: 12

Compression:

Stored size: 898 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] = 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
      params[:page] ||= 1
      @page = params[:page].to_i
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
translation_center-1.7.2 app/controllers/translation_center/application_controller.rb
translation_center-1.7.1 app/controllers/translation_center/application_controller.rb
translation_center-1.7.0 app/controllers/translation_center/application_controller.rb
translation_center-1.6.10 app/controllers/translation_center/application_controller.rb
translation_center-1.6.9 app/controllers/translation_center/application_controller.rb
translation_center-1.6.8 app/controllers/translation_center/application_controller.rb
translation_center-1.6.7 app/controllers/translation_center/application_controller.rb
translation_center-1.6.6 app/controllers/translation_center/application_controller.rb
translation_center-1.6.5 app/controllers/translation_center/application_controller.rb
translation_center-1.6.4 app/controllers/translation_center/application_controller.rb
translation_center-1.6.3 app/controllers/translation_center/application_controller.rb
translation_center-1.6.2 app/controllers/translation_center/application_controller.rb