Instructions to skip editor by using a soy wizard in a blueprint don't work

Stacia Parfionov June 18, 2014

Help - please! I've created a blueprint and want to skip the Editor / have the page created automatically when the user completes the information in the soy wizard.

I able to get a title field to display in the soy wizard. And I can get the input from that field to populate the title field when the editor page is displayed. However, I can't get my blueprint to skip the editor page. I always still have to click "Create" at the bottom of the Editor page to create the page.

I have used the following documentation as a base:

https://developer.atlassian.com/display/CONFDEV/Javascript+API+for+blueprint+wizards

Specifically, here's what I did:

1. Added the following entries to my atlassian-plug.xml file:

<transformation extension="js">
            <transformer key="jsI18n"/>
        </transformation>

<resource name="create-article-listener.js" location="com/atlassian/confluence/plugins/filelist/js/create-article-listener.js" type="download"/>

2. Added the create-result="view" attribute to my blueprint module so it now looks like this:

<blueprint key="newsarticle-blueprint" name="News article template" index-key="news-draft" create-result="view" >
        <content-template ref="newsarticle-content-template" />
        <dialog-wizard key="newsarticle-wizard" >
            <dialog-page id="page1Id" template-key="MyPlugin.Blueprints.newsarticle.page1Form"
            title-key="my.blueprint.wizard.page1.title"
            description-header-key="my.blueprint.wizard.page1.desc.header"
            description-content-key="my.blueprint.wizard.page1.desc.content" />
        </dialog-wizard>
    </blueprint>

3. Created a JavaScript file named create-article-listener.js that contains the following content:

(function ($) {

    function validate($container, spaceKey) {
        var $titleField = $container.find("#newsarticle-content-template-title"),
            pageTitle = $.trim($titleField.val()),
            error;

        if (!pageTitle) {
            error = AJS.I18n.getText("article.blueprint.wizard.form.validation.name.required");
        }
        else if (!Confluence.Blueprint.canCreatePage(spaceKey, pageTitle)) {
            error = AJS.I18n.getText("article.blueprint.wizard.form.validation.name.exists");
        }
        if (error) {
            $titleField.focus().siblings(".error").html(error);
            return false;
        }

        return true;
    }

    function page1Submit(ev, state) {
        return validate(state.$container, state.wizardData.spaceKey);
    }

    Confluence.Blueprint.setWizard('com.plugins.confluence.newsarticle.newsarticle:create-news-article', function(wizard) {
		wizard.on("submit.page1Id", page1Submit);
	});
})(AJS.$);

4. Added a div class to my soy template for the field title. Soy template (excerpt) looks like this:

<div class="field-group">
            <label for="newsarticle-content-template-title">Article title</label>
            <input id="newsarticle-content-template-title" class="text long-field" type="text" name="title"
                placeholder="{getText('article.blueprint.wizard.form.label.name.placeholder')}" maxlength="255">
            <div class="error"></div>
        </div>

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Yagnesh Bhat
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2014

This is simple, in your atlassian-plugin.xml descriptor , under your blueprint element, do this ... :

<blueprint key="<your blueprint key>" ...... create-result="view">

...

....

</blueprint>

create-result="view" will skip the editor.

Fathir29 August 21, 2016

I gave it a try, but it still doesn't work !

Here is my post about the same issue : https://answers.atlassian.com/questions/39989714

0 votes
Yagnesh Bhat
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 2, 2014

You forgot to add the content-template-key, and keep the index-key blank. Also put the i18n-name-key, set its value in your i18n properties file. Remove the name attribute.

<blueprint key="newsarticle-blueprint" content-template-key="newsarticle-content-template" index-key="" create-result="view" i18n-name-key="my.blueprint.title" >
<content-template ref="newsarticle-content-template" />
<dialog-wizard key="newsarticle-wizard" >
<dialog-page id="page1Id" template-key="MyPlugin.Blueprints.newsarticle.page1Form"
title-key="my.blueprint.wizard.page1.title"
description-header-key="my.blueprint.wizard.page1.desc.header"
description-content-key="my.blueprint.wizard.page1.desc.content" />
</dialog-wizard>
</blueprint>
Also the content-template-key should be properly mapped in the <content-template> element
in the blueprint.
TAGS
AUG Leaders

Atlassian Community Events