Skip to content

Node.js based forum software built for the modern web

fixing up the post window to extend the body when opened, so it doesn't clip stuff

Julian Lam2acd40a8bbd6
diff --git a/public/css/style.less b/public/css/style.less
index bd7d559bae..bdc90db87c 100644
--- a/public/css/style.less
+++ b/public/css/style.less
@@ -21,6 +21,15 @@
body {
background: #fdfdfd;
+ -webkit-transition: margin-bottom 250ms ease;
+ -moz-transition: margin-bottom 250ms ease;
+ -ms-transition: margin-bottom 250ms ease;
+ -o-transition: margin-bottom 250ms ease;
+ transition: margin-bottom 250ms ease;
+
+ &.composing {
+ margin-bottom: 350px;
+ }
}
.none {
@@ -72,6 +81,7 @@ footer.footer {
left: 0px;
bottom: 0px;
background: white;
+ z-index: 1500;
input {
width: 100%;
diff --git a/public/src/app.js b/public/src/app.js
index 4a989e06bd..88b2b51f24 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -100,9 +100,10 @@ var socket,
reply_title = reply_title || document.getElementById('reply_title');
post_content = post_content || document.getElementById('post_content');
-
post_window = post_window || document.getElementById('post_window');
- jQuery(post_window).slideToggle(250);
+
+ jQuery(post_window).slideDown(250);
+ $(document.body).addClass('composing');
if (post_mode == 'topic') {
post_title.style.display = "block";
@@ -149,7 +150,7 @@ var socket,
'topic_id' : topic_id,
'content' : content
});
- jQuery(post_window).slideToggle(250);
+ jQuery(post_window).slideDown(250);
};
app.post_topic = function(category_id) {
@@ -175,6 +176,7 @@ var socket,
jQuery('#post_title, #post_content').val('');
jQuery(post_window).slideToggle(250);
+ $(document.body).addClass('composing');
};
diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl
index f23c07ad7e..24d2e3001b 100644
--- a/public/templates/footer.tpl
+++ b/public/templates/footer.tpl
@@ -76,6 +76,15 @@
right_menu.appendChild(loginEl);
}
});
+
+
+ // Post window events
+ var postWindowEl = document.getElementById('post_window'),
+ discardEl = document.getElementById('discard-post');
+ discardEl.addEventListener('click', function() {
+ $(postWindowEl).slideToggle(250);
+ $(document.body).removeClass('composing');
+ }, false);
}());
</script>
<!-- END Forum Info -->
diff --git a/public/templates/header.tpl b/public/templates/header.tpl
index 401c12113b..44b7dd93d7 100644
--- a/public/templates/header.tpl
+++ b/public/templates/header.tpl
@@ -64,7 +64,7 @@
</div>
<div class="btn-group" style="float: right; margin-right: -12px">
<span id="submit_post_btn" class="btn" onclick="app.post_topic()"><i class="icon-ok"></i> Submit</span>
- <span class="btn" onclick="jQuery(post_window).slideToggle(250);"><i class="icon-remove"></i> Discard</span>
+ <span class="btn" id="discard-post"><i class="icon-remove"></i> Discard</span>
</div>
</div>