Module: FcrepoAdmin::Helpers::AssociationsHelperBehavior

Included in:
AssociationsHelper
Defined in:
lib/fcrepo_admin/helpers/associations_helper_behavior.rb

Instance Method Summary collapse

Instance Method Details

#associated_objects_per_pageObject



19
20
21
# File 'lib/fcrepo_admin/helpers/associations_helper_behavior.rb', line 19

def associated_objects_per_page
  FcrepoAdmin.associated_objects_per_page
end


4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fcrepo_admin/helpers/associations_helper_behavior.rb', line 4

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