app/assets/javascripts/almanac/5-main.coffee.erb in almanac-0.4.5 vs app/assets/javascripts/almanac/5-main.coffee.erb in almanac-0.5.0
- old
+ new
@@ -41,6 +41,13 @@
if comment.prev().prop("tagName") is "H4" and comment.next().prop("tagName") is "HR"
comment.prev().fadeOut()
comment.next().fadeOut()
comment.fadeOut()
- $('.datepicker').datepicker({ format: 'yyyy-mm-dd' })
+ $('.datepicker').datepicker({ format: 'yyyy-mm-dd' })
+
+ $("#post_title").change (e) ->
+ $("#post_slug").val($(this).val().convertToSlug())
+
+unless String::convertToSlug?
+ String::convertToSlug = ->
+ @toLowerCase().replace(/[^\w ]+/g, "").replace RegExp(" +", "g"), "-"
\ No newline at end of file