From c92cf57e4cb4188e53477ee08c6617b140b46253 Mon Sep 17 00:00:00 2001 From: Lele Gaifax Date: Sat, 22 Aug 2020 16:02:10 +0200 Subject: [PATCH 1/4] Actually honor the autofocus setting This rectifies commits 1b1301d9622c72c1d947cc220d70f949a2f03d6f and 35c7ba82a28bc53829baa76aaffa2046ff6e6995. (cherry picked from commit af3b1f025788f18d711ba978ea0839fbbbfea840) --- deform/templates/checkbox_choice.pt | 2 +- deform/templates/radio_choice.pt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deform/templates/checkbox_choice.pt b/deform/templates/checkbox_choice.pt index c6667e18..0f3efaba 100644 --- a/deform/templates/checkbox_choice.pt +++ b/deform/templates/checkbox_choice.pt @@ -14,7 +14,7 @@ Date: Sat, 22 Aug 2020 16:11:47 +0200 Subject: [PATCH 2/4] Cosmetic, remove spurious whitespace (cherry picked from commit 89c3fbc871e382cbdc7d61c613354c7bf19da7dd) --- deform/static/scripts/deform.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/deform/static/scripts/deform.js b/deform/static/scripts/deform.js index 3dbf6ef8..720fca2d 100644 --- a/deform/static/scripts/deform.js +++ b/deform/static/scripts/deform.js @@ -1,5 +1,5 @@ -/* - * Register a top-level callback to the deform.load() function +/* + * Register a top-level callback to the deform.load() function * this will be called when the DOM has finished loading. No need * to include the call at the end of the page. */ @@ -29,7 +29,6 @@ var deform = { deform_loaded = true; }}); }, - processCallbacks: function () { $(deform.callbacks).each(function(num, item) { @@ -48,7 +47,7 @@ var deform = { // In order to avoid breaking accessibility: // // - Find each tag within the prototype node with an id - // that has the string ``deformField(\d+)`` within it, and modify + // that has the string ``deformField(\d+)`` within it, and modify // its id to have a random component. // - For each label referencing an change id, change the label's // for attribute to the new id. @@ -63,7 +62,7 @@ var deform = { var genid = deform.randomString(6); var idmap = {}; - // replace ids containing ``deformField`` and associated label for= + // replace ids containing ``deformField`` and associated label for= // items which point at them $idnodes.each(function(idx, node) { @@ -92,7 +91,7 @@ var deform = { var oid = item[0]; var callback = item[1]; var newid = idmap[oid]; - if (newid) { + if (newid) { callback(newid); } }); @@ -112,10 +111,10 @@ var deform = { var max_len = parseInt($before_node.attr('max_len')||'9999', 10); var now_len = parseInt($before_node.attr('now_len')||'0', 10); var orderable = parseInt($before_node.attr('orderable')||'0', 10); - + if (now_len < max_len) { deform.addSequenceItem($proto_node, $before_node); - deform.processSequenceButtons($oid_node, min_len, max_len, + deform.processSequenceButtons($oid_node, min_len, max_len, now_len + 1, orderable); } return false; @@ -134,7 +133,7 @@ var deform = { $item_node.remove(); // we removed something from the dom, trigger a change event $oid_node.trigger('change'); - deform.processSequenceButtons($oid_node, min_len, max_len, + deform.processSequenceButtons($oid_node, min_len, max_len, now_len-1, orderable); } return false; @@ -156,11 +155,11 @@ var deform = { randomString: function (length) { var chr='0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'; chr = chr.split(''); - + if (! length) { length = Math.floor(Math.random() * chr.length); } - + var str = ''; for (var i = 0; i < length; i++) { str += chr[Math.floor(Math.random() * chr.length)]; From 7b01734995302ce7b563949661c0c781f3bbf932 Mon Sep 17 00:00:00 2001 From: Lele Gaifax Date: Sat, 22 Aug 2020 16:12:09 +0200 Subject: [PATCH 3/4] Remove unused variable (cherry picked from commit 9ee609e8b2317d8f7ae53403b702468342c68d99) --- deform/static/scripts/deform.js | 1 - 1 file changed, 1 deletion(-) diff --git a/deform/static/scripts/deform.js b/deform/static/scripts/deform.js index 720fca2d..17ba4a20 100644 --- a/deform/static/scripts/deform.js +++ b/deform/static/scripts/deform.js @@ -53,7 +53,6 @@ var deform = { // for attribute to the new id. var fieldmatch = /deformField(\d+)/; - var namematch = /(.+)?-[#]{3}/; var code = protonode.attr('prototype'); var html = decodeURIComponent(code); var $htmlnode = $(html); From b5797b4e8094b2a1afbaffdefefa4bf12a7f6c0d Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 23 Aug 2020 00:07:58 -0700 Subject: [PATCH 4/4] Sync change notes from master --- CHANGES.txt | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index bc6da8f7..53db012b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,29 @@ .. _2.0.12: -2.0.12 (unreleased) +2.0.12 (2020-08-XX) ------------------- +- Update select2 widget to version 4.0.13. + See https://github.com/Pylons/deform/pull/441 + +- Add the ``structure`` keyword to the autocomplete template's options to stop + its encoding. + See https://github.com/Pylons/deform/pull/445 + +- Use the local HTML element for change event when removing/adding to DOM. + See https://github.com/Pylons/deform/pull/331 + +- Fix deprecation warning when importing the module ``field.py`` while testing + with pytest. + See https://github.com/Pylons/deform/pull/419 + +- Fix a bug that was introduced in 2.0.11 that made it such that the ``focus`` + parameter on forms did not honor the ``off`` value for ``checkboxChoice`` and + ``radioChoice`` widgets. + See https://github.com/Pylons/deform/pull/453 + +- Remove the unused variable ``namematch`` from deform.js. + See https://github.com/Pylons/deform/pull/454 .. _2.0.11: @@ -14,7 +35,7 @@ - Changed the implementation of input autofocus from JavaScript to an HTML5 input attribute. - Forms now have an optional ``focus`` parameter (``on``|``off``) and fields + Forms now have an optional ``focus`` parameter (``on`` or ``off``) and fields have an optional ``autofocus`` parameter. - If ``focus`` is ``on``, and at least one field has an ``autofocus`` @@ -28,6 +49,8 @@ Default: ``on``. (This is unchanged from the JavaScript implementation.) + See https://github.com/Pylons/deform/pull/365/ + - Replace the flake8-isort plugin with plain old isort. See https://github.com/Pylons/deform/pull/427