(Note: As I’m a new user here I can’t post more than 1 image, so will link to them instead.)
I am building a Confluence Server plugin.
I have a custom web item and a custom WebWork action.
The web item is located in the Actions menu of a page.
When I click the web item, it takes me to the view returned by the WebWork action. However, I have only gotten the atl.admin and atl.general decorators to work.
Here is the Velocity template:
Hello World - in title
Hello World!
And the resulting view:
How can I get my custom page to show the Spaces sidebar to the left, the breadcrumb and various interaction options at the top of a page (Share, Like, etc.) and the Comment section at the bottom? These:
I have some experience with developing JIRA plugins where it was relatively simple to get a custom page to show e.g. in the Project Settings. Confluence seems to be a different beast so far.
Hello and welcome,
I am not quite sure if that is possible at first place since those elements are tied with the page but you are rendering a custom vm from an action.
In your case i would suggest to take a look on macro documentantion and then create a new page within that space and insert your macro within new newly created page. Doing so, you are getting all the above goodies without having to pull decorators.
I should mention that this is not supposed to be a macro, that is, I don’t want the user to have to insert a macro into a page to be able to see the UI and my functionality; rather, I want the user to see that as soon as the page is rendered. And the page is not a ‘plain wiki page’ in Confluence context, rather a page similar to:
-The pages shown when browsing Space Tools > Content Tools > any of those tabs:
-Any of the pages rendered when clicking a web item on the Actions menu of a wiki page:
I’ve never tried to do what you are trying so my help might be limited.
I could guide you though to understand how this is supposed to work:
The #appyDecorator("root") macro calls this specific decorator and each subsequent #decoratorParam macro passes that param to the decorator.
If you have the confluence source, there are .vmd files. One of them is called root.vmd and is the one called by the first #applyDecorator.
On top of that, be sure that $action.getText and $action.helper $action.space.key resolve to something by e.g printing them within the <strong> tag. Most likely $action.space.key resolves to nothing since your page is not within any space.
Update: here you can find a similar answer by atlassian stuff
I took a look at some of the Content Tools-related views in the source code of Confluence. I saw that there is some complicated application of double root decorators, and so decided to start by instead getting my view to show as a regular wiki page.
So far, I have been able to get the Space sidebar to show:
Two things are necessary to get that working:
-The XWork-webwork action must implement the SpaceAware interface,
-The view must reference the root decorator, as Panos indicated. Here is my view:
Thanks for the detailed answer. I tried this but didn’t get it working, I do see $customHeader and $customFooter but not the sidebar. Are you sending space key in the web-item link tag? Also, in your xwork-webwork action java class, do you implement those methods or you have declared the class as abstract. Do you have any dependency related to sidebar in your web-resource that you import in your view? Sorry if the questions are naive. I am just starting development in asdk stack. Thanks for your help.
Yes, in the XWork-webwork action Java class, I am implementing all four methods, and of course I have a space variable to go along with those, like so:
private Space space;
@Override
public void setSpace(Space space) {
this.space = space;
}
@Override
public boolean isSpaceRequired() {
return true;
}
@Override
public boolean isViewPermissionRequired() {
return true;
}
@Override
public Space getSpace() {
return this.space;
}