From bb70d5a3adc0c450802017e82dc6b6eb8c53c125 Mon Sep 17 00:00:00 2001 From: Brandon Taylor Date: Wed, 11 Oct 2017 07:15:42 -0400 Subject: [PATCH 1/3] Added jQuery UI Touch Support --- .../adminsortable/js/jquery.ui.touch-punch.min.js | 11 +++++++++++ .../templates/adminsortable/change_form.html | 1 + .../templates/adminsortable/change_list.html | 1 + 3 files changed, 13 insertions(+) create mode 100644 adminsortable/static/adminsortable/js/jquery.ui.touch-punch.min.js diff --git a/adminsortable/static/adminsortable/js/jquery.ui.touch-punch.min.js b/adminsortable/static/adminsortable/js/jquery.ui.touch-punch.min.js new file mode 100644 index 0000000..31272ce --- /dev/null +++ b/adminsortable/static/adminsortable/js/jquery.ui.touch-punch.min.js @@ -0,0 +1,11 @@ +/*! + * jQuery UI Touch Punch 0.2.3 + * + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); \ No newline at end of file diff --git a/adminsortable/templates/adminsortable/change_form.html b/adminsortable/templates/adminsortable/change_form.html index f1c190d..65763cb 100644 --- a/adminsortable/templates/adminsortable/change_form.html +++ b/adminsortable/templates/adminsortable/change_form.html @@ -8,6 +8,7 @@ {% if has_sortable_tabular_inlines or has_sortable_stacked_inlines %} + {% include 'adminsortable/csrf/jquery.django-csrf.html' with csrf_cookie_name=csrf_cookie_name %} {% endif %} diff --git a/adminsortable/templates/adminsortable/change_list.html b/adminsortable/templates/adminsortable/change_list.html index 65cd3f2..749d830 100644 --- a/adminsortable/templates/adminsortable/change_list.html +++ b/adminsortable/templates/adminsortable/change_list.html @@ -26,6 +26,7 @@ + {% include 'adminsortable/csrf/jquery.django-csrf.html' with csrf_cookie_name=csrf_cookie_name %} {% endblock %} From 0a594928ef67fe9340ca08510aede75f2648d708 Mon Sep 17 00:00:00 2001 From: Brandon Taylor Date: Wed, 11 Oct 2017 16:13:12 -0400 Subject: [PATCH 2/3] Increase margin between sortable elements in the change list. --- adminsortable/static/adminsortable/css/admin.sortable.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/adminsortable/static/adminsortable/css/admin.sortable.css b/adminsortable/static/adminsortable/css/admin.sortable.css index e03ef81..e1c857c 100644 --- a/adminsortable/static/adminsortable/css/admin.sortable.css +++ b/adminsortable/static/adminsortable/css/admin.sortable.css @@ -19,10 +19,15 @@ #sortable ul li { overflow: auto; + margin-bottom: 8px; margin-left: 0; display: block; } +#sortable ul li:last-child { + margin-bottom: 0; +} + #sortable .sortable { list-style: none; From 4e0c23a1e5bddaaa1bfe46655961d2967b1ad264 Mon Sep 17 00:00:00 2001 From: Brandon Taylor Date: Fri, 13 Oct 2017 06:40:35 -0400 Subject: [PATCH 3/3] Version bump to 2.1.1. Updated readme files. --- README.md | 11 ++++++----- README.rst | 16 +++++++--------- adminsortable/__init__.py | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ccfe141..d98a8e3 100644 --- a/README.md +++ b/README.md @@ -466,9 +466,10 @@ the extrahead block with: {% block extrahead %} {{ block.super }} - - - + + + + {% endblock extrahead %} @@ -530,8 +531,8 @@ ordering on top of that just seemed a little much in my opinion. ### Status django-admin-sortable is currently used in production. -### What's new in 2.1? -- Removed fallbacks for Django 1.8, Tox testing and many performance improvements [Pull Request 168](https://github.com/iambrandontaylor/django-admin-sortable/pull/168) thanks [@sushifan](https://github.com/jaap3) +### What's new in 2.1.1? +- Touch support ### Future - Better template support for foreign keys that are self referential. If someone would like to take on rendering recursive sortables, that would be super. diff --git a/README.rst b/README.rst index be69a9b..e120259 100644 --- a/README.rst +++ b/README.rst @@ -582,9 +582,10 @@ minimum need to extend the extrahead block with: {% block extrahead %} {{ block.super }} - - - + + + + {% endblock extrahead %} @@ -656,13 +657,10 @@ Status django-admin-sortable is currently used in production. -What's new in 2.1? -~~~~~~~~~~~~~~~~~~ +What's new in 2.1.1? +~~~~~~~~~~~~~~~~~~~~ -- Removed fallbacks for Django 1.8, Tox testing and many performance - improvements `Pull Request - 168 `__ - thanks [@sushifan](https://github.com/jaap3) +- Touch support Future ~~~~~~ diff --git a/adminsortable/__init__.py b/adminsortable/__init__.py index 5b42c1f..1a5d0c1 100644 --- a/adminsortable/__init__.py +++ b/adminsortable/__init__.py @@ -1,4 +1,4 @@ -VERSION = (2, 1, 0) +VERSION = (2, 1, 1) DEV_N = None