Skip to content

Commit

Permalink
Separate quicktags JS in his own file, include it through the asset p…
Browse files Browse the repository at this point in the history
…ipeline in publify_admin.js
  • Loading branch information
Thomas Lecavelier committed Oct 16, 2013
1 parent bf174c6 commit b8808ab
Show file tree
Hide file tree
Showing 2 changed files with 463 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/assets/javascripts/admin_publify.js
@@ -1,4 +1,27 @@
//= require jquery
//= require jquery_ujs
//= require quicktags
//= require_self
//= require_tree .

/* typewatch() borrowed from http://stackoverflow.com/questions/2219924/idiomatic-jquery-delayed-event-only-after-a-short-pause-in-typing-e-g-timew */
var typewatch = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
}
})();

function autosave_request(e) {
e.find('textarea').keyup(function() {
typewatch(function() {
e.up('form.autosave').ajax('/admin/content/autosave', e.serialize());
}
}));
}
$(document).ready(function() {
$('.autosave').each(function(e){autosave_request(e)});
$('#article_form .new_category').each(function(cat_link){ cat_link.click(bind_new_category_overlay); });
$('.merge_link').each(function(merge_link){ merge_link.click(bind_merge_link); });
})

0 comments on commit b8808ab

Please sign in to comment.