diff --git a/.gitignore b/.gitignore index cbaf437..3cf5132 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /.sass-cache /build /.bundle +/node_modules # tempfiles diff --git a/CHANGELOG b/CHANGELOG index 3a871ac..bb9c4fd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,18 +1,37 @@ +[0.9.13] fix hovering over empty container (Jonny Gerig Meyer) + allow custom drag classes (Jonny Gerig Meyer) + support text areas inside sortables (Isaac Kearse) + fix drag with placeholder issue (Michael McLaughlin) + user outer dimensions for dragged item (Jared Mellentine) + support npm and bower (Patrick Gunderson, Shaun Dern) + fix issue with legacy jQuery 1.10 + fix for mobile chrome + +[0.9.12] expose mouse events in callbacks + add refresh method + add destroy method + add delay option + falsy return value in onMousedown prevents dragging + fix exclusion of items + fix ignore for select element (abixalmon) + fix touch events (prateekjadhwani) + fix itemPath issues (appending and dragInit) + improve documentation [0.9.11] option tolerance accepts negative values - rewrote enable/disable logic - added (item|container)Path + rewrote enable/disable logic + added (item|container)Path -[0.9.10]Fix Array.indexOf() error in IE < 9 (Dev-Speranza) - serialize() assumes one subcontainer per item - remove call to stopPropagation() - Added onMousedown() +[0.9.10] Fix Array.indexOf() error in IE < 9 (Dev-Speranza) + serialize() assumes one subcontainer per item + remove call to stopPropagation() + Added onMousedown() [0.9.9] Added options tolerance and distance - Do not modify Array.prototype (by Joakin) - serialize respects exclude option + Do not modify Array.prototype (by Joakin) + serialize respects exclude option [0.9.8] Added Serialization - Added onCancel + Added onCancel [0.9.7] Support iFrame and Touch events - Better behavior if the CSS position changes \ No newline at end of file + Better behavior if the CSS position changes diff --git a/Gemfile b/Gemfile index c457f7c..2fcf6f5 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 5a71aaf..ed60e39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,153 +5,140 @@ 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.22) + i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) - addressable (2.2.8) - chunky_png (1.2.5) - closure-compiler (1.1.6) - coderay (1.0.7) + chunky_png (1.3.4) + closure-compiler (1.1.11) + coderay (1.1.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.3.3) + coffee-script-source (1.9.1.1) compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) sass (~> 3.1) - daemons (1.1.8) - em-websocket (0.3.8) - addressable (>= 2.1.1) + daemons (1.2.3) + em-websocket (0.5.1) eventmachine (>= 0.12.9) - eventmachine (0.12.10) - execjs (1.4.0) + http_parser.rb (~> 0.6.0) + eventmachine (1.0.7) + execjs (1.4.1) multi_json (~> 1.0) - ffi (1.0.11) - fssm (0.2.9) - guard (1.2.3) - listen (>= 0.4.2) + ffi (1.9.9) + formatador (0.2.5) + fssm (0.2.10) + guard (1.8.3) + formatador (>= 0.2.4) + listen (~> 1.3) + lumberjack (>= 1.0.2) + pry (>= 0.9.10) 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) + guard-livereload (1.4.0) + em-websocket (>= 0.5.0) + guard (>= 1.8.0) + multi_json (~> 1.7) + haml (4.0.6) + 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) + http_parser.rb (0.6.0) + i18n (0.6.11) + json (1.8.3) + kramdown (1.7.0) + libv8 (3.16.14.9) + listen (1.3.1) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + rb-kqueue (>= 0.2) + lumberjack (1.0.9) + method_source (0.8.2) + middleman (3.2.2) 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.2) + middleman-sprockets (>= 3.1.2) sass (>= 3.1.20) - uglifier (~> 1.2.6) - middleman-sprockets (3.0.0) - middleman-more (= 3.0.0) - 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) + uglifier (~> 2.4.0) + middleman-core (3.2.2) + activesupport (~> 3.2.6) + bundler (~> 1.1) + i18n (~> 0.6.9) + 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.3.3) + middleman-core (>= 3.2) + sprockets (~> 2.2) + sprockets-helpers (~> 1.1.0) + sprockets-sass (~> 1.1.0) + multi_json (1.11.1) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + rack (1.6.4) rack-coderay (0.2.0) coderay (>= 0.8.312) hpricot (>= 0.8.1) rack (>= 1.0.0) - rack-livereload (0.3.6) + rack-livereload (0.3.15) rack - rack-protection (1.2.0) - rack - rack-test (0.6.1) + rack-test (0.6.3) rack (>= 1.0) - rb-fchange (0.0.5) - ffi - rb-fsevent (0.9.1) - rb-inotify (0.8.8) + rb-fsevent (0.9.5) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + rb-kqueue (0.2.4) 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) + rdiscount (2.1.8) + ref (1.0.5) + sass (3.1.21) + slop (3.6.0) + sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-sass (0.8.0) + sprockets-helpers (1.1.0) + sprockets (~> 2.0) + sprockets-sass (1.1.0) sprockets (~> 2.0) tilt (~> 1.1) - syntax (1.0.0) - therubyracer (0.10.1) - libv8 (~> 3.3.10) - 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) + therubyracer (0.12.2) + libv8 (~> 3.16.14.0) + ref + thin (1.6.3) + daemons (~> 1.0, >= 1.0.9) + eventmachine (~> 1.0) + rack (~> 1.0) + thor (0.19.1) + tilt (1.4.1) + uglifier (2.4.0) execjs (>= 0.3.0) - multi_json (~> 1.3) - url_mount (0.2.1) - rack + json (>= 1.8.0) 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 diff --git a/TODO b/TODO index 3121870..de15ff7 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,10 @@ -- [0/0] bugs -- [0/5] consider +- [0/3] bugs + - [ ] last Pointer is NaN in search valid target + - [ ] prevent infinite recursion + - [ ] bootstrap example jumps up on drop + - (only sometimes. preventDefault() does not work if called inside drop or on containing element. Look up where the on handler attaches itself) + - only firefox, chrome works +- [0/6] consider - [ ] better name for searchValidTarget - [ ] shortcut on getNearest() - [ ] if items, break if distance is growing again @@ -7,3 +12,4 @@ - [ ] only calculate top/bottom if vertical and left/right if horizontal - [ ] support placeholder with height/width - [ ] calculate item/container dimensions relative to the container => Not all centers have to be recalculated + - [ ] change subContainers handling, so that it becomes easier to remove them diff --git a/VERSION b/VERSION index 8225a4b..62ea259 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.11 +0.9.13 diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..5c77614 --- /dev/null +++ b/bower.json @@ -0,0 +1,27 @@ +{ + "name": "jquery-sortable", + "version": "0.9.13", + "homepage": "http://johnny.github.io/jquery-sortable/", + "authors": [ + "Jonas von Andrian" + ], + "main": "./source/js/jquery-sortable.js", + "moduleType": [ + "globals" + ], + "keywords": [ + "sortable", + "sort", + "sorting", + "drag", + "dragging" + ], + "license": "BSD-3", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/build.sh b/build.sh index 0ca19f6..6fd55fa 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,11 @@ #!/bin/sh +set -o nounset +set -o errexit VERSION=`cat VERSION` cp README.mkd .. -./bin/middleman build +bundle exec middleman build git commit -am "Release $VERSION" git checkout gh-pages rm -R js css img diff --git a/config.rb b/config.rb index 764ce94..c301336 100644 --- a/config.rb +++ b/config.rb @@ -1,4 +1,4 @@ -### +### # Compass ### @@ -16,13 +16,13 @@ ### # Per-page layout changes: -# +# # With no layout # page "/path/to/file.html", :layout => false -# +# # With alternative layout -# page "/path/to/file.html", :layout => :otherlayout -# +page "/debug.html", :layout => 'debug.haml' +# # A path which all have the same layout # with_layout :admin do # page "/admin/*" @@ -47,7 +47,7 @@ def escape_file(name) end def example(name) content = escape_file("js/examples/"+ name + ".js") - content.match(/\A\$\(function\s*\(\)\s*\{\s*(.*)\s*\}\s*\)\s*\z/mi)[1].gsub(/^ /, "") + content.match(/\A\$\(function\s*\(\)\s*\{\s*(.*)\s*\}\s*\);\s*\z/mi)[1].gsub(/^ /, "") end def show_code_button content_tag( :div, @@ -84,10 +84,18 @@ def file_kb(name) set :css_dir, 'css' +ignore 'css/jquery-sortable.css.sass' + set :js_dir, 'js' set :images_dir, 'img' +def update_version(file) + content = File.read(file).gsub(/("version": "|blob\/)[\d\.]+/, '\1' + VERSION) + File.open(file, 'w') do |file| + file.puts content + end +end # Build-specific configuration configure :build do filename = 'source/js/jquery-sortable.js' @@ -105,30 +113,29 @@ def file_kb(name) end `gzip -c source/js/jquery-sortable-min.js > source/js/jquery-sortable-min.js.gz` - - manifest = 'sortable.jquery.json' - content = File.read(manifest).gsub(/("version": "|blob\/)[\d\.]+/, '\1' + VERSION) - File.open(manifest, 'w') do |file| - file.puts content - end + + ['sortable.jquery.json', + 'bower.json', + 'package.json' + ].each { |package_file| update_version(package_file) } # For example, change the Compass output style for deployment # activate :minify_css - + # Minify Javascript on build # activate :minify_javascript - + # Enable cache buster # activate :cache_buster - + # Use relative URLs # activate :relative_assets - + # Compress PNGs after build # First: gem install middleman-smusher # require "middleman-smusher" # activate :smusher - + # Or use a different image path # set :http_path, "/Content/images/" set :http_prefix, "/jquery-sortable" diff --git a/package.json b/package.json new file mode 100644 index 0000000..39166ca --- /dev/null +++ b/package.json @@ -0,0 +1,31 @@ +{ + "name": "jquery-sortable", + "version": "0.9.13", + "description": "jquery plugin for sortable, nestable lists", + "main": "./source/js/jquery-sortable.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/johnny/jquery-sortable.git" + }, + "keywords": [ + "sortable", + "sort", + "sorting", + "drag", + "dragging" + ], + "author": [ + "Jonas von Andrian" + ], + "license": "BSD-3", + "bugs": { + "url": "https://github.com/johnny/jquery-sortable/issues" + }, + "homepage": "https://github.com/johnny/jquery-sortable", + "dependencies": { + "jquery": "^2.1.2 || ^3.0.0" + } +} diff --git a/push-tag.sh b/push-tag.sh index 8d135d4..009bc95 100755 --- a/push-tag.sh +++ b/push-tag.sh @@ -1,4 +1,6 @@ #!/bin/sh +set -o nounset +set -o errexit VERSION=`cat VERSION` diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..3bd5c7b --- /dev/null +++ b/release.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -o nounset +set -o errexit + +./build.sh +./push-tag.sh diff --git a/sortable.jquery.json b/sortable.jquery.json index a564193..425ac93 100644 --- a/sortable.jquery.json +++ b/sortable.jquery.json @@ -9,14 +9,14 @@ "drag", "drop" ], - "version": "0.9.11", + "version": "0.9.13", "author": { "name": "Jonas von Andrian" }, "licenses": [ { "type": "BSD-3", - "url": "https://github.com/johnny/jquery-sortable/blob/0.9.11/LICENSE" + "url": "https://github.com/johnny/jquery-sortable/blob/0.9.13/LICENSE" } ], "bugs": "https://github.com/johnny/jquery-sortable/issues", diff --git a/source/_serialization.html.haml b/source/_serialization.html.haml new file mode 100644 index 0000000..2812aa4 --- /dev/null +++ b/source/_serialization.html.haml @@ -0,0 +1,27 @@ +%h2 Serialization and delay +.row + .span12.example + %pre(lang="js")= example("serialization") + .span4 + %ul + %li + Uses the default + %strong serialize + implementation, that reads out the + %strong data attributes + %p= show_code_button + %h3 Serialize result + %pre#serialize_output2 + .span4 + %ol.serialization.vertical + = iterate(6) do |i,name| + %li(data-id=i data-name=name) + = name + - if i == 3 + %ol + = iterate(6) do |j, name| + %li(data-id="#{i}-#{j}" data-name=name)= name + .span4 + %ol.serialization.vertical + = iterate(6,"Item") do |i,name| + %li(data-id=i data-name=name)= name diff --git a/source/_table.html.haml b/source/_table.html.haml index 2e948ef..1157cb5 100644 --- a/source/_table.html.haml +++ b/source/_table.html.haml @@ -36,8 +36,10 @@ %tr %th A Column %th B Column + %th C Column %tbody = iterate(6) do |i, name| %tr %td A #{name} %td B #{name} + %td C #{name} diff --git a/source/css/application.css.sass b/source/css/application.css.sass index 7752796..5f0c9b5 100644 --- a/source/css/application.css.sass +++ b/source/css/application.css.sass @@ -44,10 +44,13 @@ ol.nested_with_switch, ol.nested_with_switch ol &.active border: 1px solid $grayDark -ol.nested_with_switch, ol.simple_with_animation, ol.default +ol.nested_with_switch, ol.simple_with_animation, ol.serialization, ol.default li cursor: pointer +ol.simple_with_animation + border: 1px solid $grayLight + .switch-container display: block margin-left: auto diff --git a/source/css/jquery-sortable.css.sass b/source/css/jquery-sortable.css.sass index 2a9ef5d..655ab43 100644 --- a/source/css/jquery-sortable.css.sass +++ b/source/css/jquery-sortable.css.sass @@ -9,6 +9,7 @@ body.dragging, body.dragging * ol.vertical margin: 0 0 9px 0 + min-height: 10px li display: block margin: 5px diff --git a/source/debug.html.erb b/source/debug.html.erb new file mode 100644 index 0000000..25de6b3 --- /dev/null +++ b/source/debug.html.erb @@ -0,0 +1,52 @@ + + +
| t |