1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-11 11:23:52 +02:00

Merge branch 'MDL-72787-master' of git://github.com/ferranrecio/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2021-10-14 20:22:36 +02:00
commit b3046c1213
2 changed files with 60 additions and 6 deletions
blocks/site_main_menu

@ -47,12 +47,12 @@ class block_site_main_menu extends block_list {
return $this->content;
}
require_once($CFG->dirroot . '/course/lib.php');
$course = get_site();
$format = course_get_format($course);
$courserenderer = $format->get_renderer($this->page);
require_once($CFG->dirroot.'/course/lib.php');
$context = context_course::instance($course->id);
$isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);

@ -11,9 +11,63 @@ Feature: Add URL to main menu block
And I turn editing mode on
And I add the "Main menu" block
When I add a "URL" to section "0" and I fill the form with:
| Name | google |
| Description | gooooooooogle |
| Name | reference link |
| Description | gooooooooogle |
| External URL | http://www.google.com |
| id_display | In pop-up |
Then "google" "link" should exist in the "Main menu" "block"
| id_display | In pop-up |
Then "reference link" "link" should exist in the "Main menu" "block"
And "Add an activity or resource" "button" should exist in the "Main menu" "block"
@javascript
Scenario: Add a URL in menu block can appear in all pages
Given the following "course" exists:
| fullname | Course 1 |
| shortname | C1 |
| category | 0 |
| enablecompletion | 1 |
When I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Main menu" block
And I configure the "Main menu" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I add a "URL" to section "0" and I fill the form with:
| Name | reference link |
| Description | gooooooooogle |
| External URL | http://www.google.com |
| id_display | Embed |
Then I follow "reference link"
And "reference link" "link" should exist in the "Main menu" "block"
And I am on the "C1" "Course" page
And "reference link" "link" should exist in the "Main menu" "block"
And I navigate to "Site administration > Badges > Add a new badge" in site administration
And "reference link" "link" should exist in the "Main menu" "block"
@javascript
Scenario: Add a URL in menu block can appear in all pages
Given the following "course" exists:
| fullname | Course 1 |
| shortname | C1 |
| category | 0 |
| enablecompletion | 1 |
When I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Main menu" block
And I configure the "Main menu" block
And I set the following fields to these values:
| Page contexts | Display on the front page and any pages added to the front page |
And I press "Save changes"
And I add a "URL" to section "0" and I fill the form with:
| Name | reference link |
| Description | gooooooooogle |
| External URL | http://www.google.com |
| id_display | Embed |
Then I follow "reference link"
And "reference link" "link" should exist in the "Main menu" "block"
And I am on the "C1" "Course" page
And "Main menu" "block" should not exist
And I navigate to "Site administration > Badges > Add a new badge" in site administration
And "Main menu" "block" should not exist