Sha256: 10150c5a5212fc08993b9b94679c2b3c355e0932a3c9d525b1b1e3b206aaecaa

Contents?: true

Size: 992 Bytes

Versions: 13

Compression:

Stored size: 992 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).html_safe
      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

13 entries across 13 versions & 1 rubygems

Version Path
copy_tuner_client-0.4.11 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.10 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.9 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.8 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.7 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.6 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.5 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.4 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.3 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.2 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.1 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.4.0 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.3.5 lib/copy_tuner_client/simple_form_extention.rb