diff --git a/tracks/app/views/context/list.rhtml b/tracks/app/views/context/list.rhtml
index 2a0c2555..f351f15c 100644
--- a/tracks/app/views/context/list.rhtml
+++ b/tracks/app/views/context/list.rhtml
@@ -5,13 +5,13 @@
<%= render_partial( 'context_listing', context ) %>
<% end %>
-
-<%= sortable_element 'list-contexts',
- :tag => 'div',
- :handle => 'handle',
- :complete => visual_effect(:highlight, 'list-contexts'),
- :url => {:controller => 'context', :action => 'order'}
- %>
+<% sortable_options = {
+ :tag => 'div',
+ :handle => 'handle',
+ :complete => visual_effect(:highlight, 'list-contexts'),
+ :url => {:controller => 'context', :action => 'order'}
+ }%>
+<%= sortable_element 'list-contexts', sortable_options %>
Create new context »
@@ -20,7 +20,7 @@
:update=> "list-contexts",
:position=> "bottom",
:loading => "Form.reset('context-form')",
- :complete => "Form.focusFirstElement('context-form');",
+ :complete => "Sortable.create('list-contexts', #{options_for_javascript(sortable_options)});Form.focusFirstElement('context-form');",
:html=> { :id=>'context-form', :name=>'context', :class => 'inline-form' } %>
<%= hidden_field( "context", "id" ) %>
diff --git a/tracks/app/views/project/list.rhtml b/tracks/app/views/project/list.rhtml
index 1432da3a..70797f89 100644
--- a/tracks/app/views/project/list.rhtml
+++ b/tracks/app/views/project/list.rhtml
@@ -5,13 +5,13 @@
<%= render_partial( 'project_listing', project ) %>
<% end %>
-
-<%= sortable_element 'list-projects',
- :tag => 'div',
- :handle => 'handle',
- :complete => visual_effect(:highlight, 'list-projects'),
- :url => {:controller => 'project', :action => 'order'}
- %>
+<% sortable_options = {
+ :tag => 'div',
+ :handle => 'handle',
+ :complete => visual_effect(:highlight, 'list-contexts'),
+ :url => {:controller => 'context', :action => 'order'}
+ }%>
+<%= sortable_element 'list-projects', sortable_options %>
Create new project »
@@ -20,7 +20,7 @@
:update=> "list-projects",
:position=> "bottom",
:loading => "Form.reset('project-form')",
- :complete => "Form.focusFirstElement('project-form');",
+ :complete => "Sortable.create('list-projects', #{options_for_javascript(sortable_options)});;Form.focusFirstElement('project-form');",
:html=> { :id=>'project-form', :name=>'project', :class => 'inline-form' } %>
<%= text_field 'project', 'name' %>