mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
MDL-81575 core_courseformat: fix interactive section visibility badge
This commit is contained in:
parent
49b666b670
commit
0e70a88d03
@ -104,7 +104,15 @@ class visibility implements named_templatable, renderable {
|
||||
private function get_option_data(string $name, string $action): array {
|
||||
$baseurl = course_get_url($this->section->course, $this->section);
|
||||
$baseurl->param('sesskey', sesskey());
|
||||
$baseurl->param($action, $this->section->section);
|
||||
$baseurl->param($name, $this->section->section);
|
||||
|
||||
// The section page is not yet fully reactive and it needs to use the old non-ajax links.
|
||||
$pagesectionid = $this->format->get_sectionid();
|
||||
if ($this->section->id == $pagesectionid) {
|
||||
$baseurl->param('sectionid', $pagesectionid);
|
||||
$action = '';
|
||||
}
|
||||
|
||||
return [
|
||||
'description' => get_string("availability_{$name}_help", 'core_courseformat'),
|
||||
'icon' => $this->get_icon($name),
|
||||
|
@ -81,3 +81,16 @@ Feature: Varify section visibility interface
|
||||
And I log out
|
||||
And I am on the "C2" "Course" page logged in as "teacher1"
|
||||
And I should see "Hidden from students" in the "Section 1" "section"
|
||||
|
||||
@javascript
|
||||
Scenario: The visibility badge can show a hidden section in a the section page
|
||||
Given I hide section "1"
|
||||
When I am on the "C1 > Section 1" "course > section" page
|
||||
And I click on "Hidden from students" "button" in the "[data-region='sectionbadges']" "css_element"
|
||||
And I should see "Show on course page" in the "[data-region='sectionbadges']" "css_element"
|
||||
And I should see "Hide on course page" in the "[data-region='sectionbadges']" "css_element"
|
||||
And I click on "Show on course page" "link" in the "[data-region='sectionbadges']" "css_element"
|
||||
Then I should not see "Hidden from students" in the "[data-region='sectionbadges']" "css_element"
|
||||
And I open the action menu in "page-header" "region"
|
||||
And I choose "Hide" in the open action menu
|
||||
And I should see "Hidden from students" in the "[data-region='sectionbadges']" "css_element"
|
||||
|
Loading…
x
Reference in New Issue
Block a user