engine/public/javascripts/admin/content_types.js

16 lines
399 B
JavaScript

$(document).ready(function() {
// automatic slug from name
$('#content_type_name').keypress(function() {
var input = $(this);
var slug = $('#content_type_slug');
if (!slug.hasClass('filled')) {
setTimeout(function() {
slug.val(input.val().replace(/\s/g, '_').toLowerCase());
}, 50);
}
});
$('#content_type_slug').keypress(function() { $(this).addClass('filled'); });
});