Hey all!
i'm trying to create a new custom Button to create a blogpost in whatever space the user is currently visiting.
I have found:
<script>
AJS.toInit(function(){
AJS.$('.aui-header-primary .aui-nav').append('<li><a href="http://www.atlassian.com" class=" aui-nav-imagelink">Atlassian</a></li>');
});
</script>
wich does create a Button with a Link to Atlassian but what i try to reach is:
/pages/createblogpost.action?spaceKey=AJS.params.spaceKey
AJS.params.spaceKey is the Javascript part that gets the SpaceKey.
How can i combine the HTML href command with the Javascript ?
Thanks in advance
Hi @fkoehn
You almost gave yourself the answer :)
You have to concatenate the spacekey and the link:
<script>
AJS.toInit(function(){
AJS.$('.aui-header-primary .aui-nav').append('<li><a href="/pages/createblogpost.action?spaceKey='+AJS.params.spaceKey+'" class=" aui-nav-imagelink">Create Blog Post</a></li>');
});
</script>
Regards, Dominic
Hey @Dominic Lagger
I had the same exact answer figured out but i had to reload the page once to actually reach the site to create Blogposts. your Code works though.
Trying to figure out why now.
Thank you very much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Dominic Lagger this is exciting, I was able to use this to add a "button" to a space header that creates a page from a specific template. Awesome!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.