diff --git a/amd/build/snippetsdetailsmodal.min.js b/amd/build/snippetsdetailsmodal.min.js index 97407fc2243..c2c115f3441 100644 --- a/amd/build/snippetsdetailsmodal.min.js +++ b/amd/build/snippetsdetailsmodal.min.js @@ -6,6 +6,6 @@ define("theme_boost_union/snippetsdetailsmodal",["exports","core/modal_cancel"," * @copyright 2024 Alexander Bias, lern.link GmbH * based on core_admin/themeselector/preview_modal by David Woloszyn * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modal_cancel=_interopRequireDefault(_modal_cancel),_notification=_interopRequireDefault(_notification),_templates=_interopRequireDefault(_templates);const SELECTORS_DETAILS='[data-action="details"]';_exports.init=()=>{registerListenerEvents()};const registerListenerEvents=()=>{document.addEventListener("click",(e=>{const details=e.target.closest(SELECTORS_DETAILS);details&&buildModal(details).catch(_notification.default.exception)}))},buildModal=async element=>{const data={title:element.getAttribute("data-title"),description:element.getAttribute("data-description"),image:element.getAttribute("data-image"),source_badge:element.getAttribute("data-source-badge"),goal_badge:element.getAttribute("data-goal-badge"),scope_badge:element.getAttribute("data-scope-badge"),creator:element.getAttribute("data-creator"),usagenote:element.getAttribute("data-usagenote"),id:element.getAttribute("data-id"),code:element.getAttribute("data-code")};await _modal_cancel.default.create({title:data.title,body:_templates.default.render("theme_boost_union/snippetsdetailsmodal",data),large:!0,buttons:{cancel:(0,_str.getString)("closebuttontitle","moodle")},show:!0})}})); + */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modal_cancel=_interopRequireDefault(_modal_cancel),_notification=_interopRequireDefault(_notification),_templates=_interopRequireDefault(_templates);const SELECTORS_DETAILS='[data-action="details"]';_exports.init=()=>{registerListenerEvents()};const registerListenerEvents=()=>{document.addEventListener("click",(e=>{const details=e.target.closest(SELECTORS_DETAILS);details&&buildModal(details).catch(_notification.default.exception)}))},buildModal=async element=>{const data={title:element.getAttribute("data-title"),description:element.getAttribute("data-description"),image:element.getAttribute("data-image"),sourcebadge:element.getAttribute("data-source-badge"),goalbadge:element.getAttribute("data-goal-badge"),scopebadge:element.getAttribute("data-scope-badge"),creator:element.getAttribute("data-creator"),usagenote:element.getAttribute("data-usagenote"),id:element.getAttribute("data-id"),code:element.getAttribute("data-code")};await _modal_cancel.default.create({title:data.title,body:_templates.default.render("theme_boost_union/snippetsdetailsmodal",data),large:!0,buttons:{cancel:(0,_str.getString)("closebuttontitle","moodle")},show:!0})}})); //# sourceMappingURL=snippetsdetailsmodal.min.js.map \ No newline at end of file diff --git a/amd/build/snippetsdetailsmodal.min.js.map b/amd/build/snippetsdetailsmodal.min.js.map index df2c4d99854..8aeb014328f 100644 --- a/amd/build/snippetsdetailsmodal.min.js.map +++ b/amd/build/snippetsdetailsmodal.min.js.map @@ -1 +1 @@ -{"version":3,"file":"snippetsdetailsmodal.min.js","sources":["../src/snippetsdetailsmodal.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 * Theme Boost Union - JS code for snippets details modal.\n *\n * @module theme_boost_union/snippetsdetailsmodal\n * @copyright 2024 Alexander Bias, lern.link GmbH \n * based on core_admin/themeselector/preview_modal by David Woloszyn \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalCancel from 'core/modal_cancel';\nimport Notification from 'core/notification';\nimport Templates from 'core/templates';\nimport {getString} from 'core/str';\n\nconst SELECTORS = {\n SNIPPETS_CONTAINER: 'theme_boost_union_snippets',\n DETAILS: '[data-action=\"details\"]',\n};\n\n/**\n * Entrypoint of the js.\n *\n * @method init\n */\nexport const init = () => {\n registerListenerEvents();\n};\n\n/**\n * Register snippet related event listeners.\n *\n * @method registerListenerEvents\n */\nconst registerListenerEvents = () => {\n document.addEventListener('click', (e) => {\n const details = e.target.closest(SELECTORS.DETAILS);\n if (details) {\n buildModal(details).catch(Notification.exception);\n }\n });\n};\n\n/**\n * Build the modal with the provided data.\n *\n * @method buildModal\n * @param {object} element\n */\nconst buildModal = async(element) => {\n\n // Prepare data for modal.\n const data = {\n title: element.getAttribute('data-title'),\n description: element.getAttribute('data-description'),\n image: element.getAttribute('data-image'),\n source_badge: element.getAttribute('data-source-badge'),\n goal_badge: element.getAttribute('data-goal-badge'),\n scope_badge: element.getAttribute('data-scope-badge'),\n creator: element.getAttribute('data-creator'),\n usagenote: element.getAttribute('data-usagenote'),\n id: element.getAttribute('data-id'),\n code: element.getAttribute('data-code'),\n };\n\n await ModalCancel.create({\n title: data.title,\n body: Templates.render('theme_boost_union/snippetsdetailsmodal', data),\n large: true,\n buttons: {\n 'cancel': getString('closebuttontitle', 'moodle'),\n },\n show: true,\n });\n};\n"],"names":["_interopRequireDefault","e","__esModule","default","_modal_cancel","_notification","_templates","SELECTORS","_exports","init","registerListenerEvents","document","addEventListener","details","target","closest","buildModal","catch","Notification","exception","async","data","title","element","getAttribute","description","image","source_badge","goal_badge","scope_badge","creator","usagenote","id","code","ModalCancel","create","body","Templates","render","large","buttons","cancel","getString","show"],"mappings":"gMA0BuC,SAAAA,uBAAAC,GAAAA,OAAAA,GAAAA,EAAAC,WAAAD,EAAAE,CAAAA,QAAAF,EAAA;;;;;;;;kFAFvCG,cAAAJ,uBAAAI,eACAC,cAAAL,uBAAAK,eACAC,WAAAN,uBAAAM,YAGA,MAAMC,kBAEO,0BAUXC,SAAAC,KAFkBA,KAChBC,wBAAwB,EAQ5B,MAAMA,uBAAyBA,KAC3BC,SAASC,iBAAiB,SAAUX,IAChC,MAAMY,QAAUZ,EAAEa,OAAOC,QAAQR,mBAC7BM,SACAG,WAAWH,SAASI,MAAMC,cAAAA,QAAaC,UAC3C,GACF,EASAH,WAAaI,gBAGf,MAAMC,KAAO,CACTC,MAAOC,QAAQC,aAAa,cAC5BC,YAAaF,QAAQC,aAAa,oBAClCE,MAAOH,QAAQC,aAAa,cAC5BG,aAAcJ,QAAQC,aAAa,qBACnCI,WAAYL,QAAQC,aAAa,mBACjCK,YAAaN,QAAQC,aAAa,oBAClCM,QAASP,QAAQC,aAAa,gBAC9BO,UAAWR,QAAQC,aAAa,kBAChCQ,GAAIT,QAAQC,aAAa,WACzBS,KAAMV,QAAQC,aAAa,oBAGzBU,cAAAA,QAAYC,OAAO,CACrBb,MAAOD,KAAKC,MACZc,KAAMC,mBAAUC,OAAO,yCAA0CjB,MACjEkB,OAAO,EACPC,QAAS,CACLC,QAAU,EAAAC,KAAAA,WAAU,mBAAoB,WAE5CC,MAAM,GACR,CACJ"} \ No newline at end of file +{"version":3,"file":"snippetsdetailsmodal.min.js","sources":["../src/snippetsdetailsmodal.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 * Theme Boost Union - JS code for snippets details modal.\n *\n * @module theme_boost_union/snippetsdetailsmodal\n * @copyright 2024 Alexander Bias, lern.link GmbH \n * based on core_admin/themeselector/preview_modal by David Woloszyn \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalCancel from 'core/modal_cancel';\nimport Notification from 'core/notification';\nimport Templates from 'core/templates';\nimport {getString} from 'core/str';\n\nconst SELECTORS = {\n SNIPPETS_CONTAINER: 'theme_boost_union_snippets',\n DETAILS: '[data-action=\"details\"]',\n};\n\n/**\n * Entrypoint of the js.\n *\n * @method init\n */\nexport const init = () => {\n registerListenerEvents();\n};\n\n/**\n * Register snippet related event listeners.\n *\n * @method registerListenerEvents\n */\nconst registerListenerEvents = () => {\n document.addEventListener('click', (e) => {\n const details = e.target.closest(SELECTORS.DETAILS);\n if (details) {\n buildModal(details).catch(Notification.exception);\n }\n });\n};\n\n/**\n * Build the modal with the provided data.\n *\n * @method buildModal\n * @param {object} element\n */\nconst buildModal = async(element) => {\n\n // Prepare data for modal.\n const data = {\n title: element.getAttribute('data-title'),\n description: element.getAttribute('data-description'),\n image: element.getAttribute('data-image'),\n sourcebadge: element.getAttribute('data-source-badge'),\n goalbadge: element.getAttribute('data-goal-badge'),\n scopebadge: element.getAttribute('data-scope-badge'),\n creator: element.getAttribute('data-creator'),\n usagenote: element.getAttribute('data-usagenote'),\n id: element.getAttribute('data-id'),\n code: element.getAttribute('data-code'),\n };\n\n await ModalCancel.create({\n title: data.title,\n body: Templates.render('theme_boost_union/snippetsdetailsmodal', data),\n large: true,\n buttons: {\n 'cancel': getString('closebuttontitle', 'moodle'),\n },\n show: true,\n });\n};\n"],"names":["_interopRequireDefault","e","__esModule","default","_modal_cancel","_notification","_templates","SELECTORS","_exports","init","registerListenerEvents","document","addEventListener","details","target","closest","buildModal","catch","Notification","exception","async","data","title","element","getAttribute","description","image","sourcebadge","goalbadge","scopebadge","creator","usagenote","id","code","ModalCancel","create","body","Templates","render","large","buttons","cancel","getString","show"],"mappings":"gMA0BuC,SAAAA,uBAAAC,GAAAA,OAAAA,GAAAA,EAAAC,WAAAD,EAAAE,CAAAA,QAAAF,EAAA;;;;;;;;kFAFvCG,cAAAJ,uBAAAI,eACAC,cAAAL,uBAAAK,eACAC,WAAAN,uBAAAM,YAGA,MAAMC,kBAEO,0BAUXC,SAAAC,KAFkBA,KAChBC,wBAAwB,EAQ5B,MAAMA,uBAAyBA,KAC3BC,SAASC,iBAAiB,SAAUX,IAChC,MAAMY,QAAUZ,EAAEa,OAAOC,QAAQR,mBAC7BM,SACAG,WAAWH,SAASI,MAAMC,cAAAA,QAAaC,UAC3C,GACF,EASAH,WAAaI,gBAGf,MAAMC,KAAO,CACTC,MAAOC,QAAQC,aAAa,cAC5BC,YAAaF,QAAQC,aAAa,oBAClCE,MAAOH,QAAQC,aAAa,cAC5BG,YAAaJ,QAAQC,aAAa,qBAClCI,UAAWL,QAAQC,aAAa,mBAChCK,WAAYN,QAAQC,aAAa,oBACjCM,QAASP,QAAQC,aAAa,gBAC9BO,UAAWR,QAAQC,aAAa,kBAChCQ,GAAIT,QAAQC,aAAa,WACzBS,KAAMV,QAAQC,aAAa,oBAGzBU,cAAAA,QAAYC,OAAO,CACrBb,MAAOD,KAAKC,MACZc,KAAMC,mBAAUC,OAAO,yCAA0CjB,MACjEkB,OAAO,EACPC,QAAS,CACLC,QAAU,EAAAC,KAAAA,WAAU,mBAAoB,WAE5CC,MAAM,GACR,CACJ"} \ No newline at end of file diff --git a/amd/src/snippetsdetailsmodal.js b/amd/src/snippetsdetailsmodal.js index 599192ec876..c22e057ef65 100644 --- a/amd/src/snippetsdetailsmodal.js +++ b/amd/src/snippetsdetailsmodal.js @@ -68,9 +68,9 @@ const buildModal = async(element) => { title: element.getAttribute('data-title'), description: element.getAttribute('data-description'), image: element.getAttribute('data-image'), - source_badge: element.getAttribute('data-source-badge'), - goal_badge: element.getAttribute('data-goal-badge'), - scope_badge: element.getAttribute('data-scope-badge'), + sourcebadge: element.getAttribute('data-source-badge'), + goalbadge: element.getAttribute('data-goal-badge'), + scopebadge: element.getAttribute('data-scope-badge'), creator: element.getAttribute('data-creator'), usagenote: element.getAttribute('data-usagenote'), id: element.getAttribute('data-id'), diff --git a/templates/snippetsdetailsmodal.mustache b/templates/snippetsdetailsmodal.mustache index 105d56dc128..19568dc09c4 100644 --- a/templates/snippetsdetailsmodal.mustache +++ b/templates/snippetsdetailsmodal.mustache @@ -20,9 +20,9 @@ { "description": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.", "image": "https://raw.githubusercontent.com/moodle-an-hochschulen/moodle-theme_boost_union/main/pix/screenshot.png", - "goal_badge": "Bugfix", - "scope_badge": "Global", - "source_badge": "Boost Union built-in", + "goalbadge": "Bugfix", + "scopebadge": "Global", + "sourcebadge": "Boost Union built-in", "code": "body { color: red; }", "id": 42 } @@ -55,24 +55,24 @@ {{{creator}}} {{/creator}} - {{#source_badge}} + {{#sourcebadge}} {{#str}}snippetssource, theme_boost_union{{/str}} - {{{source_badge}}} + {{{sourcebadge}}} - {{/source_badge}} - {{#goal_badge}} + {{/sourcebadge}} + {{#goalbadge}} {{#str}}snippetsgoal, theme_boost_union{{/str}} - {{{goal_badge}}} + {{{goalbadge}}} - {{/goal_badge}} - {{#scope_badge}} + {{/goalbadge}} + {{#scopebadge}} {{#str}}snippetsscope, theme_boost_union{{/str}} - {{{scope_badge}}} + {{{scopebadge}}} - {{/scope_badge}} + {{/scopebadge}} {{#code}}