Sha256: 969ea6a80701ff486df15703c4be8459a0f4850d22f915e022473dc3de788c66

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

module FcrepoAdmin::Helpers
  module AssociationsHelperBehavior

    def link_to_target(association)
      target = @object.send(association.name)
      if association.collection?
        text = "#{target.size} #{target.size == 1 ? 'object' : 'objects'}"
        if target.size > 0
          link_to text, fcrepo_admin.object_association_path(@object, association.name)
        else
          text
        end
      else # not a collection
        if target
          link_to target.pid, fcrepo_admin.object_path(target)
        else
          "[not assigned]"
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fcrepo_admin-0.4.0 lib/fcrepo_admin/helpers/associations_helper_behavior.rb