... | ... | @@ -30,6 +30,7 @@ Catalinker uses Ractive.js web framework, developed by the Guardian newspaper. I |
|
|
### main.js
|
|
|
Most of the functionality in Catalinker is in main.js. main.has grown from its simpler state in the old catalinker mentioned earlier to a quite large chunk of javascript code. Some parts and functions are more complex than others, and cater for more than one concern. No doubt should the file be divided into smaller modules and perhaps utilise ractives component support, but because of the incremental nature of the development process followed, and perhaps laziness, it has not come to this yet. However, most functions are kept small and with descriptive names, and the structure is roughly the same as from the beginning, only with more features added.
|
|
|
|
|
|
#### Outline
|
|
|
The outline of `main.js`is as follows:
|
|
|
* Require directives, e.g. requiring jquery and jquery-ui artifacts.
|
|
|
* Various functions
|
... | ... | @@ -39,7 +40,15 @@ The outline of `main.js`is as follows: |
|
|
* Functions for handling patching and saving of new data
|
|
|
* Ractive decorators. These are used to handle different ui requirements, such as select2 style select components, sliding elements, accordion, input field ornamentation, special formatting, maintaining support panel positioning
|
|
|
* The ractive instance, with
|
|
|
** Event handlers
|
|
|
* * Event handlers. These are called on any `on-click`, `on-enter` etc events from user interface markup.
|
|
|
* * Observers. These are called when particular values in the state models changes.
|
|
|
|
|
|
#### Exposed objects
|
|
|
The `main.js` exposes some handy channels into the belly of Catalinker with which one can poke and peek around. Among these are the main ractive instance, underscore.js and jQuery.js. These are accessible in browser console as
|
|
|
* `document.main.getRactive()``
|
|
|
* `document.main._`
|
|
|
* `document.main.$`
|
|
|
and are handy tools for debugging and development.
|
|
|
|
|
|
|
|
|
### workflow_config.js
|
... | ... | |