Created
December 30, 2014 21:21
-
-
Save nmuldoon/c5b8062dc0535394229c to your computer and use it in GitHub Desktop.
Watch Space Blog - User Macro for Confluence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Author: Vikas Sharma, https://twitter.com/VikasSharma | |
This user macro allows a user to embed a watch space blog button within a blog post on Confluence. | |
At Twitter we use this to encourage folks to watch the blog of the space they are on. | |
--> | |
<button id="twtr-watch-space-blog" class="aui-button">Watch the $space.getName() Blog</button> | |
<script> | |
AJS.toInit(function(){ | |
AJS.$('#twtr-watch-space-blog').on('click', function(){ | |
addBlogWatcher(); | |
}); | |
}); | |
function addBlogWatcher(){ | |
jQuery.ajax({ | |
url: AJS.contextPath() + "/spaces/addspacenotification.action?contentType=blogpost&key="+AJS.Meta.get('space-key')+"&atl_token="+AJS.Meta.get('atl-token'), | |
success: function (xhr) { | |
AJS.$('#twtr-watch-space-blog').text('Watching Activated'); | |
AJS.$('#twtr-watch-space-blog').attr('disabled','disabled'); | |
} | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment