Sha256: 76063fdde41769b80198e86839d60b9e4c9910a35d8610af5f4a5a4549066338

Contents?: true

Size: 1.17 KB

Versions: 11

Compression:

Stored size: 1.17 KB

Contents

require 'copy_tuner_client/copyray'

module CopyTunerClient
  # Connects to integration points for Rails 3 applications
  class Engine < ::Rails::Engine
    initializer :initialize_copy_tuner_rails, :before => :load_config_initializers do |app|
      CopyTunerClient::Rails.initialize

      ActiveSupport.on_load(:action_view) do
        ActionView::Helpers::TranslationHelper.class_eval do
          def translate_with_copyray_comment(key, options = {})
            source = translate_without_copyray_comment(key, options)
            if options[:rescue_format] == :html or options[:rescue_format].nil?
              CopyTunerClient::Copyray.augment_template(source, scope_key_by_partial(key))
            else
              source
            end
          end
          if CopyTunerClient.configuration.enable_middleware?
            alias_method_chain :translate, :copyray_comment
            alias :t :translate
          end
        end
      end
    end

    initializer "copy_tuner.assets.precompile", group: :all do |app|
      app.config.assets.precompile += ["copyray.js", "copyray.css"]
    end

    rake_tasks do
      load "tasks/copy_tuner_client_tasks.rake"
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
copy_tuner_client-0.2.4 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.2.3 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.2.2 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.2.1 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.2.0 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.1.1.beta19 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.1.1.beta18 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.1.1.beta17 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.1.1.beta16 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.1.1.beta15 lib/copy_tuner_client/engine.rb
copy_tuner_client-0.1.1.beta14 lib/copy_tuner_client/engine.rb