Hi,
I'm writing a macro and I need it to save the name of the space that the macro was inserted in, can anyone help with this? is there a system variable for the space name?
Thanks,
-lee.
Hi Lee,
you get the name of the current space with: $space.getName()
could you please elaborate? when I've added this to my macro it didn't work, here's the relevant part of my code (it's inside of an HTML macro):
<script> var title; var url; var space_name;
var func = function() { console.log('func loaded'); AJS.toInit(function() { console.log('toInit loaded'); AJS.$(document).ready(function() { console.log('ready loaded'); title=AJS.params.pageTitle console.log(title);
space_name=$space.getName(); console.log(space_name);
in the above 2 lines I'm getting the following error:
What am I missing? Should I include somekind of library?..can you please guide me further on how to use the $space in my macro..?
And could you guide me on where to check these kinds of stuff for further times?
Thanks!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, you didn't mention that you want to get the space name in javascript. There you get it like this:
AJS.Meta.get('space-name')
To make sure, you get the right name, try an alert first:
alert(AJS.Meta.get('space-name'));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Thomas Thanks a lot!!
How did you know where to find this solution?
I've looked on google and couldn't reach any useful information...can you please explain how should I find solutions to this kind of questions in the future?...I couldn't find any good documentation for libraries that work with Atlassian or stuff like that...
Thanks,
-Lee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're welcome, Lee!
How to find a solution? There's no simple answer for this question. I am working as an administrator for 12 years now with Atlassian's products and try to learn from various sources, so experience is an important thing. A great source is this community. You can learn by reading answers to questions you do not even have at the moment just for learning. Here you find answers to a lot of questions, although they are sometimes not so easy to find. Communicating with other users, developers and admins in this community is always a good idea. Don't hesitate, ask your questions. With most questions, there's someone who can help you. And the next time, you already know the answer. And answer other's people questions... I am doing that for years now :-)
Another great source is Atlassian's developer site:
https://developer.atlassian.com/confdev
There you find tutorials for developing plugins and a lot of other useful things.
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.