... | ... | @@ -100,12 +100,14 @@ Configures how suggestion data from external sources are mapped into inputs. Cat |
|
|
### State model
|
|
|
The state of the application is held in a set of object structures under the control of the Ractive.js instance. The most important part of the structure is the `inputGroups`, which is derived from the `tabs` array in the configuration enriched by the ontology. Accessing the model is done via `ractive.get()` function with a path as argument, e.g. `ractive.get('inputGroups.1.inputs.3')` which retrieves the fourth input of the second tab. Each input again has a `values` array with each element having a `current.value` and `old.value`. When values are changed, a delta is generated based on difference between a value's old and current value. The delta is then sent to back end as a `HTTP PATCH`-request. Value structs representing a link to another resource has in addition a `displayValue` field, containing the name or a more user friendly representation of the linked resource.
|
|
|
|
|
|
Below are screenshots showing input fields for main contributor and corresponding data structure at the deepest level in the state tree.
|
|
|
Below are screenshots showing input fields for main contributor and corresponding data structure at the deepest level in the state tree, exposing elements holding data for the `http://data.deichman.no/ontology#agent` predicate of the blank node representing a contribution to a work, in this case the main contributor or main entry.
|
|
|
|
|
|
![image](files/mainresp.png)
|
|
|
|
|
|
![image](files/values.png)
|
|
|
|
|
|
Note that the same construction and predicates are used for both main entry and additional entries, in the latter case typically with e.g. illustrator og translator roles, whereas the main contributor often has an author role. They both handle blank nodes that are of type `http://data.deichman.no/ontology#Contribution`, which may be related to either Work or Publication. They appear on both first and last workflow tab, but are distinguished by the fact that the main entry case also has additional type `http://data.deichman.no/ontology#MainEntry`. Some of the complexity in the function `updateInputsForResource` is due to this fact, since it needs to be able to handle the same predicate in two different ways when loading a Work and/or Publication.
|
|
|
|
|
|
### Partials
|
|
|
Even if the application's main engine is a massive block of code, the user interface is divided into a number of parts, called partials in Ractive.js lingo. Partials feed on the context in which they are invoked, such as an `input` node as the example above.
|
|
|
|
... | ... | |