Sha256: b56072bb33640be0ad464305d5c40bf2c615e9e5cd3832a894f714f59c791024

Contents?: true

Size: 749 Bytes

Versions: 5

Compression:

Stored size: 749 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 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
    alias_method_chain :label_translation, :copyray_comment
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
copy_tuner_client-0.1.1.beta10 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.1.1.beta9 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.1.1.beta8 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.1.1.beta7 lib/copy_tuner_client/simple_form_extention.rb
copy_tuner_client-0.1.1.beta6 lib/copy_tuner_client/simple_form_extention.rb