topic.tpl changes, moved users to the bottom of main post, added reply thread tools buttons under main post, added posts and view count

v1.18.x
Baris Usakli
parent 9fbb139e67
commit d631a4b2e5

@ -32,12 +32,10 @@ define(function() {
app.addCommasToNumbers(); app.addCommasToNumbers();
app.enter_room('topic_' + tid);
var room = 'topic_' + tid, if($('#post-container .sub-posts').length)
adminTools = document.getElementById('thread-tools'); $('.topic-main-buttons').removeClass('hide');
app.enter_room(room);
$('.twitter-share').on('click', function () { $('.twitter-share').on('click', function () {
window.open(twitter_url, '_blank', 'width=550,height=420,scrollbars=no,status=no'); window.open(twitter_url, '_blank', 'width=550,height=420,scrollbars=no,status=no');
@ -61,11 +59,10 @@ define(function() {
if (expose_tools === '1') { if (expose_tools === '1') {
var moveThreadModal = $('#move_thread_modal'); var moveThreadModal = $('#move_thread_modal');
$('.thread-tools').removeClass('hide');
adminTools.style.visibility = 'inherit';
// Add events to the thread tools // Add events to the thread tools
$('#delete_thread').on('click', function(e) { $('.delete_thread').on('click', function(e) {
if (thread_state.deleted !== '1') { if (thread_state.deleted !== '1') {
bootbox.confirm('Are you sure you want to delete this thread?', function(confirm) { bootbox.confirm('Are you sure you want to delete this thread?', function(confirm) {
if (confirm) { if (confirm) {
@ -84,7 +81,7 @@ define(function() {
return false; return false;
}); });
$('#lock_thread').on('click', function(e) { $('.lock_thread').on('click', function(e) {
if (thread_state.locked !== '1') { if (thread_state.locked !== '1') {
socket.emit('api:topic.lock', { socket.emit('api:topic.lock', {
tid: tid tid: tid
@ -97,7 +94,7 @@ define(function() {
return false; return false;
}); });
$('#pin_thread').on('click', function(e) { $('.pin_thread').on('click', function(e) {
if (thread_state.pinned !== '1') { if (thread_state.pinned !== '1') {
socket.emit('api:topic.pin', { socket.emit('api:topic.pin', {
tid: tid tid: tid
@ -110,7 +107,7 @@ define(function() {
return false; return false;
}); });
$('#move_thread').on('click', function(e) { $('.move_thread').on('click', function(e) {
moveThreadModal.modal('show'); moveThreadModal.modal('show');
return false; return false;
}); });
@ -289,7 +286,7 @@ define(function() {
} }
}; };
$('#post-container').on('click', '.post_reply', reply_fn); $('#post-container').on('click', '.post_reply', reply_fn);
$('#post_reply').on('click', reply_fn); $('.topic-main-buttons').on('click', '.post_reply', reply_fn);
$('#post-container').on('click', '.quote', function() { $('#post-container').on('click', '.quote', function() {
if (thread_state.locked !== '1') { if (thread_state.locked !== '1') {
@ -390,12 +387,15 @@ define(function() {
var userLink = $('<a href="/user/' + userslug + '"></a>').append(userIcon); var userLink = $('<a href="/user/' + userslug + '"></a>').append(userIcon);
userLink.attr('data-uid', uid); userLink.attr('data-uid', uid);
var div = $('<div class="inline-block"></div>');
div.append(userLink);
userLink.tooltip({ userLink.tooltip({
placement: 'left', placement: 'top',
title: username title: username
}); });
return userLink; return div;
} }
} }
@ -437,7 +437,7 @@ define(function() {
activeEl.find('.anonymous-box').remove(); activeEl.find('.anonymous-box').remove();
if(anonymousCount || remainingUsers) { if(anonymousCount || remainingUsers) {
var anonLink = $('<i class="icon-user anonymous-box"></i>'); var anonLink = $('<div class="anonymous-box inline-block"><i class="icon-user"></i></div>');
activeEl.append(anonLink); activeEl.append(anonLink);
var title = ''; var title = '';
@ -449,7 +449,7 @@ define(function() {
title = anonymousCount + ' guest(s)'; title = anonymousCount + ' guest(s)';
anonLink.tooltip({ anonLink.tooltip({
placement: 'left', placement: 'top',
title: title title: title
}); });
} }
@ -575,19 +575,19 @@ define(function() {
} }
function set_locked_state(locked, alert) { function set_locked_state(locked, alert) {
var threadReplyBtn = document.getElementById('post_reply'), var threadReplyBtn = $('.topic-main-buttons .post_reply'),
postReplyBtns = document.querySelectorAll('#post-container .post_reply'), postReplyBtns = document.querySelectorAll('#post-container .post_reply'),
quoteBtns = document.querySelectorAll('#post-container .quote'), quoteBtns = document.querySelectorAll('#post-container .quote'),
editBtns = document.querySelectorAll('#post-container .edit'), editBtns = document.querySelectorAll('#post-container .edit'),
deleteBtns = document.querySelectorAll('#post-container .delete'), deleteBtns = document.querySelectorAll('#post-container .delete'),
numPosts = document.querySelectorAll('#post_container li[data-pid]').length, numPosts = document.querySelectorAll('#post_container li[data-pid]').length,
lockThreadEl = document.getElementById('lock_thread'), lockThreadEl = $('.lock_thread'),
x; x;
if (locked === true) { if (locked === true) {
lockThreadEl.innerHTML = '<i class="icon-unlock"></i> Unlock Thread'; lockThreadEl.html('<i class="icon-unlock"></i> Unlock Thread');
threadReplyBtn.disabled = true; threadReplyBtn.attr('disabled', true);
threadReplyBtn.innerHTML = 'Locked <i class="icon-lock"></i>'; threadReplyBtn.html('Locked <i class="icon-lock"></i>');
for (x = 0; x < numPosts; x++) { for (x = 0; x < numPosts; x++) {
postReplyBtns[x].innerHTML = 'Locked <i class="icon-lock"></i>'; postReplyBtns[x].innerHTML = 'Locked <i class="icon-lock"></i>';
quoteBtns[x].style.display = 'none'; quoteBtns[x].style.display = 'none';
@ -607,9 +607,9 @@ define(function() {
thread_state.locked = '1'; thread_state.locked = '1';
} else { } else {
lockThreadEl.innerHTML = '<i class="icon-lock"></i> Lock Thread'; lockThreadEl.html('<i class="icon-lock"></i> Lock Thread');
threadReplyBtn.disabled = false; threadReplyBtn.attr('disabled', false);
threadReplyBtn.innerHTML = 'Reply'; threadReplyBtn.html('Reply');
for (x = 0; x < numPosts; x++) { for (x = 0; x < numPosts; x++) {
postReplyBtns[x].innerHTML = 'Reply <i class="icon-reply"></i>'; postReplyBtns[x].innerHTML = 'Reply <i class="icon-reply"></i>';
quoteBtns[x].style.display = 'inline-block'; quoteBtns[x].style.display = 'inline-block';
@ -632,13 +632,14 @@ define(function() {
} }
function set_delete_state(deleted) { function set_delete_state(deleted) {
var deleteThreadEl = document.getElementById('delete_thread'), var deleteThreadEl = $('.delete_thread'),
deleteTextEl = deleteThreadEl.getElementsByTagName('span')[0], deleteTextEl = $('.delete_thread span'),
//deleteThreadEl.getElementsByTagName('span')[0],
threadEl = $('#post-container'), threadEl = $('#post-container'),
deleteNotice = document.getElementById('thread-deleted') || document.createElement('div'); deleteNotice = document.getElementById('thread-deleted') || document.createElement('div');
if (deleted) { if (deleted) {
deleteTextEl.innerHTML = '<i class="icon-comment"></i> Restore Thread'; deleteTextEl.html('<i class="icon-comment"></i> Restore Thread');
threadEl.addClass('deleted'); threadEl.addClass('deleted');
// Spawn a 'deleted' notice at the top of the page // Spawn a 'deleted' notice at the top of the page
@ -649,7 +650,7 @@ define(function() {
thread_state.deleted = '1'; thread_state.deleted = '1';
} else { } else {
deleteTextEl.innerHTML = '<i class="icon-trash"></i> Delete Thread'; deleteTextEl.html('<i class="icon-trash"></i> Delete Thread');
threadEl.removeClass('deleted'); threadEl.removeClass('deleted');
deleteNotice.parentNode.removeChild(deleteNotice); deleteNotice.parentNode.removeChild(deleteNotice);
@ -658,10 +659,10 @@ define(function() {
} }
function set_pinned_state(pinned, alert) { function set_pinned_state(pinned, alert) {
var pinEl = document.getElementById('pin_thread'); var pinEl = $('.pin_thread');
if (pinned) { if (pinned) {
pinEl.innerHTML = '<i class="icon-pushpin"></i> Unpin Thread'; pinEl.html('<i class="icon-pushpin"></i> Unpin Thread');
if (alert) { if (alert) {
app.alert({ app.alert({
'alert_id': 'thread_pin', 'alert_id': 'thread_pin',
@ -674,7 +675,7 @@ define(function() {
thread_state.pinned = '1'; thread_state.pinned = '1';
} else { } else {
pinEl.innerHTML = '<i class="icon-pushpin"></i> Pin Thread'; pinEl.html('<i class="icon-pushpin"></i> Pin Thread');
if (alert) { if (alert) {
app.alert({ app.alert({
'alert_id': 'thread_pin', 'alert_id': 'thread_pin',

@ -20,7 +20,7 @@
<li class="active" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"> <li class="active" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">{topic_name} <a target="_blank" href="../{topic_id}.rss"><i class="icon-rss-sign"></i></a></span> <span itemprop="title">{topic_name} <a target="_blank" href="../{topic_id}.rss"><i class="icon-rss-sign"></i></a></span>
</li> </li>
<div class="thread_active_users active-users pull-right hidden-xs"></div>
</ol> </ol>
<ul id="post-container" class="container" data-tid="{topic_id}"> <ul id="post-container" class="container" data-tid="{topic_id}">
@ -98,6 +98,32 @@
</li> </li>
<!-- END main_posts --> <!-- END main_posts -->
<div>
<div class="inline-block">
<small><span>posts</span></small>
<strong><span class="formatted-number">{postcount}</span></strong> |
<small><span>views</span></small>
<strong><span class="formatted-number">{viewcount}</span></strong> |
<span><small>browsing</small></span>
<div class="thread_active_users active-users inline-block"></div>
</div>
<div class="topic-main-buttons pull-right inline-block">
<button class="btn btn-primary btn-lg post_reply" type="button">[[topic:reply]]</button>
<div class="btn-group thread-tools hide">
<button class="btn btn-default btn-lg dropdown-toggle" data-toggle="dropdown" type="button">[[topic:thread_tools.title]] <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="#" class="pin_thread"><i class="icon-pushpin"></i> [[topic:thread_tools.pin]]</a></li>
<li><a href="#" class="lock_thread"><i class="icon-lock"></i> [[topic:thread_tools.lock]]</a></li>
<li class="divider"></li>
<li><a href="#" class="move_thread"><i class="icon-move"></i> [[topic:thread_tools.move]]</a></li>
<li class="divider"></li>
<li><a href="#" class="delete_thread"><span class="text-error"><i class="icon-trash"></i> [[topic:thread_tools.delete]]</span></a></li>
</ul>
</div>
</div>
<div style="clear:both;"></div>
</div>
<!-- BEGIN posts --> <!-- BEGIN posts -->
<a id="post_anchor_{posts.pid}" name="{posts.pid}"></a> <a id="post_anchor_{posts.pid}" name="{posts.pid}"></a>
<li class="row post-row sub-posts" data-pid="{posts.pid}" data-uid="{posts.uid}" data-username="{posts.username}" data-deleted="{posts.deleted}" itemscope itemtype="http://schema.org/Comment"> <li class="row post-row sub-posts" data-pid="{posts.pid}" data-uid="{posts.uid}" data-username="{posts.username}" data-deleted="{posts.deleted}" itemscope itemtype="http://schema.org/Comment">
@ -169,17 +195,17 @@
<hr /> <hr />
<div class="topic-main-buttons"> <div class="topic-main-buttons pull-right inline-block hide">
<button id="post_reply" class="btn btn-primary btn-lg post_reply" type="button">[[topic:reply]]</button> <button class="btn btn-primary btn-lg post_reply" type="button">[[topic:reply]]</button>
<div class="btn-group pull-right" id="thread-tools" style="visibility: hidden;"> <div class="btn-group thread-tools hide">
<button class="btn btn-default btn-lg dropdown-toggle" data-toggle="dropdown" type="button">[[topic:thread_tools.title]] <span class="caret"></span></button> <button class="btn btn-default btn-lg dropdown-toggle" data-toggle="dropdown" type="button">[[topic:thread_tools.title]] <span class="caret"></span></button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#" id="pin_thread"><i class="icon-pushpin"></i> [[topic:thread_tools.pin]]</a></li> <li><a href="#" class="pin_thread"><i class="icon-pushpin"></i> [[topic:thread_tools.pin]]</a></li>
<li><a href="#" id="lock_thread"><i class="icon-lock"></i> [[topic:thread_tools.lock]]</a></li> <li><a href="#" class="lock_thread"><i class="icon-lock"></i> [[topic:thread_tools.lock]]</a></li>
<li class="divider"></li> <li class="divider"></li>
<li><a href="#" id="move_thread"><i class="icon-move"></i> [[topic:thread_tools.move]]</a></li> <li><a href="#" class="move_thread"><i class="icon-move"></i> [[topic:thread_tools.move]]</a></li>
<li class="divider"></li> <li class="divider"></li>
<li><a href="#" id="delete_thread"><span class="text-error"><i class="icon-trash"></i> [[topic:thread_tools.delete]]</span></a></li> <li><a href="#" class="delete_thread"><span class="text-error"><i class="icon-trash"></i> [[topic:thread_tools.delete]]</span></a></li>
</ul> </ul>
</div> </div>
</div> </div>

Loading…
Cancel
Save