Sha256: 2dbe0c745a6ccc399d08e7feba1fdc2b03c03a227c2646f0788569b0916d239b

Contents?: true

Size: 725 Bytes

Versions: 13

Compression:

Stored size: 725 Bytes

Contents

require 'administrate/field/belongs_to'
require 'rails'

module Administrate
  module Field
    class BelongsToSearch < Administrate::Field::BelongsTo
      class Engine < ::Rails::Engine
        initializer 'administrate-field-belongs_to_search.add_assets' do |app|
          app.config.assets.precompile << 'belongs_to_search.js' if app.config.respond_to? :assets
          Administrate::Engine.add_javascript 'belongs_to_search.js' if defined?(Administrate::Engine)
        end
      end

      def associated_resource_options
        if data.nil?
          []
        else
          [[display_candidate_resource(data), data.id]]
        end
      end

      def associated_class
        super
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
administrate-field-belongs_to_search-0.10.0 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.9.0 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.8.0 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.7.0 lib/administrate/field/belongs_to_search.rb
worker-field-belongs_to_search-0.8.0 lib/worker/field/belongs_to_search.rb
worker-field-belongs_to_search-0.7.0 lib/worker/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.6.0 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.5.0 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.4.0 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.3.0 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.2.0 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.1.4 lib/administrate/field/belongs_to_search.rb
administrate-field-belongs_to_search-0.1.3 lib/administrate/field/belongs_to_search.rb