PluginWorkUnitRenderer interface
A JavaScript object implementing the PluginWorkUnitRenderer
interface provides information about the context in which a WorkUnit is being rendered, and functions to generate the WorkUnit HTML using templates.
Your plugin doesn’t have to call the render()
function when it’s asked to render a work unit, and if it doesn’t, nothing will be displayed. This can be useful to omit irrelevant work units from the object page. However, plugins should always render work units on the Tasks list so the count matches the number of tasks displayed. Use the context
property to tell the difference.
Construction
Automatically created by the built in WorkUnit rendering API, and passed to renderer functions. See Workflow.
Interface
property workUnit
The WorkUnit
object being rendered.
property context
The context within which the work unit is being rendered.
Value | Location of display |
"object" |
The object page. |
"list" |
The Tasks listing. |
If context
has any other value, use the same rendering as you would for "list"
.
function render(view, template)
This function generates the work unit HTML by rendering a template.
The template
argument is optional, and can either be a Template
object, or the name of a template as a String
.
If it’s not specified or is null
, then an implied template will be used. This is the name of the work type, without the plugin name prefix. For example, the example_plugin:action
work type would use the action
template unless another template was specified.
Extra information in the view
As well as the values required by the template, the view
may contain:
key fullInfo
The link to the user interface for this work unit, for example, "/do/example/action/1234"
. The link will be displayed to the right of the work unit.
It is the plugin’s responsibility to perform any HTML escaping required on this link, as it will be output in the HTML exactly as given.
If this property is not specified, no link will be displayed.
key fullInfoText
By default, the fullInfo
link uses the text “Full info…”. Set this property to override the default.