2012-02-01 04:09:00 +00:00
|
|
|
# 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/
|
2012-02-01 21:55:33 +00:00
|
|
|
|
|
|
|
|
$(document).ready ->
|
2012-02-04 20:19:05 +00:00
|
|
|
|
2012-02-04 21:32:12 +00:00
|
|
|
$(".one-time a.vote-link").click ->
|
|
|
|
|
$(this).parent().fadeOut()
|
|
|
|
|
|
2012-02-06 18:38:37 +00:00
|
|
|
$.each ['#habits', '#daily', '#one-offs'], (index, list_id) ->
|
2012-02-01 23:20:12 +00:00
|
|
|
$(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"
|
2012-02-01 21:55:33 +00:00
|
|
|
|
|
|
|
|
(($) ->
|
|
|
|
|
$.fn.highlight = ->
|
|
|
|
|
$(this).css
|
|
|
|
|
color: "red"
|
|
|
|
|
background: "yellow"
|
|
|
|
|
|
|
|
|
|
$(this).fadeIn()
|
2012-02-01 23:20:12 +00:00
|
|
|
) jQuery
|