Module: DigitalObjectTrees
- Included in:
- DigitalObject
- Defined in:
- backend/app/model/mixins/digital_object_trees.rb
Instance Method Summary collapse
-
#build_node_query ⇒ Object
-
#load_node_properties(node, properties, ids_of_interest = :all) ⇒ Object
-
#load_root_properties(properties, ids_of_interest = :all) ⇒ Object
-
#set_file_version(node, properties) ⇒ Object
Instance Method Details
#build_node_query ⇒ Object
3 4 5 6 |
# File 'backend/app/model/mixins/digital_object_trees.rb', line 3 def build_node_query node_query = super node_query.eager(:file_version) end |
#load_node_properties(node, properties, ids_of_interest = :all) ⇒ Object
16 17 18 19 20 21 22 |
# File 'backend/app/model/mixins/digital_object_trees.rb', line 16 def load_node_properties(node, properties, ids_of_interest = :all) super properties[node.id][:title] = node.display_string set_file_version(node, properties[node.id]) end |
#load_root_properties(properties, ids_of_interest = :all) ⇒ Object
25 26 27 28 29 30 31 |
# File 'backend/app/model/mixins/digital_object_trees.rb', line 25 def load_root_properties(properties, ids_of_interest = :all) super properties[:level] = self.level properties[:digital_object_type] = self.values[:digital_object_type] set_file_version(self, properties) end |
#set_file_version(node, properties) ⇒ Object
9 10 11 12 13 |
# File 'backend/app/model/mixins/digital_object_trees.rb', line 9 def set_file_version(node, properties) properties[:file_versions] = node.file_version.map {|file| FileVersion.to_jsonmodel(file, :skip_relationships => true) } end |