Web panels can be used to add HTML snippets to parts of a page. They could be used to display additional information on the current wiki page, or JIRA issue etc. See also web panels in the Atlassian documentation.
As a simple example, let’s imagine we want to inform editors of certain Confluence spaces or JIRA projects that the space is to be deprecated, and we’d prefer that they updated a page in another space.
Choose the Show a web panel built-in script, and configure it as follows:
|The weight field is optional, and it only takes positive integers. Lower weights will make the panel be displayed at the top of its section. If blank it will appear at the end of its section.|
For the provider class/script try pasting in the following, either inline or into a file, and pointing to the file:
Unresolved directive in content/common/fragments/WebPanel.adoc - include::../jira/src/test/resources/com/onresolve/jira/groovy/test/fragments/DeprecationWarningPanel.groovy[tags=ex1]
This should appear only on issues in certain projects, eg:
|You must write to the provided Writer object, not just return a String.|
It would be preferable to have the message as the actual banner, but unfortunately the current
Parent Issue Example
This example shows how you can retrieve the current issue from the
context is just a Map, which is application specific, but in JIRA’s case contains the current issue, and a
The following web panel code:
Unresolved directive in content/common/fragments/WebPanel.adoc - include::../jira/src/test/resources/com/onresolve/jira/groovy/test/fragments/ParentDescription.groovy[tags=ex1]
will produce something like (on the subtask):
The full configuration of the panel is below. Note that I have added a condition, although this is a little superfluous, as the panel is written to do nothing if it’s not a subtask, in which case the panel won’t be displayed at all:
Conditions are largely the same as for web item conditions.