Require login for the tags button

@DanBurton
This commit is contained in:
Chris Done 2014-11-13 22:34:34 +01:00
parent 972fc5ae18
commit 9fe7d95389

View File

@ -1,4 +1,5 @@
$(function(){
var loggedIn = $('.user-handle').length > 0;
var tags = Object.create(null);
$('.tags').find('.tag').each(function(){
tags[$(this).find('a').text()] = true;
@ -13,8 +14,6 @@ $(function(){
}
});
$('#like').click(function(){
var loggedIn = $('.user-handle').length > 0;
var $this = $(this);
if (loggedIn) {
@ -39,10 +38,11 @@ $(function(){
$.post("@{PackageUnlikeR pn}");
}
} else {
window.location.href = '@{AuthR LoginR}';
login();
}
});
$('#add-tag').click(function(){
if (!loggedIn) login();
$('#add-tag-form').toggleClass('hidden');
$('#new-tag').focus();
});
@ -105,3 +105,7 @@ if( Object.create === undefined ) {
return new F();
};
}
function login(){
window.location.href = '@{AuthR LoginR}';
}