You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

projectdoc Toolbox

Renders template button to create a page. After the page is created, the macro renders a link to this page. 

Categories
Tags
Since
1.4.0

Description

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.

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.

Details

Basic Workflow

Design the Document

The template author adds the macro to the page.

  1. Define the title of the page
  2. Decide if the button should be shown as a link or not be rendered after the document is created
  3. 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).

Template Fragment (indentation changed for readability)
<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).

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.

Wiki Link 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>
Create One Document 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> 
Soy to set the Name of the Document
<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.

Related macros

The following macros are often used together with or in place of the Create One Document Macro.

Name Short Description Notes

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 MacroAtlassian'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.
  • No labels