Refactored coffee script
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user