mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
Merge branch 'MDL-79079' of https://github.com/paulholden/moodle
This commit is contained in:
commit
7b94cd0a4b
2
grade/amd/build/edittree_index.min.js
vendored
2
grade/amd/build/edittree_index.min.js
vendored
@ -5,6 +5,6 @@ define("core_grades/edittree_index",["exports","core/localstorage","core/loading
|
||||
* @module core_grades/edittree_index
|
||||
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_localstorage=_interopRequireDefault(_localstorage),_notification=_interopRequireDefault(_notification),_pending=_interopRequireDefault(_pending);const SELECTORS_CATEGORY_TOGGLE=".toggle-category",SELECTORS_GRADEBOOK_SETUP_TABLE=".setup-grades",SELECTORS_WEIGHT_OVERRIDE_CHECKBOX=".weightoverride",SELECTORS_BULK_MOVE_SELECT="#menumoveafter",SELECTORS_BULK_MOVE_INPUT="#bulkmoveinput",SELECTORS_GRADEBOOK_SETUP_WRAPPER=".gradetree-wrapper",SELECTORS_GRADEBOOK_SETUP_BOX=".gradetreebox",toggleWeightInput=weightOverrideCheckbox=>{const row=weightOverrideCheckbox.closest("tr"),itemId=row.dataset.itemid;row.querySelector('input[name="weight_'.concat(itemId,'"]')).disabled=!weightOverrideCheckbox.checked},submitBulkMoveForm=bulkMoveSelect=>{const form=bulkMoveSelect.closest("form");form.querySelector(SELECTORS_BULK_MOVE_INPUT).value=1,form.submit()},toggleCategory=(toggleElement,courseId,userId,storeCollapsedState)=>{const target=toggleElement.dataset.target,category=toggleElement.dataset.category,isCollapsing="true"===toggleElement.getAttribute("aria-expanded"),gradebookSetup=toggleElement.closest(SELECTORS_GRADEBOOK_SETUP_TABLE),targetRows=gradebookSetup.querySelectorAll(target),maxGradeCell=toggleElement.closest("tr").querySelector(".column-range");if(isCollapsing){if(toggleElement.setAttribute("aria-expanded","false"),toggleElement.dataset.target="[data-hidden-by='".concat(category,"']"),maxGradeCell){const relatedCategoryAggregationRow=gradebookSetup.querySelector("[data-aggregationforcategory='".concat(category,"']"));maxGradeCell.innerHTML=relatedCategoryAggregationRow.querySelector(".column-range").innerHTML}}else toggleElement.setAttribute("aria-expanded","true"),toggleElement.dataset.target=".".concat(category,"[data-hidden='false']"),maxGradeCell&&(maxGradeCell.innerHTML="");storeCollapsedState&&((category,courseId,userId,isCollapsing)=>{const currentStoredCollapsedCategories=_localstorage.default.get("core_grade_collapsedgradecategories_".concat(courseId,"_").concat(userId));let collapsedCategories=currentStoredCollapsedCategories?JSON.parse(currentStoredCollapsedCategories):[];isCollapsing?collapsedCategories.push(category):collapsedCategories=collapsedCategories.filter((cat=>cat!==category)),_localstorage.default.set("core_grade_collapsedgradecategories_".concat(courseId,"_").concat(userId),JSON.stringify(collapsedCategories))})(category,courseId,userId,isCollapsing),targetRows.forEach((row=>{isCollapsing?(row.dataset.hidden="true",row.dataset.hiddenBy=category):(row.dataset.hidden="false",row.dataset.hiddenBy="")})),updateParentCategoryRowspans(toggleElement,targetRows.length)},updateParentCategoryRowspans=(toggleElement,num)=>{const gradebookSetup=toggleElement.closest(SELECTORS_GRADEBOOK_SETUP_TABLE);toggleElement.closest("tr").classList.forEach((className=>{const parentCategoryToggleElement=gradebookSetup.querySelector('[data-target=".'.concat(className,"[data-hidden='false']\""));if(parentCategoryToggleElement){const categoryRowSpanElement=parentCategoryToggleElement.closest("tr").nextElementSibling.querySelector("[rowspan]");"true"===toggleElement.getAttribute("aria-expanded")?categoryRowSpanElement.rowSpan=categoryRowSpanElement.rowSpan+num:categoryRowSpanElement.rowSpan=categoryRowSpanElement.rowSpan-num}}))};_exports.init=(courseId,userId)=>{const pendingPromise=new _pending.default,gradebookSetupBox=document.querySelector(SELECTORS_GRADEBOOK_SETUP_BOX);(0,_loadingicon.addIconToContainer)(gradebookSetupBox).then((loader=>{setTimeout((()=>{((courseId,userId)=>{const gradebookSetup=document.querySelector(SELECTORS_GRADEBOOK_SETUP_TABLE),storedCollapsedCategories=_localstorage.default.get("core_grade_collapsedgradecategories_".concat(courseId,"_").concat(userId));storedCollapsedCategories&&JSON.parse(storedCollapsedCategories).forEach((category=>{const categoryToggleElement=gradebookSetup.querySelector("".concat(SELECTORS_CATEGORY_TOGGLE,'[data-category="').concat(category,'"'));categoryToggleElement&&toggleCategory(categoryToggleElement,courseId,userId,!1)}))})(courseId,userId),loader.remove(),document.querySelector(SELECTORS_GRADEBOOK_SETUP_WRAPPER).classList.remove("d-none"),pendingPromise.resolve()}),150)})).fail(_notification.default.exception),((courseId,userId)=>{document.addEventListener("change",(e=>{e.target.matches(SELECTORS_WEIGHT_OVERRIDE_CHECKBOX)&&toggleWeightInput(e.target),e.target.matches(SELECTORS_BULK_MOVE_SELECT)&&submitBulkMoveForm(e.target)})),document.querySelector(SELECTORS_GRADEBOOK_SETUP_TABLE).addEventListener("click",(e=>{const toggle=e.target.closest(SELECTORS_CATEGORY_TOGGLE);toggle&&toggleCategory(toggle,courseId,userId,!0)}))})(courseId,userId)}}));
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_localstorage=_interopRequireDefault(_localstorage),_notification=_interopRequireDefault(_notification),_pending=_interopRequireDefault(_pending);const SELECTORS_CATEGORY_TOGGLE=".toggle-category",SELECTORS_GRADEBOOK_SETUP_TABLE=".setup-grades",SELECTORS_WEIGHT_OVERRIDE_CHECKBOX=".weightoverride",SELECTORS_BULK_MOVE_SELECT="#menumoveafter",SELECTORS_BULK_MOVE_INPUT="#bulkmoveinput",SELECTORS_GRADEBOOK_SETUP_WRAPPER=".gradetree-wrapper",SELECTORS_GRADEBOOK_SETUP_BOX=".gradetreebox",toggleWeightInput=weightOverrideCheckbox=>{const row=weightOverrideCheckbox.closest("tr"),itemId=row.dataset.itemid;row.querySelector('input[name="weight_'.concat(itemId,'"]')).disabled=!weightOverrideCheckbox.checked},submitBulkMoveForm=bulkMoveSelect=>{const form=bulkMoveSelect.closest("form");form.querySelector(SELECTORS_BULK_MOVE_INPUT).value=1,form.submit()},toggleCategory=(toggleElement,courseId,userId,storeCollapsedState)=>{const target=toggleElement.dataset.target,category=toggleElement.dataset.category,isCollapsing="true"===toggleElement.getAttribute("aria-expanded"),gradebookSetup=toggleElement.closest(SELECTORS_GRADEBOOK_SETUP_TABLE),targetRows=gradebookSetup.querySelectorAll(target),maxGradeCell=toggleElement.closest("tr").querySelector(".column-range");if(isCollapsing){if(toggleElement.setAttribute("aria-expanded","false"),toggleElement.dataset.target="[data-hidden-by='".concat(category,"']"),maxGradeCell){const relatedCategoryAggregationRow=gradebookSetup.querySelector("[data-aggregationforcategory='".concat(category,"']"));maxGradeCell.innerHTML=relatedCategoryAggregationRow.querySelector(".column-range").innerHTML}}else toggleElement.setAttribute("aria-expanded","true"),toggleElement.dataset.target=".".concat(category,"[data-hidden='false']"),maxGradeCell&&(maxGradeCell.innerHTML="");storeCollapsedState&&((category,courseId,userId,isCollapsing)=>{const currentStoredCollapsedCategories=_localstorage.default.get("core_grade_collapsedgradecategories_".concat(courseId,"_").concat(userId));let collapsedCategories=currentStoredCollapsedCategories?JSON.parse(currentStoredCollapsedCategories):[];isCollapsing?collapsedCategories.push(category):collapsedCategories=collapsedCategories.filter((cat=>cat!==category)),_localstorage.default.set("core_grade_collapsedgradecategories_".concat(courseId,"_").concat(userId),JSON.stringify(collapsedCategories))})(category,courseId,userId,isCollapsing),targetRows.forEach((row=>{isCollapsing?(row.dataset.hidden="true",row.dataset.hiddenBy=category):(row.dataset.hidden="false",row.dataset.hiddenBy="")})),updateParentCategoryRowspans(toggleElement,targetRows.length)},updateParentCategoryRowspans=(toggleElement,num)=>{const gradebookSetup=toggleElement.closest(SELECTORS_GRADEBOOK_SETUP_TABLE);toggleElement.closest("tr").classList.forEach((className=>{const parentCategoryToggleElement=gradebookSetup.querySelector('[data-target=".'.concat(className,"[data-hidden='false']\""));if(parentCategoryToggleElement){const categoryRowSpanElement=parentCategoryToggleElement.closest("tr").nextElementSibling.querySelector("[rowspan]");"true"===toggleElement.getAttribute("aria-expanded")?categoryRowSpanElement.rowSpan=categoryRowSpanElement.rowSpan+num:categoryRowSpanElement.rowSpan=categoryRowSpanElement.rowSpan-num}}))};_exports.init=(courseId,userId)=>{const pendingPromise=new _pending.default,gradebookSetupBox=document.querySelector(SELECTORS_GRADEBOOK_SETUP_BOX);(0,_loadingicon.addIconToContainer)(gradebookSetupBox).then((loader=>{setTimeout((()=>{((courseId,userId)=>{const gradebookSetup=document.querySelector(SELECTORS_GRADEBOOK_SETUP_TABLE),storedCollapsedCategories=_localstorage.default.get("core_grade_collapsedgradecategories_".concat(courseId,"_").concat(userId));storedCollapsedCategories&&JSON.parse(storedCollapsedCategories).forEach((category=>{const categoryToggleElement=gradebookSetup.querySelector("".concat(SELECTORS_CATEGORY_TOGGLE,'[data-category="').concat(category,'"'));categoryToggleElement&&toggleCategory(categoryToggleElement,courseId,userId,!1)}))})(courseId,userId),loader.remove(),document.querySelector(SELECTORS_GRADEBOOK_SETUP_WRAPPER).classList.remove("d-none"),pendingPromise.resolve()}),150)})).fail(_notification.default.exception),((courseId,userId)=>{document.addEventListener("change",(e=>{e.target.matches(SELECTORS_WEIGHT_OVERRIDE_CHECKBOX)&&toggleWeightInput(e.target),e.target.matches(SELECTORS_BULK_MOVE_SELECT)&&submitBulkMoveForm(e.target)})),document.querySelector(SELECTORS_GRADEBOOK_SETUP_TABLE).addEventListener("click",(e=>{const toggle=e.target.closest(SELECTORS_CATEGORY_TOGGLE);toggle&&(e.preventDefault(),toggleCategory(toggle,courseId,userId,!0))}))})(courseId,userId)}}));
|
||||
|
||||
//# sourceMappingURL=edittree_index.min.js.map
|
File diff suppressed because one or more lines are too long
@ -62,6 +62,7 @@ const registerListenerEvents = (courseId, userId) => {
|
||||
const toggle = e.target.closest(SELECTORS.CATEGORY_TOGGLE);
|
||||
// Collapse or expand the grade category when the visibility toggle button is activated.
|
||||
if (toggle) {
|
||||
e.preventDefault();
|
||||
toggleCategory(toggle, courseId, userId, true);
|
||||
}
|
||||
});
|
||||
|
@ -6,6 +6,6 @@ define("gradereport_user/gradecategorytoggle",["exports"],(function(_exports){Ob
|
||||
* @copyright 2022 Mihail Geshoski <mihail@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
const SELECTORS_CATEGORY_TOGGLE=".toggle-category",SELECTORS_USER_REPORT_TABLE=".user-grade",toggleCategory=toggleElement=>{const target=toggleElement.dataset.target,categoryId=toggleElement.dataset.categoryid,isCollapsing="true"===toggleElement.getAttribute("aria-expanded"),targetRows=toggleElement.closest(SELECTORS_USER_REPORT_TABLE).querySelectorAll(target);isCollapsing?(toggleElement.setAttribute("aria-expanded","false"),toggleElement.dataset.target="[data-hidden-by='".concat(categoryId,"']")):(toggleElement.setAttribute("aria-expanded","true"),toggleElement.dataset.target=".cat_".concat(categoryId,"[data-hidden='false']")),targetRows.forEach((row=>{isCollapsing?(row.dataset.hidden="true",row.dataset.hiddenBy=categoryId):(row.dataset.hidden="false",row.dataset.hiddenBy="")})),updateParentCategoryRowspans(toggleElement,targetRows.length)},updateParentCategoryRowspans=(toggleElement,num)=>{const userReport=toggleElement.closest(SELECTORS_USER_REPORT_TABLE);toggleElement.closest("tr").classList.forEach((className=>{const parentCategoryToggleElement=userReport.querySelector('[data-target=".'.concat(className,"[data-hidden='false']\""));if(parentCategoryToggleElement){const categoryRowSpanElement=parentCategoryToggleElement.closest("tr").nextElementSibling.querySelector("[rowspan]");"true"===toggleElement.getAttribute("aria-expanded")?categoryRowSpanElement.rowSpan=categoryRowSpanElement.rowSpan+num:categoryRowSpanElement.rowSpan=categoryRowSpanElement.rowSpan-num}}))};_exports.init=userReportId=>{(userReportId=>{document.querySelector("#"+userReportId).querySelector(SELECTORS_USER_REPORT_TABLE).addEventListener("click",(e=>{const toggle=e.target.closest(SELECTORS_CATEGORY_TOGGLE);toggle&&toggleCategory(toggle)}))})(userReportId)}}));
|
||||
const SELECTORS_CATEGORY_TOGGLE=".toggle-category",SELECTORS_USER_REPORT_TABLE=".user-grade",toggleCategory=toggleElement=>{const target=toggleElement.dataset.target,categoryId=toggleElement.dataset.categoryid,isCollapsing="true"===toggleElement.getAttribute("aria-expanded"),targetRows=toggleElement.closest(SELECTORS_USER_REPORT_TABLE).querySelectorAll(target);isCollapsing?(toggleElement.setAttribute("aria-expanded","false"),toggleElement.dataset.target="[data-hidden-by='".concat(categoryId,"']")):(toggleElement.setAttribute("aria-expanded","true"),toggleElement.dataset.target=".cat_".concat(categoryId,"[data-hidden='false']")),targetRows.forEach((row=>{isCollapsing?(row.dataset.hidden="true",row.dataset.hiddenBy=categoryId):(row.dataset.hidden="false",row.dataset.hiddenBy="")})),updateParentCategoryRowspans(toggleElement,targetRows.length)},updateParentCategoryRowspans=(toggleElement,num)=>{const userReport=toggleElement.closest(SELECTORS_USER_REPORT_TABLE);toggleElement.closest("tr").classList.forEach((className=>{const parentCategoryToggleElement=userReport.querySelector('[data-target=".'.concat(className,"[data-hidden='false']\""));if(parentCategoryToggleElement){const categoryRowSpanElement=parentCategoryToggleElement.closest("tr").nextElementSibling.querySelector("[rowspan]");"true"===toggleElement.getAttribute("aria-expanded")?categoryRowSpanElement.rowSpan=categoryRowSpanElement.rowSpan+num:categoryRowSpanElement.rowSpan=categoryRowSpanElement.rowSpan-num}}))};_exports.init=userReportId=>{(userReportId=>{document.querySelector("#"+userReportId).querySelector(SELECTORS_USER_REPORT_TABLE).addEventListener("click",(e=>{const toggle=e.target.closest(SELECTORS_CATEGORY_TOGGLE);toggle&&(e.preventDefault(),toggleCategory(toggle))}))})(userReportId)}}));
|
||||
|
||||
//# sourceMappingURL=gradecategorytoggle.min.js.map
|
File diff suppressed because one or more lines are too long
@ -40,6 +40,7 @@ const registerListenerEvents = (userReportId) => {
|
||||
const toggle = e.target.closest(SELECTORS.CATEGORY_TOGGLE);
|
||||
|
||||
if (toggle) {
|
||||
e.preventDefault();
|
||||
toggleCategory(toggle);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user