Sha256: 7633dc79a9aa7a9e46299aa0aa2cadd9e1995b507714842eaa405c4b99e14f15

Contents?: true

Size: 720 Bytes

Versions: 3

Compression:

Stored size: 720 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

    def associated_objects_per_page
      FcrepoAdmin.associated_objects_per_page
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fcrepo_admin-0.5.3 lib/fcrepo_admin/helpers/associations_helper_behavior.rb
fcrepo_admin-0.5.2 lib/fcrepo_admin/helpers/associations_helper_behavior.rb
fcrepo_admin-0.5.1 lib/fcrepo_admin/helpers/associations_helper_behavior.rb