Skip to content

Instantly share code, notes, and snippets.

@itsbth
Created December 27, 2011 16:17
Show Gist options
  • Select an option

  • Save itsbth/1524221 to your computer and use it in GitHub Desktop.

Select an option

Save itsbth/1524221 to your computer and use it in GitHub Desktop.
Uploaded by UploadToGist for Sublime Text 2
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
#= require Markdown.Converter.js
#= require Markdown.Sanitizer.js
$ ->
converter = Markdown.getSanitizingConverter()
$('#dupe_description').keyup (evt) ->
$('#md_preview').html converter.makeHtml $(this).val()
$('.screenshot a').click (evt) ->
evt.preventDefault()
$this = $(this)
$root = $this.parents('.screenshot')
$root.find('input').prop disabled: true
$root.find('input[type=hidden]').val(true)
fun = arguments.callee
$this.parent().text("Deleted... ").append $('<a href="#"></a>').text('undo.').click (evt) ->
evt.preventDefault()
$root.find('input').prop disabled: false
$root.find('input[type=hidden]').val(false)
$(this).parent().text("").append($('<a href="#"></a>').text('Delete').click(fun)).append(" this screenshot.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment