Refactored coffee script

This commit is contained in:
Tyler Renelle 2012-02-01 18:20:12 -05:00
parent ae9e9b0757
commit f131c2bc40

View file

@ -3,40 +3,22 @@
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$(document).ready ->
$("#habits").sortable
axis: "y"
dropOnEmpty: false
cursor: "move"
items: "li"
opacity: 0.4
scroll: true
update: ->
$.ajax
type: "post"
data: $("#habits").sortable("serialize")
dataType: "script"
complete: (request) ->
$("#habits").effect "highlight"
url: "/habits/sort"
$(document).ready ->
$("#daily").sortable
axis: "y"
dropOnEmpty: false
cursor: "move"
items: "li"
opacity: 0.4
scroll: true
update: ->
$.ajax
type: "post"
data: $("#daily").sortable("serialize")
dataType: "script"
complete: (request) ->
$("#daily").effect "highlight"
url: "/habits/sort"
$.each ['#habits', '#daily'], (index, list_id) ->
$(list_id).sortable
axis: "y"
dropOnEmpty: false
cursor: "move"
items: "li"
opacity: 0.4
scroll: true
update: ->
$.ajax
type: "post"
url: "/habits/sort"
data: $(list_id).sortable("serialize")
dataType: "script"
complete: (request) ->
$(list_id).effect "highlight"
(($) ->
$.fn.highlight = ->
@ -45,4 +27,4 @@ $(document).ready ->
background: "yellow"
$(this).fadeIn()
) jQuery
) jQuery