From 0e87e42b12e651a5509c3c25fb0b0b0997e56b9b Mon Sep 17 00:00:00 2001 From: Stefan Hanauska Date: Thu, 5 Dec 2024 13:19:05 +0100 Subject: [PATCH] CR fixes --- amd/build/cardnumber.min.js | 2 +- amd/build/cardnumber.min.js.map | 2 +- amd/build/selectors.min.js | 2 +- amd/build/selectors.min.js.map | 2 +- amd/src/cardnumber.js | 4 +-- amd/src/selectors.js | 2 +- classes/boardmanager.php | 7 +++++- classes/numberfilter.php | 3 ++- templates/card.mustache | 2 +- tests/numberfilter_test.php | 44 +++++++++++++++++++++++++++++++++ 10 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 tests/numberfilter_test.php diff --git a/amd/build/cardnumber.min.js b/amd/build/cardnumber.min.js index 9ae2a17a..13a03265 100644 --- a/amd/build/cardnumber.min.js +++ b/amd/build/cardnumber.min.js @@ -1,3 +1,3 @@ -define("mod_kanban/cardnumber",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0;_exports.init=element=>{document.querySelectorAll("#"+element+" .mod_kanban_card_number").forEach((el=>{el.addEventListener("click",(event=>{document.querySelector('.mod_kanban_card[data-number="'.concat(event.target.dataset.id,'"] .mod_kanban_description_trigger')).click()}))}))}})); +define("mod_kanban/cardnumber",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0;_exports.init=element=>{document.querySelectorAll("#"+element+" .mod_kanban_card_number").forEach((el=>{el.addEventListener("click",(event=>{document.querySelector('.mod_kanban_card[data-number="'.concat(event.target.dataset.id,'"] .mod_kanban_detail_trigger')).click()}))}))}})); //# sourceMappingURL=cardnumber.min.js.map \ No newline at end of file diff --git a/amd/build/cardnumber.min.js.map b/amd/build/cardnumber.min.js.map index 60cde107..6db0fd19 100644 --- a/amd/build/cardnumber.min.js.map +++ b/amd/build/cardnumber.min.js.map @@ -1 +1 @@ -{"version":3,"file":"cardnumber.min.js","sources":["../src/cardnumber.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Helper for card number filter\n *\n * @module mod_kanban/cardnumber\n * @copyright 2024 ISB Bayern\n * @author Stefan Hanauska \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport const init = (element) => {\n document.querySelectorAll('#' + element + ' .mod_kanban_card_number').forEach((el) => {\n el.addEventListener('click', (event) => {\n document.querySelector(\n `.mod_kanban_card[data-number=\"${event.target.dataset.id}\"] .mod_kanban_description_trigger`\n ).click();\n });\n });\n};\n"],"names":["element","document","querySelectorAll","forEach","el","addEventListener","event","querySelector","target","dataset","id","click"],"mappings":"0JAwBqBA,UACjBC,SAASC,iBAAiB,IAAMF,QAAU,4BAA4BG,SAASC,KAC3EA,GAAGC,iBAAiB,SAAUC,QAC1BL,SAASM,sDAC4BD,MAAME,OAAOC,QAAQC,0CACxDC"} \ No newline at end of file +{"version":3,"file":"cardnumber.min.js","sources":["../src/cardnumber.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Helper for card number filter\n *\n * @module mod_kanban/cardnumber\n * @copyright 2024 ISB Bayern\n * @author Stefan Hanauska \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport const init = (element) => {\n document.querySelectorAll('#' + element + ' .mod_kanban_card_number').forEach((el) => {\n el.addEventListener('click', (event) => {\n document.querySelector(\n `.mod_kanban_card[data-number=\"${event.target.dataset.id}\"] .mod_kanban_detail_trigger`\n ).click();\n });\n });\n};\n"],"names":["element","document","querySelectorAll","forEach","el","addEventListener","event","querySelector","target","dataset","id","click"],"mappings":"0JAwBqBA,UACjBC,SAASC,iBAAiB,IAAMF,QAAU,4BAA4BG,SAASC,KAC3EA,GAAGC,iBAAiB,SAAUC,QAC1BL,SAASM,sDAC4BD,MAAME,OAAOC,QAAQC,qCACxDC"} \ No newline at end of file diff --git a/amd/build/selectors.min.js b/amd/build/selectors.min.js index 7874f356..637cc2fa 100644 --- a/amd/build/selectors.min.js +++ b/amd/build/selectors.min.js @@ -1,3 +1,3 @@ -define("mod_kanban/selectors",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;return _exports.default={ADDCARD:'[data-action="add_card"]',ADDCARDCONTAINER:".mod_kanban_addcard_container",ADDCARDFIRST:".mod_kanban_addcard_first",ADDCOLUMN:'[data-action="add_column"]',ADDCOLUMNCONTAINER:".mod_kanban_addcolumn_container",ADDCOLUMNFIRST:".mod_kanban_addcolumn_first",ASSIGNEES:".mod_kanban_assignees",ASSIGNSELF:'[data-action="assign_self"]',ASSIGNUSER:'[data-action="assign_user"]',ASSIGNEDUSER:".mod_kanban_assigned_user",BOARD:".mod_kanban_board",CARD:".mod_kanban_card",CARDNUMBER:".mod_kanban_card_number",COLUMN:".mod_kanban_column",COLUMNCONTAINER:".mod_kanban_column_container",COLUMNINNER:".mod_kanban_column_inner",COMPLETE:'[data-action="complete_card"]',COMPLETIONSTATE:".mod_kanban_card_completion",CONTAINER:".mod_kanban_render_container",DELETEBOARD:'[data-action="delete_board"]',DELETECARD:'[data-action="delete_card"]',DELETECOLUMN:'[data-action="delete_column"]',DELETEMESSAGE:'[data-action="delete_message"]',DELETETEMPLATE:'[data-action="delete_template"]',DESCRIPTIONMODAL:".mod_kanban_description",DESCRIPTIONMODALBODY:".mod_kanban_description_modal .modal-body",DESCRIPTIONMODALFOOTER:".mod_kanban_description_modal .modal-footer",DESCRIPTIONMODALTITLE:".mod_kanban_description_modal .modal-title",DESCRIPTIONTOGGLE:".mod_kanban_description",DETAILBUTTON:".mod_kanban_description_trigger",DISCUSSION:".mod_kanban_discussion",DISCUSSIONINPUT:".mod_kanban_discussion_input",DISCUSSIONMESSAGES:".mod_kanban_discussion_messages",DISCUSSIONMODAL:".mod_kanban_discussion_modal",DISCUSSIONMODALTITLE:".mod_kanban_discussion_modal .modal-title",DISCUSSIONMODALTRIGGER:".mod_kanban_discussion_trigger",DISCUSSIONSEND:'[data-action="send_discussion_message"]',DISCUSSIONSHOW:'[data-action="show_discussion"]',DUEDATE:".mod_kanban_duedate",EDITDETAILS:'[data-action="edit_details"]',HIDEHIDDEN:'[data-action="hide_hidden"]',HISTORY:".mod_kanban_history",HISTORYITEMS:".mod_kanban_history_items",HISTORYMODAL:".mod_kanban_history_modal",HISTORYMODALTRIGGER:'[data-action="show_history"]',INPLACEEDITABLE:".inplaceeditable",LOCKCOLUMN:'[data-action="lock_column"]',LOCKBOARDCOLUMNS:'[data-action="lock_board_columns"]',MAIN:".mod_kanban_main",MOVECARDAFTERCARD:".mod_kanban_move_card_aftercard",MOVECARDCOLUMN:".mod_kanban_move_card_column",MOVEMODALTRIGGER:'[data-action="move_card"]',PUSHCARD:'[data-action="push_card"]',SAVEASTEMPLATE:'[data-action="create_template"]',SCROLLLEFT:".mod_kanban_scroll_left button",SCROLLRIGHT:".mod_kanban_scroll_right button",SHOWBOARD:'[data-action="show_board"]',SHOWHIDDEN:'[data-action="show_hidden"]',SHOWTEMPLATE:'[data-action="show_template"]',UNASSIGNSELF:'[data-action="unassign_self"]',UNASSIGNUSER:'[data-action="unassign_user"]',UNCOMPLETE:'[data-action="uncomplete_card"]',UNLOCKCOLUMN:'[data-action="unlock_column"]',UNLOCKBOARDCOLUMNS:'[data-action="unlock_board_columns"]'},_exports.default})); +define("mod_kanban/selectors",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;return _exports.default={ADDCARD:'[data-action="add_card"]',ADDCARDCONTAINER:".mod_kanban_addcard_container",ADDCARDFIRST:".mod_kanban_addcard_first",ADDCOLUMN:'[data-action="add_column"]',ADDCOLUMNCONTAINER:".mod_kanban_addcolumn_container",ADDCOLUMNFIRST:".mod_kanban_addcolumn_first",ASSIGNEES:".mod_kanban_assignees",ASSIGNSELF:'[data-action="assign_self"]',ASSIGNUSER:'[data-action="assign_user"]',ASSIGNEDUSER:".mod_kanban_assigned_user",BOARD:".mod_kanban_board",CARD:".mod_kanban_card",CARDNUMBER:".mod_kanban_card_number",COLUMN:".mod_kanban_column",COLUMNCONTAINER:".mod_kanban_column_container",COLUMNINNER:".mod_kanban_column_inner",COMPLETE:'[data-action="complete_card"]',COMPLETIONSTATE:".mod_kanban_card_completion",CONTAINER:".mod_kanban_render_container",DELETEBOARD:'[data-action="delete_board"]',DELETECARD:'[data-action="delete_card"]',DELETECOLUMN:'[data-action="delete_column"]',DELETEMESSAGE:'[data-action="delete_message"]',DELETETEMPLATE:'[data-action="delete_template"]',DESCRIPTIONMODAL:".mod_kanban_description",DESCRIPTIONMODALBODY:".mod_kanban_description_modal .modal-body",DESCRIPTIONMODALFOOTER:".mod_kanban_description_modal .modal-footer",DESCRIPTIONMODALTITLE:".mod_kanban_description_modal .modal-title",DESCRIPTIONTOGGLE:".mod_kanban_description",DETAILBUTTON:".mod_kanban_detail_trigger",DISCUSSION:".mod_kanban_discussion",DISCUSSIONINPUT:".mod_kanban_discussion_input",DISCUSSIONMESSAGES:".mod_kanban_discussion_messages",DISCUSSIONMODAL:".mod_kanban_discussion_modal",DISCUSSIONMODALTITLE:".mod_kanban_discussion_modal .modal-title",DISCUSSIONMODALTRIGGER:".mod_kanban_discussion_trigger",DISCUSSIONSEND:'[data-action="send_discussion_message"]',DISCUSSIONSHOW:'[data-action="show_discussion"]',DUEDATE:".mod_kanban_duedate",EDITDETAILS:'[data-action="edit_details"]',HIDEHIDDEN:'[data-action="hide_hidden"]',HISTORY:".mod_kanban_history",HISTORYITEMS:".mod_kanban_history_items",HISTORYMODAL:".mod_kanban_history_modal",HISTORYMODALTRIGGER:'[data-action="show_history"]',INPLACEEDITABLE:".inplaceeditable",LOCKCOLUMN:'[data-action="lock_column"]',LOCKBOARDCOLUMNS:'[data-action="lock_board_columns"]',MAIN:".mod_kanban_main",MOVECARDAFTERCARD:".mod_kanban_move_card_aftercard",MOVECARDCOLUMN:".mod_kanban_move_card_column",MOVEMODALTRIGGER:'[data-action="move_card"]',PUSHCARD:'[data-action="push_card"]',SAVEASTEMPLATE:'[data-action="create_template"]',SCROLLLEFT:".mod_kanban_scroll_left button",SCROLLRIGHT:".mod_kanban_scroll_right button",SHOWBOARD:'[data-action="show_board"]',SHOWHIDDEN:'[data-action="show_hidden"]',SHOWTEMPLATE:'[data-action="show_template"]',UNASSIGNSELF:'[data-action="unassign_self"]',UNASSIGNUSER:'[data-action="unassign_user"]',UNCOMPLETE:'[data-action="uncomplete_card"]',UNLOCKCOLUMN:'[data-action="unlock_column"]',UNLOCKBOARDCOLUMNS:'[data-action="unlock_board_columns"]'},_exports.default})); //# sourceMappingURL=selectors.min.js.map \ No newline at end of file diff --git a/amd/build/selectors.min.js.map b/amd/build/selectors.min.js.map index 3f7001da..8aa294dd 100644 --- a/amd/build/selectors.min.js.map +++ b/amd/build/selectors.min.js.map @@ -1 +1 @@ -{"version":3,"file":"selectors.min.js","sources":["../src/selectors.js"],"sourcesContent":["/**\n * Selectors for mod_kanban.\n */\nexport default {\n ADDCARD: `[data-action=\"add_card\"]`,\n ADDCARDCONTAINER: `.mod_kanban_addcard_container`,\n ADDCARDFIRST: `.mod_kanban_addcard_first`,\n ADDCOLUMN: `[data-action=\"add_column\"]`,\n ADDCOLUMNCONTAINER: `.mod_kanban_addcolumn_container`,\n ADDCOLUMNFIRST: `.mod_kanban_addcolumn_first`,\n ASSIGNEES: `.mod_kanban_assignees`,\n ASSIGNSELF: `[data-action=\"assign_self\"]`,\n ASSIGNUSER: `[data-action=\"assign_user\"]`,\n ASSIGNEDUSER: `.mod_kanban_assigned_user`,\n BOARD: `.mod_kanban_board`,\n CARD: `.mod_kanban_card`,\n CARDNUMBER: `.mod_kanban_card_number`,\n COLUMN: `.mod_kanban_column`,\n COLUMNCONTAINER: `.mod_kanban_column_container`,\n COLUMNINNER: `.mod_kanban_column_inner`,\n COMPLETE: `[data-action=\"complete_card\"]`,\n COMPLETIONSTATE: `.mod_kanban_card_completion`,\n CONTAINER: `.mod_kanban_render_container`,\n DELETEBOARD: `[data-action=\"delete_board\"]`,\n DELETECARD: `[data-action=\"delete_card\"]`,\n DELETECOLUMN: `[data-action=\"delete_column\"]`,\n DELETEMESSAGE: `[data-action=\"delete_message\"]`,\n DELETETEMPLATE: `[data-action=\"delete_template\"]`,\n DESCRIPTIONMODAL: `.mod_kanban_description`,\n DESCRIPTIONMODALBODY: `.mod_kanban_description_modal .modal-body`,\n DESCRIPTIONMODALFOOTER: `.mod_kanban_description_modal .modal-footer`,\n DESCRIPTIONMODALTITLE: `.mod_kanban_description_modal .modal-title`,\n DESCRIPTIONTOGGLE: `.mod_kanban_description`,\n DETAILBUTTON: `.mod_kanban_description_trigger`,\n DISCUSSION: `.mod_kanban_discussion`,\n DISCUSSIONINPUT: `.mod_kanban_discussion_input`,\n DISCUSSIONMESSAGES: `.mod_kanban_discussion_messages`,\n DISCUSSIONMODAL: `.mod_kanban_discussion_modal`,\n DISCUSSIONMODALTITLE: `.mod_kanban_discussion_modal .modal-title`,\n DISCUSSIONMODALTRIGGER: `.mod_kanban_discussion_trigger`,\n DISCUSSIONSEND: `[data-action=\"send_discussion_message\"]`,\n DISCUSSIONSHOW: `[data-action=\"show_discussion\"]`,\n DUEDATE: `.mod_kanban_duedate`,\n EDITDETAILS: `[data-action=\"edit_details\"]`,\n HIDEHIDDEN: `[data-action=\"hide_hidden\"]`,\n HISTORY: `.mod_kanban_history`,\n HISTORYITEMS: `.mod_kanban_history_items`,\n HISTORYMODAL: `.mod_kanban_history_modal`,\n HISTORYMODALTRIGGER: `[data-action=\"show_history\"]`,\n INPLACEEDITABLE: `.inplaceeditable`,\n LOCKCOLUMN: `[data-action=\"lock_column\"]`,\n LOCKBOARDCOLUMNS: `[data-action=\"lock_board_columns\"]`,\n MAIN: `.mod_kanban_main`,\n MOVECARDAFTERCARD: `.mod_kanban_move_card_aftercard`,\n MOVECARDCOLUMN: `.mod_kanban_move_card_column`,\n MOVEMODALTRIGGER: `[data-action=\"move_card\"]`,\n PUSHCARD: `[data-action=\"push_card\"]`,\n SAVEASTEMPLATE: `[data-action=\"create_template\"]`,\n SCROLLLEFT: `.mod_kanban_scroll_left button`,\n SCROLLRIGHT: `.mod_kanban_scroll_right button`,\n SHOWBOARD: `[data-action=\"show_board\"]`,\n SHOWHIDDEN: `[data-action=\"show_hidden\"]`,\n SHOWTEMPLATE: `[data-action=\"show_template\"]`,\n UNASSIGNSELF: `[data-action=\"unassign_self\"]`,\n UNASSIGNUSER: `[data-action=\"unassign_user\"]`,\n UNCOMPLETE: `[data-action=\"uncomplete_card\"]`,\n UNLOCKCOLUMN: `[data-action=\"unlock_column\"]`,\n UNLOCKBOARDCOLUMNS: `[data-action=\"unlock_board_columns\"]`,\n};"],"names":["ADDCARD","ADDCARDCONTAINER","ADDCARDFIRST","ADDCOLUMN","ADDCOLUMNCONTAINER","ADDCOLUMNFIRST","ASSIGNEES","ASSIGNSELF","ASSIGNUSER","ASSIGNEDUSER","BOARD","CARD","CARDNUMBER","COLUMN","COLUMNCONTAINER","COLUMNINNER","COMPLETE","COMPLETIONSTATE","CONTAINER","DELETEBOARD","DELETECARD","DELETECOLUMN","DELETEMESSAGE","DELETETEMPLATE","DESCRIPTIONMODAL","DESCRIPTIONMODALBODY","DESCRIPTIONMODALFOOTER","DESCRIPTIONMODALTITLE","DESCRIPTIONTOGGLE","DETAILBUTTON","DISCUSSION","DISCUSSIONINPUT","DISCUSSIONMESSAGES","DISCUSSIONMODAL","DISCUSSIONMODALTITLE","DISCUSSIONMODALTRIGGER","DISCUSSIONSEND","DISCUSSIONSHOW","DUEDATE","EDITDETAILS","HIDEHIDDEN","HISTORY","HISTORYITEMS","HISTORYMODAL","HISTORYMODALTRIGGER","INPLACEEDITABLE","LOCKCOLUMN","LOCKBOARDCOLUMNS","MAIN","MOVECARDAFTERCARD","MOVECARDCOLUMN","MOVEMODALTRIGGER","PUSHCARD","SAVEASTEMPLATE","SCROLLLEFT","SCROLLRIGHT","SHOWBOARD","SHOWHIDDEN","SHOWTEMPLATE","UNASSIGNSELF","UNASSIGNUSER","UNCOMPLETE","UNLOCKCOLUMN","UNLOCKBOARDCOLUMNS"],"mappings":"sKAGe,CACXA,mCACAC,iDACAC,yCACAC,uCACAC,qDACAC,6CACAC,kCACAC,yCACAC,yCACAC,yCACAC,0BACAC,wBACAC,qCACAC,4BACAC,+CACAC,uCACAC,yCACAC,8CACAC,yCACAC,2CACAC,yCACAC,6CACAC,+CACAC,iDACAC,2CACAC,iEACAC,qEACAC,mEACAC,4CACAC,+CACAC,oCACAC,+CACAC,qDACAC,+CACAC,iEACAC,wDACAC,yDACAC,iDACAC,8BACAC,2CACAC,yCACAC,8BACAC,yCACAC,yCACAC,mDACAC,mCACAC,yCACAC,sDACAC,wBACAC,oDACAC,8CACAC,6CACAC,qCACAC,iDACAC,4CACAC,8CACAC,uCACAC,yCACAC,6CACAC,6CACAC,6CACAC,6CACAC,6CACAC"} \ No newline at end of file +{"version":3,"file":"selectors.min.js","sources":["../src/selectors.js"],"sourcesContent":["/**\n * Selectors for mod_kanban.\n */\nexport default {\n ADDCARD: `[data-action=\"add_card\"]`,\n ADDCARDCONTAINER: `.mod_kanban_addcard_container`,\n ADDCARDFIRST: `.mod_kanban_addcard_first`,\n ADDCOLUMN: `[data-action=\"add_column\"]`,\n ADDCOLUMNCONTAINER: `.mod_kanban_addcolumn_container`,\n ADDCOLUMNFIRST: `.mod_kanban_addcolumn_first`,\n ASSIGNEES: `.mod_kanban_assignees`,\n ASSIGNSELF: `[data-action=\"assign_self\"]`,\n ASSIGNUSER: `[data-action=\"assign_user\"]`,\n ASSIGNEDUSER: `.mod_kanban_assigned_user`,\n BOARD: `.mod_kanban_board`,\n CARD: `.mod_kanban_card`,\n CARDNUMBER: `.mod_kanban_card_number`,\n COLUMN: `.mod_kanban_column`,\n COLUMNCONTAINER: `.mod_kanban_column_container`,\n COLUMNINNER: `.mod_kanban_column_inner`,\n COMPLETE: `[data-action=\"complete_card\"]`,\n COMPLETIONSTATE: `.mod_kanban_card_completion`,\n CONTAINER: `.mod_kanban_render_container`,\n DELETEBOARD: `[data-action=\"delete_board\"]`,\n DELETECARD: `[data-action=\"delete_card\"]`,\n DELETECOLUMN: `[data-action=\"delete_column\"]`,\n DELETEMESSAGE: `[data-action=\"delete_message\"]`,\n DELETETEMPLATE: `[data-action=\"delete_template\"]`,\n DESCRIPTIONMODAL: `.mod_kanban_description`,\n DESCRIPTIONMODALBODY: `.mod_kanban_description_modal .modal-body`,\n DESCRIPTIONMODALFOOTER: `.mod_kanban_description_modal .modal-footer`,\n DESCRIPTIONMODALTITLE: `.mod_kanban_description_modal .modal-title`,\n DESCRIPTIONTOGGLE: `.mod_kanban_description`,\n DETAILBUTTON: `.mod_kanban_detail_trigger`,\n DISCUSSION: `.mod_kanban_discussion`,\n DISCUSSIONINPUT: `.mod_kanban_discussion_input`,\n DISCUSSIONMESSAGES: `.mod_kanban_discussion_messages`,\n DISCUSSIONMODAL: `.mod_kanban_discussion_modal`,\n DISCUSSIONMODALTITLE: `.mod_kanban_discussion_modal .modal-title`,\n DISCUSSIONMODALTRIGGER: `.mod_kanban_discussion_trigger`,\n DISCUSSIONSEND: `[data-action=\"send_discussion_message\"]`,\n DISCUSSIONSHOW: `[data-action=\"show_discussion\"]`,\n DUEDATE: `.mod_kanban_duedate`,\n EDITDETAILS: `[data-action=\"edit_details\"]`,\n HIDEHIDDEN: `[data-action=\"hide_hidden\"]`,\n HISTORY: `.mod_kanban_history`,\n HISTORYITEMS: `.mod_kanban_history_items`,\n HISTORYMODAL: `.mod_kanban_history_modal`,\n HISTORYMODALTRIGGER: `[data-action=\"show_history\"]`,\n INPLACEEDITABLE: `.inplaceeditable`,\n LOCKCOLUMN: `[data-action=\"lock_column\"]`,\n LOCKBOARDCOLUMNS: `[data-action=\"lock_board_columns\"]`,\n MAIN: `.mod_kanban_main`,\n MOVECARDAFTERCARD: `.mod_kanban_move_card_aftercard`,\n MOVECARDCOLUMN: `.mod_kanban_move_card_column`,\n MOVEMODALTRIGGER: `[data-action=\"move_card\"]`,\n PUSHCARD: `[data-action=\"push_card\"]`,\n SAVEASTEMPLATE: `[data-action=\"create_template\"]`,\n SCROLLLEFT: `.mod_kanban_scroll_left button`,\n SCROLLRIGHT: `.mod_kanban_scroll_right button`,\n SHOWBOARD: `[data-action=\"show_board\"]`,\n SHOWHIDDEN: `[data-action=\"show_hidden\"]`,\n SHOWTEMPLATE: `[data-action=\"show_template\"]`,\n UNASSIGNSELF: `[data-action=\"unassign_self\"]`,\n UNASSIGNUSER: `[data-action=\"unassign_user\"]`,\n UNCOMPLETE: `[data-action=\"uncomplete_card\"]`,\n UNLOCKCOLUMN: `[data-action=\"unlock_column\"]`,\n UNLOCKBOARDCOLUMNS: `[data-action=\"unlock_board_columns\"]`,\n};"],"names":["ADDCARD","ADDCARDCONTAINER","ADDCARDFIRST","ADDCOLUMN","ADDCOLUMNCONTAINER","ADDCOLUMNFIRST","ASSIGNEES","ASSIGNSELF","ASSIGNUSER","ASSIGNEDUSER","BOARD","CARD","CARDNUMBER","COLUMN","COLUMNCONTAINER","COLUMNINNER","COMPLETE","COMPLETIONSTATE","CONTAINER","DELETEBOARD","DELETECARD","DELETECOLUMN","DELETEMESSAGE","DELETETEMPLATE","DESCRIPTIONMODAL","DESCRIPTIONMODALBODY","DESCRIPTIONMODALFOOTER","DESCRIPTIONMODALTITLE","DESCRIPTIONTOGGLE","DETAILBUTTON","DISCUSSION","DISCUSSIONINPUT","DISCUSSIONMESSAGES","DISCUSSIONMODAL","DISCUSSIONMODALTITLE","DISCUSSIONMODALTRIGGER","DISCUSSIONSEND","DISCUSSIONSHOW","DUEDATE","EDITDETAILS","HIDEHIDDEN","HISTORY","HISTORYITEMS","HISTORYMODAL","HISTORYMODALTRIGGER","INPLACEEDITABLE","LOCKCOLUMN","LOCKBOARDCOLUMNS","MAIN","MOVECARDAFTERCARD","MOVECARDCOLUMN","MOVEMODALTRIGGER","PUSHCARD","SAVEASTEMPLATE","SCROLLLEFT","SCROLLRIGHT","SHOWBOARD","SHOWHIDDEN","SHOWTEMPLATE","UNASSIGNSELF","UNASSIGNUSER","UNCOMPLETE","UNLOCKCOLUMN","UNLOCKBOARDCOLUMNS"],"mappings":"sKAGe,CACXA,mCACAC,iDACAC,yCACAC,uCACAC,qDACAC,6CACAC,kCACAC,yCACAC,yCACAC,yCACAC,0BACAC,wBACAC,qCACAC,4BACAC,+CACAC,uCACAC,yCACAC,8CACAC,yCACAC,2CACAC,yCACAC,6CACAC,+CACAC,iDACAC,2CACAC,iEACAC,qEACAC,mEACAC,4CACAC,0CACAC,oCACAC,+CACAC,qDACAC,+CACAC,iEACAC,wDACAC,yDACAC,iDACAC,8BACAC,2CACAC,yCACAC,8BACAC,yCACAC,yCACAC,mDACAC,mCACAC,yCACAC,sDACAC,wBACAC,oDACAC,8CACAC,6CACAC,qCACAC,iDACAC,4CACAC,8CACAC,uCACAC,yCACAC,6CACAC,6CACAC,6CACAC,6CACAC,6CACAC"} \ No newline at end of file diff --git a/amd/src/cardnumber.js b/amd/src/cardnumber.js index e5e3b5e8..07bdac0e 100644 --- a/amd/src/cardnumber.js +++ b/amd/src/cardnumber.js @@ -14,7 +14,7 @@ // along with Moodle. If not, see . /** - * Helper for card number filter + * Add event listener to card number to open card detail. * * @module mod_kanban/cardnumber * @copyright 2024 ISB Bayern @@ -26,7 +26,7 @@ export const init = (element) => { document.querySelectorAll('#' + element + ' .mod_kanban_card_number').forEach((el) => { el.addEventListener('click', (event) => { document.querySelector( - `.mod_kanban_card[data-number="${event.target.dataset.id}"] .mod_kanban_description_trigger` + `.mod_kanban_card[data-number="${event.target.dataset.id}"] .mod_kanban_detail_trigger` ).click(); }); }); diff --git a/amd/src/selectors.js b/amd/src/selectors.js index 221d6a31..a8b51b20 100644 --- a/amd/src/selectors.js +++ b/amd/src/selectors.js @@ -31,7 +31,7 @@ export default { DESCRIPTIONMODALFOOTER: `.mod_kanban_description_modal .modal-footer`, DESCRIPTIONMODALTITLE: `.mod_kanban_description_modal .modal-title`, DESCRIPTIONTOGGLE: `.mod_kanban_description`, - DETAILBUTTON: `.mod_kanban_description_trigger`, + DETAILBUTTON: `.mod_kanban_detail_trigger`, DISCUSSION: `.mod_kanban_discussion`, DISCUSSIONINPUT: `.mod_kanban_discussion_input`, DISCUSSIONMESSAGES: `.mod_kanban_discussion_messages`, diff --git a/classes/boardmanager.php b/classes/boardmanager.php index c9ca25c3..c8ec3498 100644 --- a/classes/boardmanager.php +++ b/classes/boardmanager.php @@ -921,7 +921,6 @@ public function update_card(int $cardid, array $data): void { ); } $cardupdate['canedit'] = $this->can_user_manage_specific_card($cardupdate['id']); - $this->formatter->put('cards', $cardupdate); $this->write_history( 'updated', @@ -931,6 +930,12 @@ public function update_card(int $cardid, array $data): void { $card['id'] ); helper::update_cached_timestamp($this->board->id, constants::MOD_KANBAN_CARD, $cardupdate['timemodified']); + + if ($this->board->usenumbers) { + $cardupdate['description'] = numberfilter::filter($cardupdate['description']); + } + + $this->formatter->put('cards', $cardupdate); } /** diff --git a/classes/numberfilter.php b/classes/numberfilter.php index b32e0e75..ac3a3d67 100644 --- a/classes/numberfilter.php +++ b/classes/numberfilter.php @@ -26,7 +26,8 @@ */ class numberfilter { /** - * Adds custom tags to card numbers in the text. + * Adds custom tags to card numbers in the text. This is used to allow handling a click on + * the number by JavaScript (to open the detail modal of the card). * * @param string $text * @return string diff --git a/templates/card.mustache b/templates/card.mustache index 03147fdf..4049b9db 100644 --- a/templates/card.mustache +++ b/templates/card.mustache @@ -65,7 +65,7 @@ - diff --git a/tests/numberfilter_test.php b/tests/numberfilter_test.php new file mode 100644 index 00000000..88ddfdb1 --- /dev/null +++ b/tests/numberfilter_test.php @@ -0,0 +1,44 @@ +. + +namespace mod_kanban; + +/** + * Tests for Kanban board number filter + * + * @package mod_kanban + * @category test + * @copyright 2024 ISB Bayern + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +final class numberfilter_test extends \advanced_testcase { + /** + * Test number filter + */ + public function test_filter() { + $text = 'This is a test #1234 and #5678'; + $expected = 'This is a test #1234 and #5678'; + $this->assertEquals($expected, numberfilter::filter($text)); + } + + /** + * Test number filter without numbers + */ + public function test_filter_without_numbers() { + $text = 'This is a test without numbers'; + $this->assertEquals($text, numberfilter::filter($text)); + } +}