Module: FcrepoAdmin::Helpers::ObjectsHelperBehavior
- Included in:
- ObjectsHelper
- Defined in:
- lib/fcrepo_admin/helpers/objects_helper_behavior.rb
Instance Method Summary collapse
- #custom_object_nav_item(item) ⇒ Object
- #link_to_object(view, condition = true) ⇒ Object
- #object_nav ⇒ Object
- #object_nav_header ⇒ Object
- #object_nav_item(item) ⇒ Object
- #object_nav_items ⇒ Object
- #object_properties ⇒ Object
- #object_show_datastream_columns ⇒ Object
- #object_title ⇒ Object
- #object_type ⇒ Object
- #render_object_pid_label ⇒ Object
Instance Method Details
#custom_object_nav_item(item) ⇒ Object
61 62 63 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 61 def custom_object_nav_item(item) # Override this method with your custom item behavior end |
#link_to_object(view, condition = true) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 48 def link_to_object(view, condition=true) return nil unless condition label = t("fcrepo_admin.object.nav.items.#{view}") path = case when view == :summary then fcrepo_admin.object_path(@object) when view == :datastreams then fcrepo_admin.object_datastreams_path(@object) when view == :permissions then fcrepo_admin.(@object) when view == :associations then fcrepo_admin.object_associations_path(@object) when view == :audit_trail then fcrepo_admin.audit_trail_object_path(@object) end link_to_unless_current label, path end |
#object_nav ⇒ Object
20 21 22 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 20 def object_nav render :partial => 'fcrepo_admin/shared/context_nav', :locals => {:header => object_nav_header, :items => object_nav_items} end |
#object_nav_header ⇒ Object
24 25 26 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 24 def object_nav_header t("fcrepo_admin.object.nav.header") end |
#object_nav_item(item) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 32 def object_nav_item(item) case when item == :pid then render_object_pid_label when item == :summary then link_to_object item when item == :datastreams then link_to_object item when item == :permissions then link_to_object item, @object. && can?(:permissions, @object) when item == :associations then link_to_object item when item == :audit_trail then link_to_object item, @object.auditable? && can?(:audit_trail, @object) else custom_object_nav_item item end end |
#object_nav_items ⇒ Object
28 29 30 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 28 def object_nav_items FcrepoAdmin.object_nav_items.collect { |item| object_nav_item(item) }.reject { |item| item.nil? } end |
#object_properties ⇒ Object
12 13 14 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 12 def object_properties FcrepoAdmin.object_properties.inject(Hash.new) { |h, p| h[p] = @object.send(p); h } end |
#object_show_datastream_columns ⇒ Object
16 17 18 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 16 def object_show_datastream_columns FcrepoAdmin.object_show_datastream_columns end |
#object_title ⇒ Object
4 5 6 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 4 def object_title "#{object_type} #{@object.pid}" end |
#object_type ⇒ Object
8 9 10 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 8 def object_type @object.class.to_s end |
#render_object_pid_label ⇒ Object
44 45 46 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 44 def render_object_pid_label content_tag :span, @object.pid, :class => "label" end |