Permalink
Browse files

Expose the closest item or container in afterMove

closes #48
  • Loading branch information...
1 parent c2b39e1 commit 34c28dca8a00fe75119a010c415efef3744b65d3 Jonas von Andrian committed Jan 8, 2014
Showing with 69 additions and 90 deletions.
  1. +2 −1 Gemfile
  2. +56 −81 Gemfile.lock
  3. +11 −8 source/js/jquery-sortable.js
View
@@ -2,8 +2,9 @@ source "http://rubygems.org"
gem 'thin'
-gem 'sass', :git => 'https://github.com/nex3/sass.git'
+gem 'sass', '~> 3.1.0'
+gem 'compass'
gem 'middleman', '>= 3'
gem 'guard-livereload'
View
@@ -5,26 +5,20 @@ GIT
specs:
sass-twitter-bootstrap (2.0.4)
-GIT
- remote: https://github.com/nex3/sass.git
- revision: 1edbe5841971a4cdab0ac63de360973289e700ec
- specs:
- sass (3.2.0.alpha.0)
-
GEM
remote: http://rubygems.org/
specs:
- activesupport (3.2.6)
- i18n (~> 0.6)
+ activesupport (3.2.16)
+ i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.2.8)
- chunky_png (1.2.5)
+ chunky_png (1.2.9)
closure-compiler (1.1.6)
coderay (1.0.7)
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.3.3)
+ coffee-script-source (1.6.3)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
@@ -36,122 +30,103 @@ GEM
eventmachine (0.12.10)
execjs (1.4.0)
multi_json (~> 1.0)
- ffi (1.0.11)
- fssm (0.2.9)
+ ffi (1.9.3)
+ fssm (0.2.10)
guard (1.2.3)
listen (>= 0.4.2)
thor (>= 0.14.6)
guard-livereload (1.0.0)
em-websocket (>= 0.2.0)
guard (>= 1.1.0)
multi_json (~> 1.0)
- haml (3.1.6)
- hike (1.2.1)
+ haml (4.0.5)
+ tilt
+ hike (1.2.3)
hpricot (0.8.6)
- http_router (0.10.2)
- rack (>= 1.0.0)
- url_mount (~> 0.2.1)
- i18n (0.6.0)
- libv8 (3.3.10.4)
- listen (0.4.7)
- rb-fchange (~> 0.0.5)
- rb-fsevent (~> 0.9.1)
- rb-inotify (~> 0.8.8)
- maruku (0.6.0)
- syntax (>= 1.0.0)
- middleman (3.0.0)
- middleman-core (= 3.0.0)
- middleman-more (= 3.0.0)
- middleman-sprockets (= 3.0.0)
- middleman-core (3.0.0)
- activesupport (~> 3.2.6)
- bundler (~> 1.1)
- listen (~> 0.4.7)
- rack (~> 1.4.1)
- rack-test (~> 0.6.1)
- thor (~> 0.15.4)
- tilt (~> 1.3.1)
- middleman-more (3.0.0)
+ i18n (0.6.9)
+ kramdown (1.3.1)
+ libv8 (3.16.14.3)
+ listen (1.1.6)
+ rb-fsevent (>= 0.9.3)
+ rb-inotify (>= 0.9)
+ rb-kqueue (>= 0.2)
+ middleman (3.2.1)
coffee-script (~> 2.2.0)
- coffee-script-source (~> 1.3.3)
compass (>= 0.12.2)
execjs (~> 1.4.0)
haml (>= 3.1.6)
- i18n (~> 0.6.0)
- maruku (~> 0.6.0)
- middleman-core (= 3.0.0)
- padrino-helpers (= 0.10.7)
+ kramdown (~> 1.2)
+ middleman-core (= 3.2.1)
+ middleman-sprockets (>= 3.1.2)
sass (>= 3.1.20)
- uglifier (~> 1.2.6)
- middleman-sprockets (3.0.0)
- middleman-more (= 3.0.0)
+ uglifier (~> 2.1.0)
+ middleman-core (3.2.1)
+ activesupport (~> 3.2.6)
+ bundler (~> 1.1)
+ i18n (~> 0.6.1)
+ listen (~> 1.1)
+ rack (>= 1.4.5)
+ rack-test (~> 0.6.1)
+ thor (>= 0.15.2, < 2.0)
+ tilt (~> 1.4.1)
+ middleman-sprockets (3.2.0)
+ middleman-core (~> 3.2)
sprockets (~> 2.1)
- sprockets-sass (~> 0.8.0)
- multi_json (1.3.6)
- padrino-core (0.10.7)
- activesupport (~> 3.2.0)
- http_router (~> 0.10.2)
- sinatra (~> 1.3.1)
- thor (~> 0.15.2)
- tilt (~> 1.3.0)
- padrino-helpers (0.10.7)
- i18n (~> 0.6)
- padrino-core (= 0.10.7)
- rack (1.4.1)
+ sprockets-helpers (~> 1.0.0)
+ sprockets-sass (~> 1.0.0)
+ multi_json (1.8.2)
+ rack (1.5.2)
rack-coderay (0.2.0)
coderay (>= 0.8.312)
hpricot (>= 0.8.1)
rack (>= 1.0.0)
rack-livereload (0.3.6)
rack
- rack-protection (1.2.0)
- rack
- rack-test (0.6.1)
+ rack-test (0.6.2)
rack (>= 1.0)
- rb-fchange (0.0.5)
- ffi
- rb-fsevent (0.9.1)
- rb-inotify (0.8.8)
+ rb-fsevent (0.9.4)
+ rb-inotify (0.9.3)
+ ffi (>= 0.5.0)
+ rb-kqueue (0.2.0)
ffi (>= 0.5.0)
rdiscount (1.6.8)
- sinatra (1.3.2)
- rack (~> 1.3, >= 1.3.6)
- rack-protection (~> 1.2)
- tilt (~> 1.3, >= 1.3.3)
- sprockets (2.4.5)
+ ref (1.0.5)
+ sass (3.1.21)
+ sprockets (2.10.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sprockets-sass (0.8.0)
+ sprockets-helpers (1.0.1)
+ sprockets (~> 2.0)
+ sprockets-sass (1.0.2)
sprockets (~> 2.0)
tilt (~> 1.1)
- syntax (1.0.0)
- therubyracer (0.10.1)
- libv8 (~> 3.3.10)
+ therubyracer (0.12.0)
+ libv8 (~> 3.16.14.0)
+ ref
thin (1.4.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
- thor (0.15.4)
- tilt (1.3.3)
- uglifier (1.2.6)
+ thor (0.18.1)
+ tilt (1.4.1)
+ uglifier (2.1.2)
execjs (>= 0.3.0)
- multi_json (~> 1.3)
- url_mount (0.2.1)
- rack
+ multi_json (~> 1.0, >= 1.0.2)
PLATFORMS
ruby
DEPENDENCIES
closure-compiler
+ compass
guard-livereload
middleman (>= 3)
rack-coderay
rack-livereload
rdiscount
- sass!
+ sass (~> 3.1.0)
sass-twitter-bootstrap (= 2.0.4)!
therubyracer
thin
@@ -45,7 +45,10 @@
}, // end container defaults
groupDefaults = {
// This is executed after the placeholder has been moved.
- afterMove: function ($placeholder, container) {
+ // $closestItemOrContainer contains the closest item, the placeholder
+ // has been put at or the closest empty Container, the placeholder has
+ // been appended to.
+ afterMove: function ($placeholder, container, $closestItemOrContainer) {
},
// The exact css path between the container and its items, e.g. "> tbody"
containerPath: "",
@@ -112,7 +115,7 @@
// Note that this default method only works, if every item only has one subcontainer
serialize: function ($parent, $children, parentIsContainer) {
var result = $.extend({}, $parent.data())
-
+
if(parentIsContainer)
return $children
else if ($children[0]){
@@ -210,7 +213,7 @@
this.dragProxy = $.proxy(this.drag, this)
this.dropProxy = $.proxy(this.drop, this)
this.placeholder = $(this.options.placeholder)
-
+
if(!options.isValidTarget)
this.options.isValidTarget = undefined
}
@@ -331,7 +334,7 @@
item[method](this.placeholder)
this.lastAppendedItem = item
this.sameResultBox = sameResultBox
- this.options.afterMove(this.placeholder, container)
+ this.options.afterMove(this.placeholder, container, item)
},
getContainerDimensions: function () {
if(!this.containerDimensions)
@@ -358,7 +361,7 @@
}
}
}
-
+
this.offsetParent = offsetParent
}
return this.offsetParent
@@ -562,11 +565,11 @@
_serialize: function (parent, isContainer) {
var that = this,
childType = isContainer ? "item" : "container",
-
+
children = this.$getChildren(parent, childType).not(this.options.exclude).map(function () {
return that._serialize($(this), !isContainer)
}).get()
-
+
return this.rootGroup.options.serialize(parent, children, isContainer)
},
clearDimensions: function () {
@@ -598,7 +601,7 @@
}
$.extend(Container.prototype, API)
-
+
/**
* jQuery API
*

0 comments on commit 34c28dc

Please sign in to comment.