engine/public/javascripts/admin/snippets.js

16 lines
367 B
JavaScript

$(document).ready(function() {
// automatic slug from snippet name
$('#snippet_name').keypress(function() {
var input = $(this);
var slug = $('#snippet_slug');
if (!slug.hasClass('filled')) {
setTimeout(function() {
slug.val(makeSlug(input.val()));
}, 50);
}
});
$('#snippet_slug').keypress(function() { $(this).addClass('filled'); });
});