From 8ce5e72519ca24e6d540f3685389d072f1dd30f9 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Thu, 28 Jul 2011 15:51:00 -0700 Subject: [PATCH] Use data-aspect_id, because integer html ids freak me out. --- app/views/aspects/_aspect_listings.haml | 2 +- public/javascripts/aspect-sorting.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/aspects/_aspect_listings.haml b/app/views/aspects/_aspect_listings.haml index 76b8dada7..edf27e7c6 100644 --- a/app/views/aspects/_aspect_listings.haml +++ b/app/views/aspects/_aspect_listings.haml @@ -11,7 +11,7 @@ %ul.sub_nav - for aspect in all_aspects - %li{:id => aspect.id, :class => ("active" if params["a_id"].to_i == aspect.id)} + %li{:data => {:aspect_id => aspect.id}, :class => ("active" if params["a_id"].to_i == aspect.id)} .edit = link_to image_tag("icons/pencil.svg", :height => 12), edit_aspect_path(aspect), :rel => "facebox" diff --git a/public/javascripts/aspect-sorting.js b/public/javascripts/aspect-sorting.js index 68df5c6c2..443c5ecaf 100644 --- a/public/javascripts/aspect-sorting.js +++ b/public/javascripts/aspect-sorting.js @@ -5,9 +5,9 @@ $(document).ready(function() { $('#aspect_nav.left_nav .all_aspects .sub_nav').sortable({ - items: 'li[id]', + items: "li[data-aspect_id]", update: function(event, ui) { - var order = $(this).sortable('toArray'), + var order = $(this).sortable("toArray", {attribute: "data-aspect_id"}), obj = { 'reorder_aspects': order, '_method': 'put' }; $.ajax('/user', { type: 'post', dataType: 'script', data: obj }); },