Skip to content

Commit

Permalink
Version bump for 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed May 22, 2022
1 parent 8fb3629 commit a2731df
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/moodle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4']
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE']
php: ['7.3', '7.4', '8.0']
moodle-branch: ['MOODLE_400_STABLE']
database: [pgsql, mariadb]

steps:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
moodle-format_flexsections
==========================

Version 4.0.0
-------------

- Support for Moodle 4.0, however UI remains the same as in previous versions

Version 3.5.2
-------------

Expand Down
37 changes: 33 additions & 4 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,19 @@ protected function section_availability_message($section, $canviewhidden) {
$o = '';
if (!$section->visible) {
if ($canviewhidden) {
$o .= $this->courserenderer->availability_info(get_string('hiddenfromstudents'), 'ishidden');
$o .= $this->availability_info(get_string('hiddenfromstudents'), 'ishidden');
} else {
// We are here because of the setting "Hidden sections are shown in collapsed form".
// Student can not see the section contents but can see its name.
$o .= $this->courserenderer->availability_info(get_string('notavailable'), 'ishidden');
$o .= $this->availability_info(get_string('notavailable'), 'ishidden');
}
} else if (!$section->uservisible) {
if ($section->availableinfo) {
// Note: We only get to this function if availableinfo is non-empty,
// so there is definitely something to print.
$formattedinfo = \core_availability\info::format_info(
$section->availableinfo, $section->course);
$o .= $this->courserenderer->availability_info($formattedinfo, 'isrestricted');
$o .= $this->availability_info($formattedinfo, 'isrestricted');
}
} else if ($canviewhidden && !empty($CFG->enableavailability)) {
// Check if there is an availability restriction.
Expand All @@ -317,12 +317,41 @@ protected function section_availability_message($section, $canviewhidden) {
if ($fullinfo) {
$formattedinfo = \core_availability\info::format_info(
$fullinfo, $section->course);
$o .= $this->courserenderer->availability_info($formattedinfo, 'isrestricted isfullinfo');
$o .= $this->availability_info($formattedinfo, 'isrestricted isfullinfo');
}
}
return $o;
}

/**
* Displays availability info for a course section or course module
*
* @param string $text
* @param string $additionalclasses
* @return string
*/
public function availability_info($text, $additionalclasses = '') {

$data = ['text' => $text, 'classes' => $additionalclasses];
$additionalclasses = array_filter(explode(' ', $additionalclasses));

if (in_array('ishidden', $additionalclasses)) {
$data['ishidden'] = 1;

} else if (in_array('isstealth', $additionalclasses)) {
$data['isstealth'] = 1;

} else if (in_array('isrestricted', $additionalclasses)) {
$data['isrestricted'] = 1;

if (in_array('isfullinfo', $additionalclasses)) {
$data['isfullinfo'] = 1;
}
}

return $this->render_from_template('core/availability_info', $data);
}

/**
* Displays a confirmation dialogue when deleting the section (for non-JS mode)
*
Expand Down
2 changes: 1 addition & 1 deletion styles.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.format-flexsections .course-content ul.flexsections {
margin: 0;
padding: 0;
list-style: none !important;
list-style: none !important; /* stylelint-disable-line declaration-no-important */
}
.format-flexsections .course-content ul.flexsections li.section {
padding: 1rem 0;
Expand Down
16 changes: 11 additions & 5 deletions tests/behat/basic_actions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ Feature: Using course in flexsections format
And I should not see "Second module"

Scenario: Collapsing section in flexsections format
Given the following config values are set as admin:
| unaddableblocks | | theme_boost|
Given I add the "Navigation" block if not present
And I open the "Recent activity" blocks action menu
And I click on "Delete Recent activity block" "link"
And I press "Yes"
And I click on "Delete" "button" in the "Delete block?" "dialogue"
When I click on "Show collapsed" "link" in the "li#section-2" "css_element"
And I log out
And I log in as "student1"
Expand All @@ -82,13 +84,15 @@ Feature: Using course in flexsections format
And I should see "Second module" in the "Navigation" "block"

Scenario: Collapsing section with subsections in flexsections format
Given the following config values are set as admin:
| unaddableblocks | | theme_boost|
Given I add the "Navigation" block if not present
And I open the "Recent activity" blocks action menu
And I click on "Delete Recent activity block" "link"
And I press "Yes"
And I click on "Delete" "button" in the "Delete block?" "dialogue"
And I open the "Upcoming events" blocks action menu
And I click on "Delete Upcoming events block" "link"
And I press "Yes"
And I click on "Delete" "button" in the "Delete block?" "dialogue"
When I click on "Show collapsed" "link" in the "li#section-1" "css_element"
And I log out
And I log in as "student1"
Expand All @@ -109,13 +113,15 @@ Feature: Using course in flexsections format
And I should see "Second module" in the "Navigation" "block"

Scenario: Merging subsection in flexsections format
Given the following config values are set as admin:
| unaddableblocks | | theme_boost|
Given I add the "Navigation" block if not present
And I open the "Recent activity" blocks action menu
And I click on "Delete Recent activity block" "link"
And I press "Yes"
And I click on "Delete" "button" in the "Delete block?" "dialogue"
Given I open the "Upcoming events" blocks action menu
And I click on "Delete Upcoming events block" "link"
And I press "Yes"
And I click on "Delete" "button" in the "Delete block?" "dialogue"
When I click on "Merge with parent" "link" in the "li#section-2" "css_element"
And I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should see "Topic 1" in the "region-main" "region"
Expand Down
1 change: 1 addition & 0 deletions tests/format_flexsections_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/**
* format_flexsections related unit tests
*
* @covers \format_flexsections
* @package format_flexsections
* @copyright 2020 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand Down
8 changes: 4 additions & 4 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2020051101; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2018051700; // Requires this Moodle 3.5 or above.
$plugin->release = "3.5.2";
$plugin->version = 2022052000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2022041900.00; // Requires this Moodle 3.5 or above.
$plugin->release = "4.0.0";
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'format_flexsections'; // Full name of the plugin (used for diagnostics).
$plugin->supported = [35, 311]; // Moodle 3.5 - 3.11 are supported. Moodle 4.0 is NOT supported!
$plugin->supported = [400, 400];

0 comments on commit a2731df

Please sign in to comment.