Skip to content

Node.js based forum software built for the modern web

closes #591

Baris Usakli53afe6cb6898
diff --git a/public/src/forum/account.js b/public/src/forum/account.js
index 5056c2a26e..375ac4b9f1 100644
--- a/public/src/forum/account.js
+++ b/public/src/forum/account.js
@@ -17,18 +17,21 @@ define(['forum/accountheader'], function(header) {
var followBtn = $('#follow-btn');
var unfollowBtn = $('#unfollow-btn');
+ var chatBtn = $('#chat-btn');
if (yourid !== theirid && yourid !== "0") {
if (isFollowing) {
- followBtn.hide();
- unfollowBtn.show();
+ followBtn.addClass('hide');
+ unfollowBtn.removeClass('hide');
} else {
- followBtn.show();
- unfollowBtn.hide();
+ followBtn.removeClass('hide');
+ unfollowBtn.addClass('hide');
}
+ chatBtn.removeClass('hide');
} else {
- followBtn.hide();
- unfollowBtn.hide();
+ followBtn.addClass('hide');
+ unfollowBtn.addClass('hide');
+ chatBtn.addClass('hide');
}
followBtn.on('click', function() {
@@ -36,8 +39,8 @@ define(['forum/accountheader'], function(header) {
uid: theirid
}, function(success) {
if (success) {
- followBtn.hide();
- unfollowBtn.show();
+ followBtn.addClasss('hide');
+ unfollowBtn.removeClass('hide');
app.alertSuccess('You are now following ' + username + '!');
} else {
app.alertError('There was an error following' + username + '!');
@@ -51,8 +54,8 @@ define(['forum/accountheader'], function(header) {
uid: theirid
}, function(success) {
if (success) {
- followBtn.show();
- unfollowBtn.hide();
+ followBtn.removeClass('hide');
+ unfollowBtn.addClass('hide');
app.alertSuccess('You are no longer following ' + username + '!');
} else {
app.alertError('There was an error unfollowing ' + username + '!');
@@ -61,6 +64,10 @@ define(['forum/accountheader'], function(header) {
return false;
});
+ chatBtn.on('click', function() {
+ app.openChat(username, theirid);
+ });
+
$('.user-recent-posts .topic-row').on('click', function() {
ajaxify.go($(this).attr('topic-url'));
});
diff --git a/public/templates/account.tpl b/public/templates/account.tpl
index 7327cca25f..eb14891b85 100644
--- a/public/templates/account.tpl
+++ b/public/templates/account.tpl
@@ -20,9 +20,12 @@
<span class="label label-danger">banned</span>
</div>
<!-- ENDIF banned -->
+ <div>
+ <a id="chat-btn" href="#" class="btn btn-default hide">Chat</a>
+ </div>
<div id="user-actions">
- <a id="follow-btn" href="#" class="btn btn-default">Follow</a>
- <a id="unfollow-btn" href="#" class="btn btn-default">Unfollow</a>
+ <a id="follow-btn" href="#" class="btn btn-default hide">Follow</a>
+ <a id="unfollow-btn" href="#" class="btn btn-default hide">Unfollow</a>
</div>
</div>