Sha256: 250e9414a5ffc255cb2874ed82d7c8a36fca745bd68478e0f623a17622ee889e

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

# Generate the post permalink when a post title has been typed
$ ->
	generatePermalink = (text) ->
		text.replace(/[^a-z0-9]+/gi, '-').replace(/^-*|-*$/g, '').toLowerCase()

	$("input#post_title").focusout ->
		$("input#post_permalink").val(generatePermalink($(this).val()))

	$(document).ready ->
  		$("#post_content").autosize append: "\n"

	# $("select#post_category_id").change(->
	# 	str = ""
	# 	$("select option:selected").each ->
	# 		if $(this).val() == ""
	# 			str += "posts"
	# 		else
	# 			str += $(this).text() + " "

	# 	$("span.category").replaceWith("<span class='category'>" + generatePermalink(str) + "</span>")
	# ).change()


	# $("#post_published").click ->
	# 	$(".published_date").toggle @checked

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blogr-0.0.8 app/assets/javascripts/blogr/posts.coffee
blogr-0.0.7 app/assets/javascripts/blogr/posts.coffee