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_date(dt) ⇒ Object
- #object_nav ⇒ Object
- #object_nav_header ⇒ Object
- #object_nav_item(item) ⇒ Object
- #object_nav_items ⇒ Object
- #object_properties ⇒ Object
- #object_property(prop) ⇒ Object
- #object_show_datastream_columns ⇒ Object
- #object_state ⇒ Object
- #object_title ⇒ Object
- #object_type ⇒ Object
- #render_object_pid_label ⇒ Object
Instance Method Details
#custom_object_nav_item(item) ⇒ Object
115 116 117 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 115 def custom_object_nav_item(item) # Override this method with your custom item behavior end |
#link_to_object(view, condition = true) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 91 def link_to_object(view, condition=true) return nil unless condition label = t("fcrepo_admin.object.nav.items.#{view}") path = case view when :summary fcrepo_admin.object_path(@object) when :datastreams fcrepo_admin.object_datastreams_path(@object) when :permissions fcrepo_admin.(@object) when :associations fcrepo_admin.object_associations_path(@object) when :audit_trail fcrepo_admin.audit_trail_object_path(@object) when :object_xml fcrepo_admin.object_path(@object, :format => 'xml') when :solr fcrepo_admin.solr_object_path(@object) when :catalog catalog_path(@object) end link_to_unless_current label, path end |
#object_date(dt) ⇒ Object
29 30 31 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 29 def object_date(dt) Time.parse(dt).localtime end |
#object_nav ⇒ Object
50 51 52 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 50 def object_nav render :partial => 'fcrepo_admin/shared/context_nav', :locals => {:header => object_nav_header, :items => object_nav_items} end |
#object_nav_header ⇒ Object
54 55 56 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 54 def object_nav_header t("fcrepo_admin.object.nav.header") end |
#object_nav_item(item) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 62 def object_nav_item(item) case item when :pid render_object_pid_label when :summary link_to_object item when :datastreams link_to_object item when :permissions link_to_object item, @object. && can?(:permissions, @object) when :associations link_to_object item when :audit_trail link_to_object item, @object.auditable? && can?(:audit_trail, @object) when :object_xml link_to_object item when :solr link_to_object item when :catalog link_to_object item else custom_object_nav_item item end end |
#object_nav_items ⇒ Object
58 59 60 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 58 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) { |hash, prop| hash[prop] = object_property(prop); hash } end |
#object_property(prop) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 16 def object_property(prop) case prop when :state object_state when :create_date, :modified_date object_date(@object.send(prop)) when :models @object.models.join("<br/>").html_safe else @object.send(prop) end end |
#object_show_datastream_columns ⇒ Object
46 47 48 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 46 def object_show_datastream_columns FcrepoAdmin.object_show_datastream_columns end |
#object_state ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 33 def object_state state = @object.state value = case state when 'A' "A (Active)" when 'I' "I (Inactive)" when 'D' "D (Deleted)" end value 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
87 88 89 |
# File 'lib/fcrepo_admin/helpers/objects_helper_behavior.rb', line 87 def render_object_pid_label content_tag :strong, @object.pid end |