Class: Yarrow::LegacyWeb::BaseDocument
- Inherits:
-
Object
- Object
- Yarrow::LegacyWeb::BaseDocument
- Defined in:
- lib/yarrow/web/document.rb
Direct Known Subclasses
Instance Method Summary collapse
- #body ⇒ Object
-
#breadcrumbs ⇒ Object
TODO: manage behaviour with and without current item TODO: link to manifest.
-
#index ⇒ Object
TODO: confirm this can be deleted.
-
#index_body ⇒ Object
TODO: confirm this can be deleted.
- #name ⇒ Object
- #resource ⇒ Object
- #title ⇒ Object
- #type ⇒ Object
- #url ⇒ Object
Instance Method Details
#body ⇒ Object
73 74 75 76 |
# File 'lib/yarrow/web/document.rb', line 73 def body return @resource.body.to_html if @resource.respond_to?(:body) "" end |
#breadcrumbs ⇒ Object
TODO: manage behaviour with and without current item TODO: link to manifest
TODO: replace @item and @collection with @node internally and in class interface
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/yarrow/web/document.rb', line 52 def path = [] current_parent = @node.in(:collection) while !current_parent.first.nil? path << current_parent.first.props[:resource] current_parent = current_parent.in(:collection) end path.reverse end |
#index ⇒ Object
TODO: confirm this can be deleted
34 35 36 37 38 39 40 41 |
# File 'lib/yarrow/web/document.rb', line 34 def index _index = @item.out_e(:index) unless _index.first.nil? _index.first.to.props else nil end end |
#index_body ⇒ Object
TODO: confirm this can be deleted
44 45 46 |
# File 'lib/yarrow/web/document.rb', line 44 def index_body @item.props[:index_body] end |
#name ⇒ Object
65 66 67 |
# File 'lib/yarrow/web/document.rb', line 65 def name @resource.name end |
#resource ⇒ Object
25 26 27 |
# File 'lib/yarrow/web/document.rb', line 25 def resource @resource end |
#title ⇒ Object
69 70 71 |
# File 'lib/yarrow/web/document.rb', line 69 def title @resource.title end |
#type ⇒ Object
29 30 31 |
# File 'lib/yarrow/web/document.rb', line 29 def type @type end |
#url ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/yarrow/web/document.rb', line 78 def url if @parent.nil? "/" else segments = [@resource.name] current = @parent until current.in(:collection).first.nil? do segments << current.props[:resource].name current = current.in(:collection).first end suffix = @is_index ? "/" : "" "/" + segments.reverse.join("/") + suffix end end |