Sha256: c915d39506350fab9b5794a872a22dd692c52b1ecd7de8ef99519b2497cc7222

Contents?: true

Size: 982 Bytes

Versions: 33

Compression:

Stored size: 982 Bytes

Contents

require 'copy_tuner_client/copyray'

begin
  require "simple_form"
rescue LoadError
end

if defined?(SimpleForm)
  module SimpleForm::Components::Labels
    protected
    def label_translation_with_copyray_comment
      source = label_translation_without_copyray_comment

      if !CopyTunerClient.configuration.disable_copyray_comment_injection && object.class.respond_to?(:lookup_ancestors)
        attributes_scope = "#{object.class.i18n_scope}.attributes"
        defaults = object.class.lookup_ancestors.map do |klass|
          "#{attributes_scope}.#{klass.model_name.i18n_key}.#{reflection_or_attribute_name}"
        end
        CopyTunerClient::Copyray.augment_template(source, defaults.shift)
      else
        source
      end
    end
    if CopyTunerClient.configuration.enable_middleware?
      alias_method :label_translation_without_copyray_comment, :label_translation
      alias_method :label_translation, :label_translation_with_copyray_comment
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
copy_tuner_client-0.19.0 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.18.0 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.17.1 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.16.3 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.16.2 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.16.1 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.16.0 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.15.1 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.15.0 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.14.2 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.14.1 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.14.0 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.13.6 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.13.5 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.13.3 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.13.2 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.13.1 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.13.0 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.12.0 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.11.0 lib/copy_tuner_client/simple_form_extention.rb