mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-75596 course: Allow inserting activities everywhere
Co-authored-by: Mathew May <mathewm@hotmail.co.nz>
- Loading branch information
1 parent
12e9d9e
commit 15034e7
Showing
11 changed files
with
214 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{{! | ||
This file is part of Moodle - http://moodle.org/ | ||
Moodle is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Moodle is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
}} | ||
{{! | ||
@template core_course/activitychooserbuttonactivity | ||
Displays a add activity or resource button. | ||
Context variables required for this template: | ||
* id - Which activity we want to add the new activity before. | ||
* num - Relative section number (field course_sections.section). | ||
* sectionreturn - The section to link back to. | ||
Example context (json): | ||
{ | ||
"id": 0, | ||
"num": 1, | ||
"sectionreturn": 5 | ||
} | ||
}} | ||
<button class="btn btn-link text-decoration-none section-modchooser section-modchooser-link activity-add d-flex align-items-center p-3 mb-3 activitychooser-button" | ||
data-action="open-chooser" data-sectionid="{{num}}" data-sectionreturnid="{{sectionreturn}}" data-beforemod="{{id}}" aria-label="{{#str}}insertresourceoractivitybefore, core, { "activityname": {{#quote}} {{activityname}} {{/quote}} } {{/str}}" tabindex="0"> | ||
{{#pix}} t/add, core {{/pix}} | ||
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@core @core_course @javascript | ||
Feature: Use the activity chooser to insert activities anywhere in a section | ||
In order to add activities to a course | ||
As a teacher | ||
I should be able to add an activity anywhere in a section. | ||
|
||
Background: | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher | Teacher | 1 | teacher@example.com | | ||
And the following "courses" exist: | ||
| fullname | shortname | format | | ||
| Course | C | topics | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher | C | editingteacher | | ||
And the following "activities" exist: | ||
| activity | course | idnumber | intro | name | section | | ||
| page | C | p1 | x | Test Page | 1 | | ||
| forum | C | f1 | x | Test Forum | 1 | | ||
| label | C | l1 | x | Test Label | 1 | | ||
And I log in as "teacher" | ||
And I am on "Course" course homepage with editing mode on | ||
|
||
Scenario: The activity chooser icon is hidden by default and be made visible on hover | ||
Given I hover ".navbar-brand" "css_element" | ||
And "[data-action='insert-before-Test Forum'] button" "css_element" should not be visible | ||
When I hover "[data-action='insert-before-Test Forum']" "css_element" | ||
Then "[data-action='insert-before-Test Forum'] button" "css_element" should be visible | ||
|
||
Scenario: The activity chooser can be used to insert modules before existing modules | ||
Given I hover "[data-action='insert-before-Test Forum']" "css_element" | ||
And I click on "[data-action='insert-before-Test Forum'] button" "css_element" | ||
And I should see "Add an activity or resource" in the ".modal-title" "css_element" | ||
When I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue" | ||
And I set the following fields to these values: | ||
| Assignment name | Test Assignment | | ||
And I press "Save and return to course" | ||
And I should see "Test Assignment" in the "Topic 1" "section" | ||
# Ensure the new assignment is in the middle of the two existing modules. | ||
Then "Test Page" "text" should appear before "Test Assignment" "text" | ||
And "Test Assignment" "text" should appear before "Test Forum" "text" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.