mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
Merge branch 'MDL-82478-main' of https://github.com/aanabit/moodle
This commit is contained in:
commit
83a031e39f
6 changed files with 41 additions and 18 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -596,17 +596,31 @@ export default class extends BaseComponent {
|
||||||
|
|
||||||
let bodyText = null;
|
let bodyText = null;
|
||||||
let titleText = null;
|
let titleText = null;
|
||||||
|
let delegatedsection = null;
|
||||||
if (cmIds.length == 1) {
|
if (cmIds.length == 1) {
|
||||||
const cmInfo = this.reactive.get('cm', cmIds[0]);
|
const cmInfo = this.reactive.get('cm', cmIds[0]);
|
||||||
titleText = getString('cmdelete_title', 'core_courseformat');
|
if (cmInfo.hasdelegatedsection) {
|
||||||
bodyText = getString(
|
delegatedsection = cmInfo.delegatesectionid;
|
||||||
'cmdelete_info',
|
titleText = this.reactive.getFormatString('cmdelete_subsectiontitle');
|
||||||
'core_courseformat',
|
bodyText = getString(
|
||||||
{
|
'sectiondelete_info',
|
||||||
type: cmInfo.modname,
|
'core_courseformat',
|
||||||
name: cmInfo.name,
|
{
|
||||||
}
|
type: cmInfo.modname,
|
||||||
);
|
name: cmInfo.name,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
titleText = this.reactive.getFormatString('cmdelete_title');
|
||||||
|
bodyText = getString(
|
||||||
|
'cmdelete_info',
|
||||||
|
'core_courseformat',
|
||||||
|
{
|
||||||
|
type: cmInfo.modname,
|
||||||
|
name: cmInfo.name,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
titleText = getString('cmsdelete_title', 'core_courseformat');
|
titleText = getString('cmsdelete_title', 'core_courseformat');
|
||||||
bodyText = getString(
|
bodyText = getString(
|
||||||
|
@ -628,6 +642,13 @@ export default class extends BaseComponent {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
modal.destroy();
|
modal.destroy();
|
||||||
this.reactive.dispatch('cmDelete', cmIds);
|
this.reactive.dispatch('cmDelete', cmIds);
|
||||||
|
if (cmIds.length == 1 && delegatedsection && target.baseURI.includes('section.php')) {
|
||||||
|
// Redirect to the course main page if the subsection is the current page.
|
||||||
|
let parameters = new URLSearchParams(window.location.search);
|
||||||
|
if (parameters.has('id') && parameters.get('id') == delegatedsection) {
|
||||||
|
this._dispatchSectionDelete([delegatedsection], target);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,8 +184,7 @@ class delegatedcontrolmenu extends basecontrolmenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes the module.
|
// Delete deletes the module.
|
||||||
// Only show the delete link if we are not already in the section view page.
|
if ($hasmanageactivities) {
|
||||||
if (!$isheadersection && $hasmanageactivities) {
|
|
||||||
$url = clone($cmbaseurl);
|
$url = clone($cmbaseurl);
|
||||||
$url->param('delete', $cm->id);
|
$url->param('delete', $cm->id);
|
||||||
$url->param('sr', $cm->sectionnum);
|
$url->param('sr', $cm->sectionnum);
|
||||||
|
|
|
@ -51,6 +51,7 @@ $string['cm_stealth_feedback_batch'] = 'The selected {$a->count} activities are
|
||||||
$string['cm_visiblegroups_feedback'] = '{$a->name} group mode changed to Visible groups.';
|
$string['cm_visiblegroups_feedback'] = '{$a->name} group mode changed to Visible groups.';
|
||||||
$string['cmavailability'] = 'Activity availability';
|
$string['cmavailability'] = 'Activity availability';
|
||||||
$string['cmdelete_info'] = 'This will delete {$a->name} and any user data it contains.';
|
$string['cmdelete_info'] = 'This will delete {$a->name} and any user data it contains.';
|
||||||
|
$string['cmdelete_subsectiontitle'] = 'Delete subsection?';
|
||||||
$string['cmdelete_title'] = 'Delete activity?';
|
$string['cmdelete_title'] = 'Delete activity?';
|
||||||
$string['cmmove_info'] = 'Move {$a} after';
|
$string['cmmove_info'] = 'Move {$a} after';
|
||||||
$string['cmmove_subsectiontitle'] = 'Move subsection';
|
$string['cmmove_subsectiontitle'] = 'Move subsection';
|
||||||
|
|
|
@ -37,8 +37,7 @@ Feature: The module menu replaces the delegated section menu
|
||||||
# Duplicate is not implemented yet.
|
# Duplicate is not implemented yet.
|
||||||
And I should not see "Duplicate"
|
And I should not see "Duplicate"
|
||||||
And I should see "Hide"
|
And I should see "Hide"
|
||||||
# Delete option for subsection page is not implemented yet.
|
And I should see "Delete"
|
||||||
And I should not see "Delete"
|
|
||||||
And I should see "Permalink"
|
And I should see "Permalink"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
|
@ -144,18 +143,21 @@ Feature: The module menu replaces the delegated section menu
|
||||||
And "Subsection3" "link" should exist
|
And "Subsection3" "link" should exist
|
||||||
And I open "Subsection1" actions menu
|
And I open "Subsection1" actions menu
|
||||||
When I choose "Delete" in the open action menu
|
When I choose "Delete" in the open action menu
|
||||||
And I click on "Delete" "button" in the "Delete activity?" "dialogue"
|
And I click on "Delete" "button" in the "Delete subsection?" "dialogue"
|
||||||
And "Subsection1" "link" should not exist in the "#region-main-box" "css_element"
|
And "Subsection1" "link" should not exist in the "#region-main-box" "css_element"
|
||||||
And I am on the "C1 > Section 1" "course > section" page
|
And I am on the "C1 > Section 1" "course > section" page
|
||||||
# Section page. Open Subsection2 module action menu.
|
# Section page. Open Subsection2 module action menu.
|
||||||
And I open "Subsection2" actions menu
|
And I open "Subsection2" actions menu
|
||||||
And I choose "Delete" in the open action menu
|
And I choose "Delete" in the open action menu
|
||||||
And I click on "Delete" "button" in the "Delete activity?" "dialogue"
|
And I click on "Delete" "button" in the "Delete subsection?" "dialogue"
|
||||||
And "Subsection2" "link" should not exist in the "#region-main-box" "css_element"
|
And "Subsection2" "link" should not exist in the "#region-main-box" "css_element"
|
||||||
And I am on the "C1 > Subsection3" "course > section" page
|
And I am on the "C1 > Subsection3" "course > section" page
|
||||||
# Subsection page. Open the section header action menu.
|
# Subsection page. Open the section header action menu.
|
||||||
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
|
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
|
||||||
And "Delete" "link" should not exist in the "[data-region='header-actions-container']" "css_element"
|
And I choose "Delete" in the open action menu
|
||||||
|
And I click on "Delete" "button" in the "Delete subsection?" "dialogue"
|
||||||
|
And I should not see "Subsection3"
|
||||||
|
And I should see "Course 1" in the "h1" "css_element"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Hide/Show option in subsection action menu
|
Scenario: Hide/Show option in subsection action menu
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue