From 968c95da52f55ff1beb348612d69dd7719322c68 Mon Sep 17 00:00:00 2001 From: Manuel Date: Wed, 5 Sep 2018 15:21:38 +0200 Subject: [PATCH] load settings from data-attribute Load settings from data-attribute for *allow_up* and *allow_down*. Also add *allow-sort* that override *_up* and *_down* --- jquery.collection.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jquery.collection.js b/jquery.collection.js index 29789fb..64f7a55 100644 --- a/jquery.collection.js +++ b/jquery.collection.js @@ -847,6 +847,16 @@ if (collection.data('allow-max') !== undefined) { settings.max = collection.data('allow-max'); } + if (collection.data('allow-up') !== undefined) { + settings.allow_up = collection.data('allow-up'); + } + if (collection.data('allow-down') !== undefined) { + settings.allow_up = collection.data('allow-down'); + } + if (collection.data('allow-sort') !== undefined) { + // Yes, "allow-sort" override up & down + settings.allow_up = settings.allow_down = collection.data('allow-sort'); + } // prototype-name required for nested collections, where collection id prefix // isn't guessable (see https://github.com/symfony/symfony/issues/13837)