diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index d8fe0a51..57331e01 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -121,8 +121,10 @@ module TodosHelper def grip_span unless @todo.completed? image_tag('grip.png', :width => '7', :height => '16', :border => '0', - :title => 'Drag onto another action to make it depend on that action', - :class => 'grip') + :title => 'Drag onto another action to make it depend on that action', + :class => 'grip') + + image_tag('blank.png', :width => 16, :height => 16, :border => 0, + :title => "Drop an action to make it depend on this action", :class => 'successor_target') end end diff --git a/artwork/add_successor_on.svg b/artwork/add_successor_on.svg new file mode 100644 index 00000000..b7b3165c --- /dev/null +++ b/artwork/add_successor_on.svg @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/artwork/predecessor.svg b/artwork/predecessor.svg new file mode 100644 index 00000000..75e1ea1a --- /dev/null +++ b/artwork/predecessor.svg @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/public/images/add_successor_off.png b/public/images/add_successor_off.png new file mode 100644 index 00000000..183f1326 Binary files /dev/null and b/public/images/add_successor_off.png differ diff --git a/public/images/add_successor_on.png b/public/images/add_successor_on.png new file mode 100644 index 00000000..d9e6eff9 Binary files /dev/null and b/public/images/add_successor_on.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 51d31fae..0fa72903 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -209,7 +209,7 @@ function enable_rich_interaction(){ /* Drag & Drop for successor/predecessor */ function drop_todo(evt, ui) { dragged_todo = ui.draggable[0].id.split('_')[2]; - dropped_todo = this.id.split('_')[2]; + dropped_todo = $(this).parents('.item-show').get(0).id.split('_')[2]; ui.draggable.hide(); $(this).block({message: null}); $.post('/todos/add_predecessor', @@ -217,11 +217,14 @@ function enable_rich_interaction(){ null, 'script'); } - $('.item-show').draggable({handle: '.grip', revert: 'invalid'}); - $('.item-show').droppable({ - drop: drop_todo, - hoverClass: 'hover' - }); + $('.item-show').draggable({handle: '.grip', + revert: 'invalid', + start: function() {$('.successor_target').show();}, + stop: function() {$('.successor_target').hide();}}); + + $('.successor_target').droppable({drop: drop_todo, + tolerance: 'pointer', + hoverClass: 'hover'}); /* Reset auto updater */ field_touched = false; diff --git a/public/stylesheets/standard.css b/public/stylesheets/standard.css index c32a167a..58148f63 100644 --- a/public/stylesheets/standard.css +++ b/public/stylesheets/standard.css @@ -939,9 +939,17 @@ div.message { cursor: move; } -.hover { - background: #EAEAEA; - font-weight: bold; +.successor_target { + background-image:url("../images/add_successor_off.png"); + background-repeat: no-repeat; + background-position: center right; + display: none; +} + +.successor_target.hover { + background-image:url("../images/add_successor_on.png"); + background-repeat: no-repeat; + background-position: center right; } /* Error message styles */