Sha256: 564c2d0e2c70b9b57b06a4d2559338411e768b740278b2e3ec0fe66238f96e5b

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

module FcrepoAdmin::Helpers
  module AssociationsHelperBehavior

    def link_to_association_target(association)
      target = @object.send(association.name)
      if association.collection?
        link_to_unless target.size == 0, "#{association.class_name} (#{target.size})", fcrepo_admin.object_association_path(@object, association.name) do |text|
          text
        end
      else # not a collection
        if target
          link_to "#{association.class_name} #{target.pid}", fcrepo_admin.object_path(target)
        else
          "#{association.class_name} (not assigned)"
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fcrepo_admin-0.5.0 lib/fcrepo_admin/helpers/associations_helper_behavior.rb
fcrepo_admin-0.4.1 lib/fcrepo_admin/helpers/associations_helper_behavior.rb