Commits

David Taylor  committed c0dd1e3 Merge

CONFDEV-14709 Add content-template ref a and b elements to Hello Blueprint, remove old attribute.

  • Participants
  • Parent commits 2e70dc9, 7a06097

Comments (0)

Files changed (8)

 
     <properties>
         <confluence.version>5.0-beta2</confluence.version>
-        <create-content.version>1.3.5</create-content.version>
+        <create-content.version>1.3.8</create-content.version>
         <confluence.data.version>4.3</confluence.data.version>
         <amps.version>4.1.1</amps.version>
     </properties>

File src/main/java/com/atlassian/confluence/plugins/hello_blueprint/HelloContextProvider.java

 import java.util.Map;
 
 /**
- * This provider adds dynamic data for substitution into the content-template.xml \<at:var> elements.
+ * This provider adds dynamic data for substitution into the ContentTemplate's \<at:var> elements.
  *
  * For the sake of illustration, the provider in turn gets its data from an injected service.
  */
     {
         context.put("friendlyDate", helloService.getFriendlyDate());
         // We're adding a string with HTML tags. It will be correctly rendered by our template
-        // (check var declaration at content-template.xml)
+        // (check var declaration at content-template-a.xml)
         context.put("xhtmlString", "<em>Hello I am emphasised</em>");
 
         return context;

File src/main/resources/atlassian-plugin.xml

     <!--
          blueprint groups together the main blueprint concepts:
 
-            content-template-key: (required) this is the moduleKey of the <content-template> that will be used to create a page / content from
-
             index-key: (required) this is the name of the label that will be added to all content created from this blueprint, and used to
                            bring this content together on the index page.
 
             index-title-key: (optional) the i18n key for the title of the index page. Defaults to create-dialog-web-item name if none specified.
     -->
     <blueprint key="hello-blueprint"
-            content-template-key="hello-blueprint-page"
             create-result="edit"
             index-template-key="hello-blueprint-index"
             index-title-key="confluence.hello.blueprint.index.page.title"
             index-key="hello-blueprint"
             how-to-use-template="Confluence.Blueprints.Hello.howToUse">
         <!--
+            The content-template-key element(s) are the moduleKey(s) of the <content-template>(s) that will be used to
+            create a page / content from. These elements are required so that the templates can be edited from the
+            Space/Site Templates-admin screens.
+            -->
+        <content-template ref="hello-blueprint-content-template-a"/>
+        <content-template ref="hello-blueprint-content-template-b"/>
+        <!--
             The dialog-wizard element defines a set of Wizard pages that will be shown when the User selects this
             Blueprint. Pages will be shown to the user in the order they are defined, but this can be changed in the
             Wizard JavaScript hooks (see hello-blueprint-wizard.js).
             context-provider: (optional) if present, will provide extra key-value pairs to be substituted against
                               <at:var> instances in the template
     -->
-    <content-template key="hello-blueprint-page"
-                      i18n-name-key="confluence.hello.blueprint.content.template.name">
-        <description key="confluence.hello.blueprint.content.template.description"/>
-        <resource name="template" type="download" location="com/atlassian/confluence/plugins/hello_blueprint/xml/content-template.xml"/>
+    <content-template key="hello-blueprint-content-template-a"
+                      i18n-name-key="confluence.hello.blueprint.content.template.a.name">
+        <description key="confluence.hello.blueprint.content.template.a.description"/>
+        <resource name="template" type="download" location="com/atlassian/confluence/plugins/hello_blueprint/xml/content-template-a.xml"/>
         <context-provider class="com.atlassian.confluence.plugins.hello_blueprint.HelloContextProvider"/>
     </content-template>
 
+    <content-template key="hello-blueprint-content-template-b"
+            i18n-name-key="confluence.hello.blueprint.content.template.b.name">
+        <description key="confluence.hello.blueprint.content.template.b.description"/>
+        <resource name="template" type="download" location="com/atlassian/confluence/plugins/hello_blueprint/xml/content-template-b.xml"/>
+    </content-template>
+
     <content-template key="hello-blueprint-index"
                       i18n-name-key="confluence.hello.blueprint.index.template.name">
         <description key="confluence.hello.blueprint.index.template.description"/>

File src/main/resources/com/atlassian/confluence/plugins/hello_blueprint/i18n.properties

 confluence.hello.blueprint.form.label.name.placeholder=Enter a name of someone to say hello to
 confluence.hello.blueprint.form.label.title=Page Title
 confluence.hello.blueprint.form.label.title.placeholder=The title of the page that will be created
+confluence.hello.blueprint.form.label.template.key=Page template
+confluence.hello.blueprint.form.label.template.key.a=Hello Template
+confluence.hello.blueprint.form.label.template.key.b=G''day Template
 confluence.hello.blueprint.form.label.search=Search Query
 confluence.hello.blueprint.form.label.search.placeholder=The query you want to perform
 confluence.hello.blueprint.form.validation.title.required=Title is required.
 confluence.hello.blueprint.dialog.hello.heading=Fill this form
 confluence.hello.blueprint.dialog.hello.description=After filling this form, you can press "Create" to generate your content!
 
-confluence.hello.blueprint.content.template.name=Hello Blueprint
-confluence.hello.blueprint.content.template.description=A blueprint for saying hello.
+confluence.hello.blueprint.content.template.a.name=Hello Blueprint Template A
+confluence.hello.blueprint.content.template.b.name=Hello Blueprint Template B
+confluence.hello.blueprint.content.template.a.description=A blueprint for saying hello.
+confluence.hello.blueprint.content.template.b.description=A blueprint for saying G''day.
 
 confluence.hello.blueprint.index.template.name=Hello Blueprint Index
 confluence.hello.blueprint.index.template.description=An index page for blueprints

File src/main/resources/com/atlassian/confluence/plugins/hello_blueprint/soy/templates.soy

                 <input id="hello-blueprint-name" class="text" type="text" name="name" title="name" placeholder="{getText('confluence.hello.blueprint.form.label.name.placeholder')}" maxlength="255">
                 <div class="error"></div>
             </div>
+            <div class="field-group">
+                <label for="hello-blueprint-template-key">{getText('confluence.hello.blueprint.form.label.template.key')}</label>
+                <select id="hello-blueprint-template-key" class="select" name="contentTemplateKey">
+                    <option value="hello-blueprint-content-template-a">{getText('confluence.hello.blueprint.form.label.template.key.a')}</option>
+                    <option value="hello-blueprint-content-template-b">{getText('confluence.hello.blueprint.form.label.template.key.b')}</option>
+                </select>
+            </div>
         </fieldset>
     </form>
 {/template}

File src/main/resources/com/atlassian/confluence/plugins/hello_blueprint/xml/content-template-a.xml

+<ac:macro ac:name="info">
+    <ac:parameter ac:name="title"><at:var at:name="panelTitle" /></ac:parameter>
+    <ac:rich-text-body>
+        <p>Hello <at:var at:name="name" /></p>
+        <p><at:var at:name="friendlyDate" /></p>
+    </ac:rich-text-body>
+</ac:macro>
+<p>
+    The name in the Info box above was populated from the name you entered in the JavaScript dialog.<br/>
+    The date was supplied by a ContextProvider, which in turn retrieved its value from a Spring-injected service.
+</p>
+<p>
+    When you save this page you'll notice that a Parent page has been created for it, titled "Hello Blueprints". This
+    parent is the "Index" page which lists all Blueprints (Apps in the old parlance) of a particular type in this
+    Space.
+</p>
+<p>
+    If you don't want your Blueprint to take the user to the editor each time (perhaps the JavaScript dialog and
+    ContextProvider do all the heavy lifting), you can modify the "create-result" attribute of the "content-creator"
+    module in the atlassian-plugin.xml file to be "view" and not "edit".<br/>
+    If the result is "view", the new page will be created immediately and the user taken to it.
+</p>
+<!-- 'rawXhtml' parameter for 'var' makes this variable accept XHTML content without escaping it -->
+<p><at:var at:name="xhtmlString" at:rawXhtml='true'/></p>

File src/main/resources/com/atlassian/confluence/plugins/hello_blueprint/xml/content-template-b.xml

+<ac:macro ac:name="info">
+    <ac:parameter ac:name="title"><at:var at:name="panelTitle" /></ac:parameter>
+    <ac:rich-text-body>
+        <p>G'day <at:var at:name="name" /></p>
+    </ac:rich-text-body>
+</ac:macro>
+<p>
+    This is a second content template, chosen through the JavaScript wizard.
+</p>

File src/main/resources/com/atlassian/confluence/plugins/hello_blueprint/xml/content-template.xml

-<ac:macro ac:name="info">
-    <ac:parameter ac:name="title"><at:var at:name="panelTitle" /></ac:parameter>
-    <ac:rich-text-body>
-        <p>Hello <at:var at:name="name" /></p>
-        <p><at:var at:name="friendlyDate" /></p>
-    </ac:rich-text-body>
-</ac:macro>
-<p>
-    The name in the Info box above was populated from the name you entered in the JavaScript dialog.<br/>
-    The date was supplied by a ContextProvider, which in turn retrieved its value from a Spring-injected service.
-</p>
-<p>
-    When you save this page you'll notice that a Parent page has been created for it, titled "Hello Blueprints". This
-    parent is the "Index" page which lists all Blueprints (Apps in the old parlance) of a particular type in this
-    Space.
-</p>
-<p>
-    If you don't want your Blueprint to take the user to the editor each time (perhaps the JavaScript dialog and
-    ContextProvider do all the heavy lifting), you can modify the "create-result" attribute of the "content-creator"
-    module in the atlassian-plugin.xml file to be "view" and not "edit".<br/>
-    If the result is "view", the new page will be created immediately and the user taken to it.
-</p>
-<!-- 'rawXhtml' parameter for 'var' makes this variable accept XHTML content without escaping it -->
-<p><at:var at:name="xhtmlString" at:rawXhtml='true'/></p>