Permalink
Browse files

pass container into onDragStart

add footer
duplicate item on drag
update version number in jquery-sortable.js on build
  • Loading branch information...
johnny committed Jul 26, 2012
1 parent 1346f7b commit 9a638fc59a82067b0d4d1fd9c7c1f2a50b08af78
View
@@ -14,4 +14,6 @@ gem 'rack-coderay'
gem 'therubyracer'
gem 'closure-compiler'
+gem 'rdiscount'
+
gem 'sass-twitter-bootstrap', '2.0.4', :git => 'https://github.com/johnny/sass-twitter-bootstrap.git', :branch => 'customizations'
View
@@ -113,6 +113,7 @@ GEM
rb-fsevent (0.9.1)
rb-inotify (0.8.8)
ffi (>= 0.5.0)
+ rdiscount (1.6.8)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
@@ -149,6 +150,7 @@ DEPENDENCIES
middleman (>= 3)
rack-coderay
rack-livereload
+ rdiscount
sass!
sass-twitter-bootstrap (= 2.0.4)!
therubyracer
View
6 TODO
@@ -1,9 +1,9 @@
- [0/0] bugs
-- [ ] on build update version in jquery-sortable.js
-- [0/4] consider
- - [ ] support placeholder with height/width
+- [0/5] consider
- [ ] shortcut on getNearest()
- [ ] if items, break if distance is growing again
- [ ] if containers, break if distance is 0
+ - [ ] only calculate top/bottom if vertical and left/right if horizontal
+ - [ ] support placeholder with height/width
- [ ] use own cache for childContainers (jQuery knows all the edge cases)
- [ ] calculate item/container dimensions relative to the container => Not all centers have to be recalculated
View
@@ -1 +1 @@
-0.9
+0.9.1
View
@@ -75,11 +75,18 @@ def render_options(type, &block)
# Build-specific configuration
configure :build do
+ filename = 'source/js/jquery-sortable.js'
+ VERSION = File.read("VERSION").strip
+ updated_file = File.read(filename).gsub(/(^\s\*.*v)[\d\.]+$/, '\1' + VERSION)
+ File.open(filename, "w") do |file|
+ file.puts updated_file
+ end
+
require 'closure-compiler'
File.open('source/js/jquery-sortable-min.js','w') do |file|
# closure = Closure::Compiler.new(:compilation_level => 'ADVANCED_OPTIMIZATIONS')
closure = Closure::Compiler.new
- file.puts closure.compile(File.open('source/js/jquery-sortable.js', 'r'))
+ file.puts closure.compile(updated_file)
end
# For example, change the Compass output style for deployment
@@ -11,6 +11,9 @@
Pure
%strong drag/drop
container
+ %li
+ %strong Clone
+ items on drag
%p= show_code_button
.span4
%h3 I'm draggable and droppable
View
@@ -1,4 +1,6 @@
-%h2 Sort tables
+%h2
+ Sort tables
+ %small (doesn't work well in Konqueror and IE)
.row
.span12.example
%pre(lang="js")= example("table")
@@ -11,6 +11,13 @@ $error: red
position: relative
.page-header h1, h2
padding-top: 40px
+.footer
+ margin-top: 45px
+ padding: 35px 0 36px
+ border-top: 1px solid #E5E5E5
+ p
+ margin-bottom: 0
+ color: #555
table.docs
table-layout: fixed
View
@@ -202,3 +202,15 @@
(an extension of jQuery UI)
%li
%a(href="http://yuilibrary.com/yui/docs/sortable/") YUI sortable
+
+%footer.footer
+ :markdown
+ Created by
+ [Jonas von Andrian](https://github.com/johnny).
+
+ jquery-sortable.js is released under the
+ [Modified BSD License](http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5).
+
+ Built with [Bootstrap](http://twitter.github.com/bootstrap/).
+ Icons from [Glyphicons Free](http://glyphicons.com/).
+
@@ -1,7 +1,12 @@
$(function() {
$("ol.simple_with_drop").sortable({
group: 'no-drop',
- handle: 'i.icon-move'
+ handle: 'i.icon-move',
+ onDragStart: function (item, container, _super) {
+ if(!container.options.drop)
+ item.clone().insertAfter(item)
+ _super(item)
+ }
})
$("ol.simple_with_no_drop").sortable({
group: 'no-drop',

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,19 +1,19 @@
/* ===================================================
- * jquery-sortable.js v0.9
- * http://johnny.github.com/jquery-sortable/
+ * jquery-sortable.js v0.9.1
+ * http://johnny.github.com/jquery-sortable/
* ===================================================
* Copyright (c) 2012 Jonas von Andrian
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
* * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -186,6 +186,7 @@
// get item to drag
this.item = $(e.target).closest(this.options.itemSelector)
+ this.itemContainer = itemContainer
this.setPointer(e)
},
@@ -195,7 +196,7 @@
if(!this.dragging){
processChildContainers(this.item, this.options.containerSelector, "disable", true)
- this.options.onDragStart(this.item, this, groupDefaults.onDragStart)
+ this.options.onDragStart(this.item, this.itemContainer, groupDefaults.onDragStart)
this.dragging = true
}
Binary file not shown.

0 comments on commit 9a638fc

Please sign in to comment.