From 3a20353e40e17ce18df7b227eb1fa6b4de3763a9 Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Wed, 25 May 2022 14:38:17 +0300 Subject: [PATCH] PHRAS-3678 lightbox fix short cut when vote/forbidden vote on session close (#4028) * fix short cut when vote * forbidden to vote when feedback session is close * fix on mobile * fix image and button displayed on mobile --- Phraseanet-production-client/config/config.js | 2 +- .../dist/authenticate.js | 2 +- .../dist/authenticate.min.js | 2 +- Phraseanet-production-client/dist/commons.js | 2 +- .../dist/commons.min.js | 2 +- Phraseanet-production-client/dist/lightbox.js | 24 ++++++++++++------- .../dist/lightbox.min.js | 24 ++++++++++++------- .../src/components/lightbox/index.js | 24 ++++++++++++------- .../Phrasea/Twig/PhraseanetExtension.php | 2 +- .../jquery-mobile/_jquery-validator.scss | 2 +- .../mobile/lightbox/basket_element.html.twig | 6 ++--- .../web/lightbox/agreement_box.html.twig | 2 +- templates/web/lightbox/index.html.twig | 2 +- 13 files changed, 60 insertions(+), 36 deletions(-) diff --git a/Phraseanet-production-client/config/config.js b/Phraseanet-production-client/config/config.js index e5804d8251..f5c53aca4e 100644 --- a/Phraseanet-production-client/config/config.js +++ b/Phraseanet-production-client/config/config.js @@ -13,5 +13,5 @@ module.exports = { setupDir: _root + 'tests/setup/node.js', karmaConf: _root + 'config/karma.conf.js', // change this version when you change JS file for lazy loading - assetFileVersion: 56 + assetFileVersion: 57 }; diff --git a/Phraseanet-production-client/dist/authenticate.js b/Phraseanet-production-client/dist/authenticate.js index 31ab5028bd..a6b2dd51d8 100644 --- a/Phraseanet-production-client/dist/authenticate.js +++ b/Phraseanet-production-client/dist/authenticate.js @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=56"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=57"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/authenticate.min.js b/Phraseanet-production-client/dist/authenticate.min.js index fcde514450..3b4f5c492b 100644 --- a/Phraseanet-production-client/dist/authenticate.min.js +++ b/Phraseanet-production-client/dist/authenticate.min.js @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=56"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=57"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/commons.js b/Phraseanet-production-client/dist/commons.js index 8237c42b94..b1ca87ca4f 100644 --- a/Phraseanet-production-client/dist/commons.js +++ b/Phraseanet-production-client/dist/commons.js @@ -91,7 +91,7 @@ /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=56"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=57"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/commons.min.js b/Phraseanet-production-client/dist/commons.min.js index 75f26f1bfb..270c04fba2 100644 --- a/Phraseanet-production-client/dist/commons.min.js +++ b/Phraseanet-production-client/dist/commons.min.js @@ -91,7 +91,7 @@ /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=56"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=57"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/lightbox.js b/Phraseanet-production-client/dist/lightbox.js index d1ce9659a3..2d75d10a2f 100644 --- a/Phraseanet-production-client/dist/lightbox.js +++ b/Phraseanet-production-client/dist/lightbox.js @@ -428,18 +428,26 @@ var lightbox = function lightbox(services) { _slideshow(bool); break; case 38: - el = (0, _jquery2.default)('#sc_container .basket_element.selected'); - if (el.length === 1) { - id = el.attr('id').split('_').pop(); - _setAgreement(event, el, id, 1); + // participants can vote + if ((0, _jquery2.default)('#basket_infos .user_infos .choices').length === 1) { + el = (0, _jquery2.default)('#sc_container .basket_element.selected'); + if (el.length === 1) { + id = el.attr('id').split('_').pop(); + _setAgreement(event, el, id, 1); + } } + break; case 40: - el = (0, _jquery2.default)('#sc_container .basket_element.selected'); - if (el.length === 1) { - id = el.attr('id').split('_').pop(); - _setAgreement(event, el, id, -1); + // participants can vote + if ((0, _jquery2.default)('#basket_infos .user_infos .choices').length === 1) { + el = (0, _jquery2.default)('#sc_container .basket_element.selected'); + if (el.length === 1) { + id = el.attr('id').split('_').pop(); + _setAgreement(event, el, id, -1); + } } + break; default: break; diff --git a/Phraseanet-production-client/dist/lightbox.min.js b/Phraseanet-production-client/dist/lightbox.min.js index d1ce9659a3..2d75d10a2f 100644 --- a/Phraseanet-production-client/dist/lightbox.min.js +++ b/Phraseanet-production-client/dist/lightbox.min.js @@ -428,18 +428,26 @@ var lightbox = function lightbox(services) { _slideshow(bool); break; case 38: - el = (0, _jquery2.default)('#sc_container .basket_element.selected'); - if (el.length === 1) { - id = el.attr('id').split('_').pop(); - _setAgreement(event, el, id, 1); + // participants can vote + if ((0, _jquery2.default)('#basket_infos .user_infos .choices').length === 1) { + el = (0, _jquery2.default)('#sc_container .basket_element.selected'); + if (el.length === 1) { + id = el.attr('id').split('_').pop(); + _setAgreement(event, el, id, 1); + } } + break; case 40: - el = (0, _jquery2.default)('#sc_container .basket_element.selected'); - if (el.length === 1) { - id = el.attr('id').split('_').pop(); - _setAgreement(event, el, id, -1); + // participants can vote + if ((0, _jquery2.default)('#basket_infos .user_infos .choices').length === 1) { + el = (0, _jquery2.default)('#sc_container .basket_element.selected'); + if (el.length === 1) { + id = el.attr('id').split('_').pop(); + _setAgreement(event, el, id, -1); + } } + break; default: break; diff --git a/Phraseanet-production-client/src/components/lightbox/index.js b/Phraseanet-production-client/src/components/lightbox/index.js index bf5392bd95..4312cdb8bd 100644 --- a/Phraseanet-production-client/src/components/lightbox/index.js +++ b/Phraseanet-production-client/src/components/lightbox/index.js @@ -234,18 +234,26 @@ const lightbox = services => { _slideshow(bool); break; case 38: - el = $('#sc_container .basket_element.selected'); - if (el.length === 1) { - id = el.attr('id').split('_').pop(); - _setAgreement(event, el, id, 1); + // participants can vote + if ($('#basket_infos .user_infos .choices').length === 1) { + el = $('#sc_container .basket_element.selected'); + if (el.length === 1) { + id = el.attr('id').split('_').pop(); + _setAgreement(event, el, id, 1); + } } + break; case 40: - el = $('#sc_container .basket_element.selected'); - if (el.length === 1) { - id = el.attr('id').split('_').pop(); - _setAgreement(event, el, id, -1); + // participants can vote + if ($('#basket_infos .user_infos .choices').length === 1) { + el = $('#sc_container .basket_element.selected'); + if (el.length === 1) { + id = el.attr('id').split('_').pop(); + _setAgreement(event, el, id, -1); + } } + break; default: break; diff --git a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php index a41ea09665..01aca4d35f 100644 --- a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php +++ b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php @@ -59,7 +59,7 @@ class PhraseanetExtension extends \Twig_Extension { return [ // change this version when you change JS file to force the navigation to reload js file - 'assetFileVersion' => 56 + 'assetFileVersion' => 57 ]; } diff --git a/resources/www/lightbox/styles/jquery-mobile/_jquery-validator.scss b/resources/www/lightbox/styles/jquery-mobile/_jquery-validator.scss index 67a0ad85cd..d08ba98a10 100644 --- a/resources/www/lightbox/styles/jquery-mobile/_jquery-validator.scss +++ b/resources/www/lightbox/styles/jquery-mobile/_jquery-validator.scss @@ -250,7 +250,7 @@ a.active_choice { } .lightbox-img { width: 90px; - height: 90px; + height: 70px; background-color: #ededed; position: absolute; left: 0; diff --git a/templates/mobile/lightbox/basket_element.html.twig b/templates/mobile/lightbox/basket_element.html.twig index 56c5448168..16574360a0 100644 --- a/templates/mobile/lightbox/basket_element.html.twig +++ b/templates/mobile/lightbox/basket_element.html.twig @@ -67,13 +67,13 @@