mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
Merge remote-tracking branch 'origin'
This commit is contained in:
2
app.js
2
app.js
@@ -157,7 +157,7 @@ fs.readFile(path.join(__dirname, 'config.json'), function(err, data) {
|
|||||||
address: base_url,
|
address: base_url,
|
||||||
port: port
|
port: port
|
||||||
},
|
},
|
||||||
api_url: base_url + ':' + port + '/api/'
|
api_url: base_url + (use_port ? ':' + port : '') + '/api/'
|
||||||
}, null, 4))
|
}, null, 4))
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"passport-twitter": "0.1.4",
|
"passport-twitter": "0.1.4",
|
||||||
"passport-google-oauth": "0.1.5",
|
"passport-google-oauth": "0.1.5",
|
||||||
"passport-facebook": "0.1.5",
|
"passport-facebook": "0.1.5",
|
||||||
"less-middleware": "0.1.11",
|
"less-middleware": "0.1.12",
|
||||||
"marked": "0.2.8",
|
"marked": "0.2.8",
|
||||||
"bcrypt": "0.7.5",
|
"bcrypt": "0.7.5",
|
||||||
"node-gyp": "0.9.5",
|
"node-gyp": "0.9.5",
|
||||||
|
|||||||
@@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
@import "topic";
|
@import "topic";
|
||||||
@import "category";
|
@import "category";
|
||||||
|
@import "noscript";
|
||||||
15
public/css/noscript.less
Normal file
15
public/css/noscript.less
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
@import "mixins";
|
||||||
|
|
||||||
|
noscript {
|
||||||
|
.posts {
|
||||||
|
li {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
|
||||||
|
&:nth-child(even) {
|
||||||
|
background: rgba(192,192,192,0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -58,7 +58,11 @@ nodebb_admin.themes = {
|
|||||||
|
|
||||||
var revertEl = document.getElementById('revert_theme');
|
var revertEl = document.getElementById('revert_theme');
|
||||||
revertEl.addEventListener('click', function() {
|
revertEl.addEventListener('click', function() {
|
||||||
|
bootbox.confirm('Are you sure you wish to remove the custom theme and restore the NodeBB default theme?', function(confirm) {
|
||||||
|
if (confirm) {
|
||||||
nodebb_admin.remove('theme:id');
|
nodebb_admin.remove('theme:id');
|
||||||
nodebb_admin.remove('theme:src');
|
nodebb_admin.remove('theme:src');
|
||||||
|
}
|
||||||
|
});
|
||||||
}, false);
|
}, false);
|
||||||
})();
|
})();
|
||||||
@@ -15,11 +15,6 @@
|
|||||||
'event:new_topic'
|
'event:new_topic'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (jQuery('.category-item').length == 0) {
|
|
||||||
jQuery('#topics-container, .category-sidebar').hide();
|
|
||||||
jQuery('#category-no-topics').show();
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.on('event:new_topic', function(data) {
|
socket.on('event:new_topic', function(data) {
|
||||||
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }),
|
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }),
|
||||||
topic = document.createElement('div'),
|
topic = document.createElement('div'),
|
||||||
@@ -28,8 +23,8 @@
|
|||||||
numTopics = topics.length,
|
numTopics = topics.length,
|
||||||
x;
|
x;
|
||||||
|
|
||||||
jQuery('#topics-container, .category-sidebar').show();
|
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
|
||||||
jQuery('#category-no-topics').hide();
|
jQuery('#category-no-topics').remove();
|
||||||
|
|
||||||
topic.innerHTML = html;
|
topic.innerHTML = html;
|
||||||
if (numTopics > 0) {
|
if (numTopics > 0) {
|
||||||
|
|||||||
@@ -43,13 +43,13 @@
|
|||||||
deleteThreadEl.addEventListener('click', function(e) {
|
deleteThreadEl.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (thread_state.deleted !== '1') {
|
if (thread_state.deleted !== '1') {
|
||||||
if (confirm('really delete thread? (THIS DIALOG TO BE REPLACED WITH BOOTBOX)')) {
|
bootbox.confirm('Are you sure you want to delete this thread?', function(confirm) {
|
||||||
socket.emit('api:topic.delete', { tid: tid });
|
if (confirm) socket.emit('api:topic.delete', { tid: tid });
|
||||||
}
|
});
|
||||||
} else {
|
} else {
|
||||||
if (confirm('really restore thread? (THIS DIALOG TO BE REPLACED WITH BOOTBOX)')) {
|
bootbox.confirm('Are you sure you want to restore this thread?', function(confirm) {
|
||||||
socket.emit('api:topic.restore', { tid: tid });
|
if (confirm) socket.emit('api:topic.restore', { tid: tid });
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
@@ -372,6 +372,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('event:new_post', function(data) {
|
socket.on('event:new_post', function(data) {
|
||||||
|
data.posts[0].display_moderator_tools = 'none';
|
||||||
var html = templates.prepare(templates['topic'].blocks['posts']).parse(data),
|
var html = templates.prepare(templates['topic'].blocks['posts']).parse(data),
|
||||||
uniqueid = new Date().getTime();
|
uniqueid = new Date().getTime();
|
||||||
|
|
||||||
@@ -381,6 +382,11 @@
|
|||||||
.append(html)
|
.append(html)
|
||||||
.fadeIn('slow');
|
.fadeIn('slow');
|
||||||
|
|
||||||
|
socket.once('api:post.privileges', function(privileges) {
|
||||||
|
if (privileges.editable) toggle_mod_tools(data.posts[0].pid, true);
|
||||||
|
});
|
||||||
|
socket.emit('api:post.privileges', data.posts[0].pid);
|
||||||
|
|
||||||
set_up_posts(uniqueid);
|
set_up_posts(uniqueid);
|
||||||
|
|
||||||
addCommasToNumbers();
|
addCommasToNumbers();
|
||||||
@@ -528,7 +534,7 @@
|
|||||||
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'),
|
||||||
numReplyBtns = postReplyBtns.length,
|
numPosts = document.querySelectorAll('#post_container li[data-pid]').length,
|
||||||
lockThreadEl = document.getElementById('lock_thread'),
|
lockThreadEl = document.getElementById('lock_thread'),
|
||||||
x;
|
x;
|
||||||
|
|
||||||
@@ -536,7 +542,7 @@
|
|||||||
lockThreadEl.innerHTML = '<i class="icon-unlock"></i> Unlock Thread';
|
lockThreadEl.innerHTML = '<i class="icon-unlock"></i> Unlock Thread';
|
||||||
threadReplyBtn.disabled = true;
|
threadReplyBtn.disabled = true;
|
||||||
threadReplyBtn.innerHTML = 'Locked <i class="icon-lock"></i>';
|
threadReplyBtn.innerHTML = 'Locked <i class="icon-lock"></i>';
|
||||||
for(x=0;x<numReplyBtns;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';
|
||||||
editBtns[x].style.display = 'none';
|
editBtns[x].style.display = 'none';
|
||||||
@@ -558,7 +564,7 @@
|
|||||||
lockThreadEl.innerHTML = '<i class="icon-lock"></i> Lock Thread';
|
lockThreadEl.innerHTML = '<i class="icon-lock"></i> Lock Thread';
|
||||||
threadReplyBtn.disabled = false;
|
threadReplyBtn.disabled = false;
|
||||||
threadReplyBtn.innerHTML = 'Reply';
|
threadReplyBtn.innerHTML = 'Reply';
|
||||||
for(x=0;x<numReplyBtns;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';
|
||||||
editBtns[x].style.display = 'inline-block';
|
editBtns[x].style.display = 'inline-block';
|
||||||
@@ -680,4 +686,18 @@
|
|||||||
replyEl.addClass('none');
|
replyEl.addClass('none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggle_mod_tools(pid, state) {
|
||||||
|
var postEl = $(document.querySelector('#post-container li[data-pid="' + pid + '"]')),
|
||||||
|
editEl = postEl.find('.edit'),
|
||||||
|
deleteEl = postEl.find('.delete');
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
editEl.removeClass('none');
|
||||||
|
deleteEl.removeClass('none');
|
||||||
|
} else {
|
||||||
|
editEl.addClass('none');
|
||||||
|
deleteEl.addClass('none');
|
||||||
|
}
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
data = template.match(regex);
|
data = template.match(regex);
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
if (block !== undefined) self.blocks[block] = data[0];
|
if (self.blocks && block !== undefined) self.blocks[block] = data[0];
|
||||||
|
|
||||||
data = data[0]
|
data = data[0]
|
||||||
.replace("<!-- BEGIN " + block + " -->", "")
|
.replace("<!-- BEGIN " + block + " -->", "")
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
prepare: function() {
|
prepare: function() {
|
||||||
// Come back in 500ms if the config isn't ready yet
|
// Come back in 500ms if the config isn't ready yet
|
||||||
if (nodebb_admin.config === undefined) {
|
if (nodebb_admin.config === undefined) {
|
||||||
console.log('Config not ready...');
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
nodebb_admin.prepare();
|
nodebb_admin.prepare();
|
||||||
}, 500);
|
}, 500);
|
||||||
@@ -71,9 +70,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// save: function(key, value) {
|
|
||||||
// socket.emit('api:config.set', { key: key, value: value });
|
|
||||||
// },
|
|
||||||
remove: function(key) {
|
remove: function(key) {
|
||||||
socket.emit('api:config.remove', key);
|
socket.emit('api:config.remove', key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<script type="text/javascript" src="/src/templates.js"></script>
|
<script type="text/javascript" src="/src/templates.js"></script>
|
||||||
<script type="text/javascript" src="/src/ajaxify.js"></script>
|
<script type="text/javascript" src="/src/ajaxify.js"></script>
|
||||||
<script src="/vendor/requirejs/require.js"></script>
|
<script src="/vendor/requirejs/require.js"></script>
|
||||||
|
<script src="/vendor/bootbox/bootbox.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
require.config({
|
require.config({
|
||||||
baseUrl: "/src/modules",
|
baseUrl: "/src/modules",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div id="category_active_users"></div>
|
<div id="category_active_users"></div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-warning hide" id="category-no-topics">
|
<div class="alert alert-warning hide {no_topics_message}" id="category-no-topics">
|
||||||
<strong>There are no topics in this category.</strong><br />
|
<strong>There are no topics in this category.</strong><br />
|
||||||
Why don't you try posting one?
|
Why don't you try posting one?
|
||||||
</div>
|
</div>
|
||||||
@@ -42,10 +42,10 @@
|
|||||||
</li></a>
|
</li></a>
|
||||||
<!-- END topics -->
|
<!-- END topics -->
|
||||||
</ul>
|
</ul>
|
||||||
<hr />
|
<hr class="{show_sidebar}" />
|
||||||
<button id="new_post" class="btn btn-primary btn-large {show_category_features}">New Topic</button>
|
<button id="new_post" class="btn btn-primary btn-large {show_topic_button}">New Topic</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="span3 {show_category_features} category-sidebar mobile-sidebar">
|
<div class="span3 {show_sidebar} category-sidebar mobile-sidebar">
|
||||||
<div class="sidebar-block img-polaroid">
|
<div class="sidebar-block img-polaroid">
|
||||||
<div class="block-header">
|
<div class="block-header">
|
||||||
<a target="_blank" href="../{category_id}.rss"><i class="icon-rss-sign icon-2x"></i></a>
|
<a target="_blank" href="../{category_id}.rss"><i class="icon-rss-sign icon-2x"></i></a>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
|
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
|
||||||
<script type="text/javascript" src="/src/app.js"></script>
|
<script type="text/javascript" src="/src/app.js"></script>
|
||||||
<script src="/vendor/requirejs/require.js"></script>
|
<script src="/vendor/requirejs/require.js"></script>
|
||||||
|
<script src="/vendor/bootbox/bootbox.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
require.config({
|
require.config({
|
||||||
baseUrl: "/src/modules",
|
baseUrl: "/src/modules",
|
||||||
|
|||||||
@@ -1,15 +1,37 @@
|
|||||||
<div class="alert alert-error">
|
<div class="alert alert-error">
|
||||||
<p>
|
<p>
|
||||||
Your browser does not seem to support javascript. As a result, your viewing experience will be diminished.
|
Your browser does not seem to support javascript. As a result, your viewing experience will be diminished.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript).
|
Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript).
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul class="posts">
|
||||||
|
<!-- BEGIN main_posts -->
|
||||||
|
<li>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span2">
|
||||||
|
<img src="{main_posts.gravatar}" /><br />
|
||||||
|
{main_posts.username}
|
||||||
|
</div>
|
||||||
|
<div class="span10">
|
||||||
|
{main_posts.content}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<!-- END main_posts -->
|
||||||
<!-- BEGIN posts -->
|
<!-- BEGIN posts -->
|
||||||
<li>
|
<li>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span2">
|
||||||
|
<img src="{posts.gravatar}" /><br />
|
||||||
|
{posts.username}
|
||||||
|
</div>
|
||||||
|
<div class="span10">
|
||||||
|
{posts.content}
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<!-- END posts -->
|
<!-- END posts -->
|
||||||
</ul>
|
</ul>
|
||||||
17
public/vendor/bootbox/bootbox.min.js
vendored
Normal file
17
public/vendor/bootbox/bootbox.min.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* bootbox.js v3.2.0
|
||||||
|
*
|
||||||
|
* http://bootboxjs.com/license.txt
|
||||||
|
*/
|
||||||
|
var bootbox=window.bootbox||function(w,n){function k(b,a){"undefined"===typeof a&&(a=p);return"string"===typeof j[a][b]?j[a][b]:a!=t?k(b,t):b}var p="en",t="en",u=!0,s="static",v="",l={},g={},m={setLocale:function(b){for(var a in j)if(a==b){p=b;return}throw Error("Invalid locale: "+b);},addLocale:function(b,a){"undefined"===typeof j[b]&&(j[b]={});for(var c in a)j[b][c]=a[c]},setIcons:function(b){g=b;if("object"!==typeof g||null===g)g={}},setBtnClasses:function(b){l=b;if("object"!==typeof l||null===
|
||||||
|
l)l={}},alert:function(){var b="",a=k("OK"),c=null;switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"function"==typeof arguments[1]?c=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];c=arguments[2];break;default:throw Error("Incorrect number of arguments: expected 1-3");}return m.dialog(b,{label:a,icon:g.OK,"class":l.OK,callback:c},{onEscape:c||!0})},confirm:function(){var b="",a=k("CANCEL"),c=k("CONFIRM"),e=null;switch(arguments.length){case 1:b=arguments[0];
|
||||||
|
break;case 2:b=arguments[0];"function"==typeof arguments[1]?e=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];"function"==typeof arguments[2]?e=arguments[2]:c=arguments[2];break;case 4:b=arguments[0];a=arguments[1];c=arguments[2];e=arguments[3];break;default:throw Error("Incorrect number of arguments: expected 1-4");}var h=function(){if("function"===typeof e)return e(!1)};return m.dialog(b,[{label:a,icon:g.CANCEL,"class":l.CANCEL,callback:h},{label:c,icon:g.CONFIRM,"class":l.CONFIRM,
|
||||||
|
callback:function(){if("function"===typeof e)return e(!0)}}],{onEscape:h})},prompt:function(){var b="",a=k("CANCEL"),c=k("CONFIRM"),e=null,h="";switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"function"==typeof arguments[1]?e=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];"function"==typeof arguments[2]?e=arguments[2]:c=arguments[2];break;case 4:b=arguments[0];a=arguments[1];c=arguments[2];e=arguments[3];break;case 5:b=arguments[0];a=arguments[1];
|
||||||
|
c=arguments[2];e=arguments[3];h=arguments[4];break;default:throw Error("Incorrect number of arguments: expected 1-5");}var q=n("<form></form>");q.append("<input autocomplete=off type=text value='"+h+"' />");var h=function(){if("function"===typeof e)return e(null)},d=m.dialog(q,[{label:a,icon:g.CANCEL,"class":l.CANCEL,callback:h},{label:c,icon:g.CONFIRM,"class":l.CONFIRM,callback:function(){if("function"===typeof e)return e(q.find("input[type=text]").val())}}],{header:b,show:!1,onEscape:h});d.on("shown",
|
||||||
|
function(){q.find("input[type=text]").focus();q.on("submit",function(a){a.preventDefault();d.find(".btn-primary").click()})});d.modal("show");return d},dialog:function(b,a,c){function e(){var a=null;"function"===typeof c.onEscape&&(a=c.onEscape());!1!==a&&f.modal("hide")}var h="",l=[];c||(c={});"undefined"===typeof a?a=[]:"undefined"==typeof a.length&&(a=[a]);for(var d=a.length;d--;){var g=null,k=null,j=null,m="",p=null;if("undefined"==typeof a[d].label&&"undefined"==typeof a[d]["class"]&&"undefined"==
|
||||||
|
typeof a[d].callback){var g=0,k=null,r;for(r in a[d])if(k=r,1<++g)break;1==g&&"function"==typeof a[d][r]&&(a[d].label=k,a[d].callback=a[d][r])}"function"==typeof a[d].callback&&(p=a[d].callback);a[d]["class"]?j=a[d]["class"]:d==a.length-1&&2>=a.length&&(j="btn-primary");g=a[d].label?a[d].label:"Option "+(d+1);a[d].icon&&(m="<i class='"+a[d].icon+"'></i> ");k=a[d].href?a[d].href:"javascript:;";h="<a data-handler='"+d+"' class='btn "+j+"' href='"+k+"'>"+m+""+g+"</a>"+h;l[d]=p}d=["<div class='bootbox modal' tabindex='-1' style='overflow:hidden;'>"];
|
||||||
|
if(c.header){j="";if("undefined"==typeof c.headerCloseButton||c.headerCloseButton)j="<a href='javascript:;' class='close'>×</a>";d.push("<div class='modal-header'>"+j+"<h3>"+c.header+"</h3></div>")}d.push("<div class='modal-body'></div>");h&&d.push("<div class='modal-footer'>"+h+"</div>");d.push("</div>");var f=n(d.join("\n"));("undefined"===typeof c.animate?u:c.animate)&&f.addClass("fade");(h="undefined"===typeof c.classes?v:c.classes)&&f.addClass(h);f.find(".modal-body").html(b);f.on("keyup.dismiss.modal",
|
||||||
|
function(a){27===a.which&&c.onEscape&&e("escape")});f.on("click","a.close",function(a){a.preventDefault();e("close")});f.on("shown",function(){f.find("a.btn-primary:first").focus()});f.on("hidden",function(){f.remove()});f.on("click",".modal-footer a",function(b){var c=n(this).data("handler"),d=l[c],e=null;"undefined"!==typeof c&&"undefined"!==typeof a[c].href||(b.preventDefault(),"function"===typeof d&&(e=d()),!1!==e&&f.modal("hide"))});n("body").append(f);f.modal({backdrop:"undefined"===typeof c.backdrop?
|
||||||
|
s:c.backdrop,keyboard:!1,show:!1});f.on("show",function(){n(w).off("focusin.modal")});("undefined"===typeof c.show||!0===c.show)&&f.modal("show");return f},modal:function(){var b,a,c,e={onEscape:null,keyboard:!0,backdrop:s};switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"object"==typeof arguments[1]?c=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];c=arguments[2];break;default:throw Error("Incorrect number of arguments: expected 1-3");}e.header=a;
|
||||||
|
c="object"==typeof c?n.extend(e,c):e;return m.dialog(b,[],c)},hideAll:function(){n(".bootbox").modal("hide")},animate:function(b){u=b},backdrop:function(b){s=b},classes:function(b){v=b}},j={en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},ru:{OK:"OK",CANCEL:"\u041e\u0442\u043c\u0435\u043d\u0430",
|
||||||
|
CONFIRM:"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"}};return m}(document,window.jQuery);window.bootbox=bootbox;
|
||||||
@@ -27,7 +27,9 @@ var RDB = require('./redis.js'),
|
|||||||
|
|
||||||
var categoryData = {
|
var categoryData = {
|
||||||
'category_name' : category_name,
|
'category_name' : category_name,
|
||||||
'show_category_features' : 'show',
|
'show_sidebar' : 'show',
|
||||||
|
'show_topic_button': 'show',
|
||||||
|
'no_topics_message': 'hidden',
|
||||||
'topic_row_size': 'span9',
|
'topic_row_size': 'span9',
|
||||||
'category_id': category_id,
|
'category_id': category_id,
|
||||||
'active_users': active_users,
|
'active_users': active_users,
|
||||||
@@ -50,6 +52,8 @@ var RDB = require('./redis.js'),
|
|||||||
getModerators(function(err, moderators) {
|
getModerators(function(err, moderators) {
|
||||||
categoryData.moderator_block_class = moderators.length > 0 ? '' : 'none';
|
categoryData.moderator_block_class = moderators.length > 0 ? '' : 'none';
|
||||||
categoryData.moderators = moderators;
|
categoryData.moderators = moderators;
|
||||||
|
categoryData.show_sidebar = 'hidden';
|
||||||
|
categoryData.no_topics_message = 'show';
|
||||||
|
|
||||||
callback(categoryData);
|
callback(categoryData);
|
||||||
});
|
});
|
||||||
@@ -70,7 +74,9 @@ var RDB = require('./redis.js'),
|
|||||||
RDB.zrange('topics:recent', 0, -1, function(err, tids) {
|
RDB.zrange('topics:recent', 0, -1, function(err, tids) {
|
||||||
var latestTopics = {
|
var latestTopics = {
|
||||||
'category_name' : 'Recent',
|
'category_name' : 'Recent',
|
||||||
'show_category_features' : 'hidden',
|
'show_sidebar' : 'hidden',
|
||||||
|
'show_topic_button' : 'hidden',
|
||||||
|
'no_topics_message' : 'hidden',
|
||||||
'topic_row_size': 'span12',
|
'topic_row_size': 'span12',
|
||||||
'category_id': false,
|
'category_id': false,
|
||||||
'topics' : []
|
'topics' : []
|
||||||
|
|||||||
@@ -184,16 +184,6 @@ marked.setOptions({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Topics.get_posts_noscript = function(tid, current_user, callback) {
|
|
||||||
// Topics.get_topic(tid, current_user, function() {
|
|
||||||
callback([
|
|
||||||
{
|
|
||||||
foo: 'bar'
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
Topics.get_cid_by_tid = function(tid, callback) {
|
Topics.get_cid_by_tid = function(tid, callback) {
|
||||||
RDB.get(schema.topics(tid).cid, function(err, cid) {
|
RDB.get(schema.topics(tid).cid, function(err, cid) {
|
||||||
if (cid && parseInt(cid) > 0) {
|
if (cid && parseInt(cid) > 0) {
|
||||||
@@ -206,10 +196,21 @@ marked.setOptions({
|
|||||||
|
|
||||||
Topics.getTitle = function(tid, callback) {
|
Topics.getTitle = function(tid, callback) {
|
||||||
RDB.get('tid:' + tid + ':title', function(err, title) {
|
RDB.get('tid:' + tid + ':title', function(err, title) {
|
||||||
|
console.log(tid, title);
|
||||||
callback(title);
|
callback(title);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Topics.getTitleByPid = function(pid, callback) {
|
||||||
|
RDB.get('pid:' + pid + ':tid', function(err, tid) {
|
||||||
|
if (!err) {
|
||||||
|
Topics.getTitle(tid, function(title) {
|
||||||
|
callback(title);
|
||||||
|
});
|
||||||
|
} else callback('Could not grab title');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Topics.markAsRead = function(tid, uid) {
|
Topics.markAsRead = function(tid, uid) {
|
||||||
// there is an issue with this fn. if you read a topic that is previously read you will mark the category as read anyways - there is no check
|
// there is an issue with this fn. if you read a topic that is previously read you will mark the category as read anyways - there is no check
|
||||||
RDB.sadd(schema.topics(tid).read_by_uid, uid);
|
RDB.sadd(schema.topics(tid).read_by_uid, uid);
|
||||||
|
|||||||
@@ -114,10 +114,10 @@ var express = require('express'),
|
|||||||
|
|
||||||
|
|
||||||
var topic_url = tid + (req.params.slug ? '/' + req.params.slug : '');
|
var topic_url = tid + (req.params.slug ? '/' + req.params.slug : '');
|
||||||
topics.get_posts_noscript(tid, ((req.user) ? req.user.uid : 0), function(posts) {
|
topics.getTopicById(tid, ((req.user) ? req.user.uid : 0), function(topic) {
|
||||||
res.send(
|
res.send(
|
||||||
build_header() +
|
build_header() +
|
||||||
'\n\t<noscript>\n\t\t' + templates['noscript/topic'] + '\n\t</noscript>' +
|
'\n\t<noscript>\n' + templates['noscript/topic'].parse(topic) + '\n\t</noscript>' +
|
||||||
'\n\t<script>templates.ready(function(){ajaxify.go("topic/' + topic_url + '");});</script>' +
|
'\n\t<script>templates.ready(function(){ajaxify.go("topic/' + topic_url + '");});</script>' +
|
||||||
templates['footer']
|
templates['footer']
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
topics.getTitle(data.pid, function(title) {
|
topics.getTitleByPid(data.pid, function(title) {
|
||||||
next(null, title);
|
next(null, title);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user