summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-08-01 09:54:44 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-08-01 09:54:44 -0400
commitbb4ce6d40ac49c167b41c1456f0f2176f99eb2cf (patch)
tree54127b6ba4f009977387b4defc6f6fd683d1878f
parent054cb1076bfb0ba48bbffb4f3410dc8a78919794 (diff)
downloadaskbot-bb4ce6d40ac49c167b41c1456f0f2176f99eb2cf.tar.gz
askbot-bb4ce6d40ac49c167b41c1456f0f2176f99eb2cf.tar.bz2
askbot-bb4ce6d40ac49c167b41c1456f0f2176f99eb2cf.zip
made draft autosave notification appear at the bottom of the text input
-rw-r--r--askbot/skins/common/media/js/post.js10
-rw-r--r--askbot/skins/common/templates/widgets/edit_post.html1
-rw-r--r--askbot/skins/default/media/style/style.less10
3 files changed, 19 insertions, 2 deletions
diff --git a/askbot/skins/common/media/js/post.js b/askbot/skins/common/media/js/post.js
index 6a497fbf..b79fcef6 100644
--- a/askbot/skins/common/media/js/post.js
+++ b/askbot/skins/common/media/js/post.js
@@ -237,6 +237,12 @@ DraftPost.prototype.backupData = function() {
this._old_data = this.getData();
};
+DraftPost.prototype.showNotification = function() {
+ var note = $('.editor-status span');
+ note.hide();
+ note.html(gettext('draft saved...'));
+ note.fadeIn().delay(3000).fadeOut();
+};
DraftPost.prototype.getSaveHandler = function() {
var me = this;
@@ -251,7 +257,7 @@ DraftPost.prototype.getSaveHandler = function() {
data: me.getData(),
success: function(data) {
if (data['success'] && !save_synchronously) {
- notify.show(gettext('Draft saved'), true);
+ me.showNotification();
}
me.backupData();
}
@@ -264,7 +270,7 @@ DraftPost.prototype.decorate = function(element) {
this._element = element;
this.assignContentElements();
this.backupData();
- setInterval(this.getSaveHandler(), 30000);//auto-save twice a minute
+ setInterval(this.getSaveHandler(), 5000);//auto-save twice a minute
var me = this;
window.onbeforeunload = function() {
var saveHandler = me.getSaveHandler();
diff --git a/askbot/skins/common/templates/widgets/edit_post.html b/askbot/skins/common/templates/widgets/edit_post.html
index 1663c7d4..2c8af580 100644
--- a/askbot/skins/common/templates/widgets/edit_post.html
+++ b/askbot/skins/common/templates/widgets/edit_post.html
@@ -22,6 +22,7 @@
{% endif %}
<div class="form-item">
<label for="editor" class="form-error">{{ post_form.text.errors }}</label>
+ <p class="editor-status action-status"><span></span></p>
</div>
{# need label element for resizable input, b/c form validation won't find span #}
{% if post_type == 'question' %}
diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less
index c2fcb3d3..4b36a4a0 100644
--- a/askbot/skins/default/media/style/style.less
+++ b/askbot/skins/default/media/style/style.less
@@ -3685,6 +3685,16 @@ textarea.tipped-input {
}
}
+.editor-status {
+ float: right;
+ margin: 7px 350px 0 0;
+ font-weight: bold;
+
+ span {
+ display: none;
+ }
+}
+
/* tag editor */
.tag-editor {
height: 64px;