Sha256: ce020bd9d7cbf762361095e536a99b64e4207563ce7b65e91f23145e9ded1aba

Contents?: true

Size: 1.32 KB

Versions: 20

Compression:

Stored size: 1.32 KB

Contents

require_dependency "translation_center/application_controller"

module TranslationCenter
  class CenterController < ApplicationController

    before_filter :can_admin?, only: [ :dashboard, :search_activity ]

    # set language user translating from
    def set_language_from
      session[:lang_from] = params[:lang].to_sym
      I18n.locale = session[:lang_from]
      render nothing: true
    end

    # set language user translating to
    def set_language_to
      session[:lang_to] = params[:lang].to_sym
      respond_to do |format|
        format.html { redirect_to root_url } 
        format.js { render nothing: true }
      end
    end

    def dashboard
      @stats = TranslationKey.langs_stats
      @langs = @stats.keys
      # to be used for meta search
      @search = Audited::Adapters::ActiveRecord::Audit.search(params[:search])
      #TODO perpage constant should be put somewhere else
      @translations_changes = Translation.recent_changes.paginate(:page => params[:page], :per_page => 5)
      respond_to do |format|
        format.html
        format.js { render 'search_activity' }
      end
    end

    def search_activity
      @translations_changes = Translation.recent_changes(params[:search]).paginate(:page => params[:page], :per_page => 5)
      respond_to do |format|
        format.js
      end
    end

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
translation_center-1.1.0 app/controllers/translation_center/center_controller.rb
translation_center-1.0.4 app/controllers/translation_center/center_controller.rb
translation_center-1.0.3 app/controllers/translation_center/center_controller.rb
translation_center-1.0.2 app/controllers/translation_center/center_controller.rb
translation_center-1.0.1 app/controllers/translation_center/center_controller.rb
translation_center-1.0.0 app/controllers/translation_center/center_controller.rb
translation_center-0.0.14 app/controllers/translation_center/center_controller.rb
translation_center-0.0.13 app/controllers/translation_center/center_controller.rb
translation_center-0.0.12 app/controllers/translation_center/center_controller.rb
translation_center-0.0.11 app/controllers/translation_center/center_controller.rb
translation_center-0.0.10 app/controllers/translation_center/center_controller.rb
translation_center-0.0.9 app/controllers/translation_center/center_controller.rb
translation_center-0.0.8 app/controllers/translation_center/center_controller.rb
translation_center-0.0.7 app/controllers/translation_center/center_controller.rb
translation_center-0.0.6 app/controllers/translation_center/center_controller.rb
translation_center-0.0.5 app/controllers/translation_center/center_controller.rb
translation_center-0.0.4 app/controllers/translation_center/center_controller.rb
translation_center-0.0.3 app/controllers/translation_center/center_controller.rb
translation_center-0.0.2 app/controllers/translation_center/center_controller.rb
translation_center-0.0.1 app/controllers/translation_center/center_controller.rb