Skip to content

Node.js based forum software built for the modern web

while you are editing a post you still need to write something dude

Baris Usaklic8b8899219a5
diff --git a/public/src/app.js b/public/src/app.js
index 9068042fa4..bcdb98540d 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -245,12 +245,24 @@ var socket,
};
app.edit_post = function(pid) {
- var content = document.getElementById('post_content');
- socket.emit('api:posts.edit', { pid: pid, content: content.value });
+ var content = $('#post_content');
+
+ if (content.val().length < 5) {
+ app.alert({
+ title: 'Topic Post Failure',
+ message: 'You need to write more dude.',
+ type: 'error',
+ timeout: 2000
+ });
+
+ return;
+ }
+
+ socket.emit('api:posts.edit', { pid: pid, content: content.val() });
jQuery(post_window).slideUp(250);
$(document.body).removeClass('composing');
- content.value = '';
+ content.val('');
}
diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl
index 4ac89dcfdc..091fac6c54 100644
--- a/public/templates/topic.tpl
+++ b/public/templates/topic.tpl
@@ -57,7 +57,7 @@
<a href="/users/{posts.username}">
<img src="{posts.gravatar}?s=80" align="left" />
</a>
- <i class="icon-star"></i><span class="user_rep_{posts.uid} user_reputation_text">{posts.user_rep}</span>
+ <i class="icon-star"></i><span class="user_rep_{posts.uid} formatted-number">{posts.user_rep}</span>
</div>
<div class="span11">
<div class="post-block">
@@ -124,12 +124,16 @@
pinned: '{pinned}'
};
- jQuery('document').ready(function() {
-
- $('.user_reputation_text').each(function(index, element) {
+ function addCommasToNumbers() {
+ $('.formatted-number').each(function(index, element) {
$(element).html(app.addCommas($(element).html()));
});
+ }
+
+ jQuery('document').ready(function() {
+ addCommasToNumbers();
+
var room = 'topic_' + '{topic_id}',
adminTools = document.getElementById('thread-tools');