mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-82541 core_courseformat: improve orphan section visualitzation
This commit is contained in:
parent
393d4f6043
commit
9795add527
@ -142,6 +142,11 @@ class availability implements named_templatable, renderable {
|
||||
['id' => $this->section->id, 'showonly' => 'availabilityconditions']
|
||||
);
|
||||
$info = ['editurl' => $editurl->out(false)];
|
||||
|
||||
if ($section->is_orphan()) {
|
||||
$info['editing'] = false;
|
||||
}
|
||||
|
||||
if (!$section->visible) {
|
||||
return [];
|
||||
} else if (!$section->uservisible) {
|
||||
|
@ -277,6 +277,7 @@ class controlmenu extends basecontrolmenu {
|
||||
}
|
||||
}
|
||||
if (
|
||||
!$isstealth &&
|
||||
has_any_capability([
|
||||
'moodle/course:movesections',
|
||||
'moodle/course:update',
|
||||
|
@ -76,6 +76,10 @@ class visibility implements named_templatable, renderable {
|
||||
|
||||
$data->editing = $this->format->show_editor();
|
||||
|
||||
if ($this->section->is_orphan()) {
|
||||
$data->editing = false;
|
||||
}
|
||||
|
||||
$data->notavailable = false;
|
||||
$data->hiddenfromstudents = true;
|
||||
if ($data->editing && $this->is_section_visibility_editable()) {
|
||||
|
@ -83,6 +83,7 @@
|
||||
"insertafter": true,
|
||||
"numsections": 42,
|
||||
"sitehome": false,
|
||||
"isstealth": false,
|
||||
"highlightedlabel" : "Highlighted"
|
||||
}
|
||||
}}
|
||||
@ -163,6 +164,11 @@
|
||||
<div id="coursecontentcollapse{{num}}"
|
||||
class="content {{^iscoursedisplaymultipage}}{{^sitehome}}{{^displayonesection}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/displayonesection}}{{/sitehome}}{{/iscoursedisplaymultipage}}">
|
||||
<div class="{{#hasavailability}}description{{/hasavailability}} my-3" data-for="sectioninfo">
|
||||
{{#isstealth}}
|
||||
<div class="alert alert-warning">
|
||||
{{#str}} orphansectionwarning, core_courseformat {{/str}}
|
||||
</div>
|
||||
{{/isstealth}}
|
||||
{{#summary}}
|
||||
{{$ core_courseformat/local/content/section/summary }}
|
||||
{{> core_courseformat/local/content/section/summary }}
|
||||
|
@ -67,6 +67,7 @@ $string['courseindex'] = 'Course index';
|
||||
$string['courseindexoptions'] = 'Course index options';
|
||||
$string['maxsectionaddmessage'] = 'You have reached the maximum number of sections allowed for a course.';
|
||||
$string['nobulkaction'] = 'No bulk actions available';
|
||||
$string['orphansectionwarning'] = 'This section and its content are not part of the course structure and are not visible to students. To use any of this content, move it to a different section.';
|
||||
$string['preference:coursesectionspreferences'] = 'Section user preferences for course {$a}';
|
||||
$string['privacy:metadata:preference:coursesectionspreferences'] = 'Section user preferences like collapsed and expanded.';
|
||||
$string['section_hide_feedback'] = 'Course section {$a->name} hidden.';
|
||||
|
@ -38,6 +38,8 @@ Feature: Courses should not lose subsection contents when mod_subsection is disa
|
||||
And "Move" "link" should not exist in the "Subsection1" "core_courseformat > Section actions menu"
|
||||
And "View" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
||||
And "Delete" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
||||
And "Permalink" "link" should not exist in the "Subsection1" "core_courseformat > Section actions menu"
|
||||
And I should see "This section and its content are not part of the course structure" in the "Subsection1" "section"
|
||||
|
||||
Scenario: Students should not see orphaned subsections
|
||||
When I log in as "student1"
|
||||
@ -54,6 +56,7 @@ Feature: Courses should not lose subsection contents when mod_subsection is disa
|
||||
And I should see "Subsection1" in the "page-content" "region"
|
||||
And I should see "Subactivity" in the "Subsection1" "section"
|
||||
And "Section 2" "section" should appear before "Subsection1" "section"
|
||||
And I should see "This section and its content are not part of the course structure"
|
||||
When I enable "subsection" "mod" plugin
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
Then I should see "Activity Sample" in the "Section 1" "section"
|
||||
@ -66,6 +69,7 @@ Feature: Courses should not lose subsection contents when mod_subsection is disa
|
||||
And "Move" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
||||
And "View" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
||||
And "Delete" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
||||
And I should not see "This section and its content are not part of the course structure"
|
||||
|
||||
@javascript
|
||||
Scenario: Deleting the subsections with mod_subsection disabled should not break the course
|
||||
@ -104,14 +108,18 @@ Feature: Courses should not lose subsection contents when mod_subsection is disa
|
||||
And I press "Save changes"
|
||||
And I should see "Not available unless: You belong to a group in GX1"
|
||||
And I disable "subsection" "mod" plugin
|
||||
When I am on the "C1 > Subsection1" "course > section" page
|
||||
And I turn editing mode on
|
||||
When I am on "Course 1" course homepage with editing mode on
|
||||
And I should see "This section and its content are not part of the course structure" in the "Subsection1" "section"
|
||||
And I should see "Not available unless: You belong to a group in GX1"
|
||||
And I should not see "Edit restrictions"
|
||||
And I am on the "C1 > Subsection1" "course > section" page
|
||||
And I click on "Edit" "icon" 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 section?" "dialogue"
|
||||
And I enable "subsection" "mod" plugin
|
||||
Then I am on "Course 1" course homepage
|
||||
And I should see "Not available unless: You belong to a group in GX1"
|
||||
And I should see "Edit restrictions"
|
||||
|
||||
@javascript
|
||||
Scenario: Visibility is restored when a subsection is deleted while mod_subsection is disabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user