Similar to this old post I am trying to improve the look of a page by using images as buttons. When I generate a button via the 'create from template' macro and then take the URL is has and insert it as the URL for an image, it doesn't work. When I then click the image, it just takes me back to the dashboard of the Confluence instance I am using. The original button works fine when I click it though.
The URL the button generate looks like this: http://example.com:8080/?createDialogSpaceKey=SBV2&createDialogBlueprintId=XXXX-XXXXX-XXXX
You could create a user macro to wrap your "create from template" button to override the styles on it.
Macro Body Processing:
Rendered
Template:
## Developed by: Davin Studer ## Date created: 07/15/2015 ## @param Image:title=Image URL|type=string|required=true|desc=The URL to the image. ## @param Width:title=Image Width|type=string|required=true|desc=The width of the image in px. (ex. 98) ## @param Height:title=Image Height|type=string|required=true|desc=The height of the image in px. (ex. 98) #set( $id = $action.dateFormatter.calendar.timeInMillis ) <span id="button${id}">${body}</span> <style> #button${id} .aui-button.create-from-template-button, #button${id} .aui-button.create-from-template-button:active, #button${id} .aui-button.create-from-template-button:focus { background: url('${paramImage}') no-repeat; border: 0; text-indent: -999em; width: ${paramWidth}px; height: ${paramHeight}px; box-shadow: none; border-radius: 0; } </style>
Update: Added screenshot
image2015-7-15 16:28:44.png
Thanks for the suggestion. Would this work if I have multiple buttons on the same page? If it's not too much trouble could you expand on how I would apply this as I am pretty fresh to Confluence.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It should work just fine with multiple create from template button ... although I have not tried it. You just need to create a user macro (Confluence Admin -> User Macros) and use the above code. Then put the user macro on the page, fill in the macro parameters, and put your create from template macro inside it. See the above screen shot that I have added.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome! Works great, thanks heaps for throwing that together. Any tips on how I can get the buttons side by side with a small gap between them? At the moment your wrapper macro takes up an entire line and when the page saves the buttons are all on top of each other. I've tried leaving no gap and not putting a space but no dice.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh and my sharp cornered buttons now have a tiny curve on their corners now. No big deal, just letting you know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have edited the above user macro for your issues. The corner should not be rounded anymore. Also, when rendered they should show next to each other (inline). In the editor they won't be on the same line, but they should render on the same line when viewing the page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Legend. Works perfectly now. Really appreciate that mate. My only dilemma now is that I have 2 buttons that use the Create from Template macros and one that is just an image with the createBlogpost URL behind it. Since the image does not have the macro wrapping around it, it is not aligned with the other 2 images on the page. Ill have to figure out how to align it without applying the code in your above macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved this by inserting the 3 column page layout area at the top of the page. If I put each button in it's own column and then have the rest of the page's macros and blueprints under these in the normal page layouts I can have them evenly spaced and on the same horizontal plane!
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.