- Created by Robert Reiner, last modified on 23. Jul 2017
projectdoc Toolbox
Renders template button to create a page. After the page is created, the macro renders a link to this page.
- Categories
- Tags
- Type
- Since
- 1.4.0
Renders template button to create a page. After the page is created, the macro renders a link to this page (or renders nothing - if Hide after Creation is selected).
Properties
Blueprint
The complete key of the blueprint to be used to create the page.
A page blueprint key looks like this:
de.smartics.atlassian.confluence.smartics-projectdoc-confluence:projectdoc-blueprint-doctype-blank
This example refers to the Blank Document.
The Doctypes Overview provides a list of doctype identifiers and blueprint keys.
Since 2.0
Blueprint may be referenced by the plain doctype name.
Page Title
Specify the title of the new page.
This feature is supported on Confluence 5.10 with projectdoc Toolbox 1.12.1 (or later versions).
Hide after Creation
Check to hide the macro after the page has been created.
Button Label
Specify the label for the button. Defaults to 'Create' if not specified.
Space Key
Specify the key of the space the page should be created in.
Mode
Select the rendering mode.
default | Handles button page title and page title equally. |
---|---|
subpage | Handles pages like Review or Retrospective to implicitly assume that the parent page's title is appended. |
Since 2.0
Parameter is available since version 2.0.
Details
Basic Workflow
Design the Document
The template author adds the macro to the page.
- Define the title of the page
- Decide if the button should be shown as a link or not be rendered after the document is created
- Label the button
On the right you see the macro parameter options. Typically the macro is used at template design time, so the macro is added as XML (Confluence storage format).
<ac:structured-macro ac:name="projectdoc-create-one-document-macro"> <ac:parameter ac:name="blueprint-module-complete-key"> de.smartics.atlassian.confluence.smartics-projectdoc-confluence :projectdoc-blueprint-doctype-blank </ac:parameter> <ac:parameter ac:name="title">Retrospective</ac:parameter> <ac:parameter ac:name="fade-on-creation">false</ac:parameter> <ac:parameter ac:name="button-label">Create Retrospective</ac:parameter> </ac:structured-macro>
See whitebox example for details and source code.
Working with the Document
From the author's (or team member's) point of view, who is working with a document that contains the macro, the flow of work is as follows.
Button in the view and
page does not yet exist
User hits the button
and creates the page
Button in the view
after the page is created
Hide on Creation controls if the button is rendered at all
Note that the macro simply checks that a page with the given name exists. If the page is renamed, the button (instead of the link reappears).
Therefore it is not possible for the document author to change the title or the space. In either case the macro will conclude that the page does not exist and still render the create button.
If the blueprint is a projectdoc blueprint the wizard allows to change the name. That is the title of the page is set as provided by the template author, but the name is changed to the title provided by the document author. Macros of the projectdoc Toolbox typically work with the name of the document (e.g in the Display Table Macro the names and not the titles of the documents are listed).
Prior to Confluence 5.10 and projectdoc Toolbox 1.12.1 the wizard is not supported by the title information from the button. So the template must deal with determining the title on its own (see example below).
Using in Templates
Template authors typically use this macro to create blueprint templates.
A typical use case employs the Wiki Link Macro and the Create One Document Macro.
<ac:structured-macro ac:name="projectdoc-link-wiki"> <ac:parameter ac:name="page">@pageTitle - <at:i18n at:key="projectdoc.doctype.blackbox.whitebox"/></ac:parameter> <ac:parameter ac:name="empty-if-not-exists">true</ac:parameter> </ac:structured-macro>
<ac:structured-macro ac:name="projectdoc-create-one-document-macro"> <ac:parameter ac:name="blueprint-module-complete-key">de.smartics.atlassian.confluence.smartics-projectdoc-confluence-arc42:projectdoc-arc42-blueprint-doctype-whitebox</ac:parameter> <ac:parameter ac:name="title">@parentPageTitle - <at:i18n at:key="projectdoc.doctype.blackbox.whitebox"/></ac:parameter> <ac:parameter ac:name="button-label"><at:i18n at:key="projectdoc.doctype.whitebox.create.label"/></ac:parameter> <ac:parameter ac:name="fade-on-creation">true</ac:parameter> </ac:structured-macro>
<div class="field-group"> <label for="projectdoc.doctype.common.name">{getText('projectdoc.blueprint.form.label.name')}</label> <input id="projectdoc.doctype.common.name" class="text long-field" type="text" name="projectdoc.doctype.common.name" placeholder="{getText('projectdoc.blueprint.form.label.name.placeholder')}" value="@parentPageTitle - {getText('projectdoc.doctype.blackbox.whitebox')}"> </div>
The complete template is available as part of the add-ons for the projectdoc Toolbox on Bitbucket.
The projectdoc Toolbox allows to use Page Wizard Placeholders. With this the template author may introduce a dynamic title based on the title of the parent page (as seen in the example above), the current date or the name of the space.
Related macros
The following macros are often used together with or in place of the Create One Document Macro.
Name | Short Description | Notes |
---|---|---|
Allows to render a link to a wiki page. | A link may be rendered at another location once the document is created. This may be used to define a document property with the Document Properties Marker Macro. | |
Hides a page fragment from a user with read-only permissions. | The button may only be visible for users with edit privileges. This macro allows to hide it for readers. | |
Create from Template Macro | Atlassian's Create from Template Macro displays a button on a page, linked to a specific template. When someone clicks the button, the macro opens the editor, ready to add a new page, and adds content to the page based on the given template. | The original button allows to create more than one page by launching the wizard of a given blueprint. |
The pages wizards provide placeholder to make page creation easier. | Use these placeholders to create dynamic titles. |