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

Compare with Current View Page History

« Previous Version 2 Next »

projectdoc Toolbox

The main purpose of content providers is to add additional context entries for the blueprints provided by an add-on. projectdoc defines a number of context providers to be used by add-on developers.

Description

The context provider classes for projectdoc help to fill the blueprint context with convenient information to populate the created documents.

The context provider class is registered with the Content Template Module in the atlassian-plugin.xml file.

 

For more information on creating blueprints for Confluence:

Basic Configuration

The Soy template defines the wizard, the template uses the information collected in the wizard.

Soy Template

{namespace ProjectDocPlugin.Blueprints.Template.Blank}

/**
 * Wizard to collect information for the blank document.
 */
{template .page1Form}
  <form action="#" method="post" class="aui" id="blank-form">
    <fieldset>
      <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')}">
          </div>
      <div class="field-group">
        <label for="projectdoc.doctype.common.shortDescription">{getText('projectdoc.blueprint.form.label.shortDescription')}</label>
        <textarea id="projectdoc.doctype.common.shortDescription" class="textarea long-field" name="projectdoc.doctype.common.shortDescription" rows="6"
            placeholder="{getText('projectdoc.blueprint.form.label.shortDescription.placeholder')}"></textarea>
      </div>
      <div class="field-group" id="target-location-binder">
         <label for="targetLocation">{getText('projectdoc.blueprint.form.targetLocation')}</label>
         <input id="targetLocation" type="checkbox" value="defaultLocation" name="targetLocation"/>
         <br><span id="targetLocationDocumentation" class="help">{getText('projectdoc.blueprint.form.targetLocation.placeholder')}</span>
      </div>
      <input id="projectdoc" type="hidden" name="projectdoc" value="true">
      <input id="templateLabel" type="hidden" name="templateLabel" value="blank">
    </fieldset>
  </form>
{/template}

Page Template

The template for the blank document.

<ac:layout>
  <ac:layout-section ac:type="single">
    <ac:layout-cell>
      <ac:structured-macro ac:name="projectdoc-properties-marker">
        <ac:rich-text-body>
          <div class="table-wrap">
            <table class="confluenceTable">
              <tbody>
                <tr>
                  <th class="confluenceTh"><at:i18n at:key="projectdoc.doctype.common.shortDescription"/></th>
                  <td class="confluenceTd"><at:var at:name="projectdoc.doctype.common.shortDescription"/></td>
                  <td class="confluenceTd"></td>
                </tr>
                <tr>
                  <th class="confluenceTh"><at:i18n at:key="projectdoc.doctype.common.doctype"/></th>
                  <td class="confluenceTd">blank</td>
                  <td class="confluenceTd">hide</td>
                </tr>
                <tr>
                  <th class="confluenceTh"><at:i18n at:key="projectdoc.doctype.common.name"/></th>
                  <td class="confluenceTd"><at:var at:name="projectdoc.doctype.common.name"/></td>
                  <td class="confluenceTd"></td>
                </tr>
...

The XML code shows how the parameters from the Soy template are referenced via the at:var element.

List of Context Providers

The following context providers generate additional information and set them to the blueprint context. This information can be used in your page templates. For each standard case there is a context provider. You may want to extend on of these for your special purpose context provider or create one on your own.

 

Please note that the API for context providers is not considered stable. Changes to the context provider classes may be applied without notice and may break dependent code.

Expect the API to be stable starting with version 2.X of projectdoc.

 

  • No labels