Hey,
I created a blueprint with a wizard where the user could chose users as stakeholders (with "class='autocomplete-multiuser'").
But now, there should be a table on the top of the generated page which show the users not as plain text but as @mention tags.
In the source editor, I can see the mentions are stored as "<ri:user ri:username="name"/>. How can I add there a <at:var at:name="id"/>?
At the moment, I use a onBlueprintCreateEvent-method to cast the plain text to mention when the page is created, but it will be quiet nice if I don't have to go this detour.
Regards,
Robin
Community moderators have prevented the ability to post new answers.
Have you tried this approach? In your template:
<at:var at:name="mentionsGoHere" at:rawxhtml="true">
In your context provider:
context.put("mentionsGoHere", "<ri:user ri:username=\"name\"/>");
The rawxhtml attribute tells Confluence not to escape things and to inject the markup directly into the template.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep, that helped me too.
Works for me now without the detour.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SyntaxEditor Code Snippet
"<ri:url ri:value=" + "\"" + imagefile + "\"" + " />";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Robin, thanks for the response. How are you editing the plain text of your page with your listener? I am trying to do the same thing but can't retrieve the .xml of my Space blueprint home page programatically. I thought event.getSpace().getHomePage().getBodyAsString(); would get me my home page but it seems to get some default Confluence one rather than the one I specified in my atlassian-plugin.xml at this point. EDIT: I figured out the work around, my listener listens for a a BlueprintPageCreateEvent and I can grab the page body through there.
@EventListener public void spaceBlueprintCreateEvent(SpaceBlueprintCreateEvent event){ Map<String,Object> context = event.getContext(); log.error("Space Blueprint Create Event: "+event); log.error("Context = "+event.getContext()); String homePageBody = event.getSpace().getHomePage().getBodyAsString(); //get the home page of the body, and then replace the at:var tags or whatever String designManagerName = context.get("designManagerName").toString(); String projectManagerName = context.get("projectManagerName").toString(); String marketingManagerName = context.get("marketingManagerName").toString(); homePageBody = homePageBody.replace("designManagerName", designManagerName).replace("projectManagerName", projectManagerName).replace("marketingManagerName", marketingManagerName); log.error("New homepage body "+homePageBody); event.getSpace().getHomePage().setBodyAsString(homePageBody); //replace the old body with the one with the new names. }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Robin, I am having the similar issue. Have you ever found a work around?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, sorry. I'm still using my workaround.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.