Skip to content

Commit

Permalink
Removed overrides for object graph filtering as these are now in the …
Browse files Browse the repository at this point in the history
…`yale_rebased` branch
  • Loading branch information
jambun committed May 22, 2020
1 parent 1835101 commit 6c542fb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 62 deletions.
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Child Publisher

An ArchivesSpace plugin that adds the ability to publish and unpublish all child records of an archival object.
An ArchivesSpace plugin that adds the ability to publish and unpublish all child
records of an archival object.

Developed against ArchivesSpace v2.4.0 by Hudson Molonglo for Yale University.
Developed against ArchivesSpace v2.7.1 by Hudson Molonglo for Yale University.


## Summary

Two new options are available in the `More` menu on the component toolbar for components that have children - `Publish this and all children` and `Unpublish all children`. When selected, all child components of the current component will be published or unpublished respectively.
Two new options are available in the `More` menu on the component toolbar for
components that have children - `Publish this and all children` and
`Unpublish all children`. When selected, all child components of the current
component will be published or unpublished respectively.

In the case of publication the current record is also published. When unpublishing the published state of the current component and its nested records is unchanged.
In the case of publication the current record is also published. When
unpublishing the published state of the current component and its nested records
is unchanged.

The published state of some `Note` records attached to child components is also unchanged.
The published state of some `Note` records attached to child components is also
unchanged.

Currently, this filtering is not configurable.

Expand All @@ -20,28 +27,20 @@ Currently, this filtering is not configurable.

Follow standard ArchivesSpace plugin installation procedures.

This plugin is not dependent on any additional gems, does not require any database migrations, and does not override any existing templates.

It does override some backend methods, see below.
This plugin is not dependent on any additional gems, does not require any
database migrations, and does not override any existing templates.


## Customization

To enable the filtering mentioned above this plugin overrides two backend methods, namely:

- `ObjectGraph.calculate_object_graph(object_graph, opts = {})`
- `Notes.calculate_object_graph(object_graph, opts = {})`

These methods have been changed to accept `opts` keyed on a model with a value that is a Sequel dataset on that model. They allow for filtering of nested records and notes respectively.

There are other implementations of `calculate_object_graph(object_graph, opts = {})` that have not yet been overridden to support filtering with opts like this - the goal was to override as little as possible.

To customize the filtering behavior, call `ChildPublishing.add_filter(filter)`. For example:
To customize the filtering behavior, call `ChildPublishing.add_filter(filter)`.
For example:

```ruby
# turn off the default note filtering
ChildPublishing.add_filter(Note)
```

See [here](https://github.com/hudmol/child_publisher/blob/master/backend/plugin_init.rb) for the call that sets the Note filter.
See [here](https://github.com/hudmol/child_publisher/blob/master/backend/plugin_init.rb)
for the call that sets the Note filter.

29 changes: 0 additions & 29 deletions backend/model/ASModel_object_graph.rb

This file was deleted.

14 changes: 0 additions & 14 deletions backend/model/mixins/notes.rb

This file was deleted.

0 comments on commit 6c542fb

Please sign in to comment.