MDL-43941 Course: Allow AJAX show/hide of activities in hidden and orphaned sections
This commit is contained in:
@@ -39,3 +39,57 @@ Feature: Toggle activities visibility from the course page
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And "Test forum name" activity should be hidden
|
||||
|
||||
@javascript
|
||||
Scenario: Activities can be shown and hidden inside a hidden section
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | format | numsections |
|
||||
| Course 1 | C1 | topics | 2 |
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Forum" to section "2" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
| Visible | Show |
|
||||
When I hide section "2"
|
||||
Then "Test forum name" activity should be hidden
|
||||
And I open "Test forum name" actions menu
|
||||
And I click on "Show" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be visible
|
||||
And I open "Test forum name" actions menu
|
||||
And I click on "Hide" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be hidden
|
||||
|
||||
@javascript
|
||||
Scenario: Activities can be shown and hidden inside an orphaned section
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | format | numsections |
|
||||
| Course 1 | C1 | topics | 2 |
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Forum" to section "2" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
| Visible | Show |
|
||||
When I click on ".reduce-sections" "css_element"
|
||||
Then "Test forum name" activity should be visible
|
||||
And I open "Test forum name" actions menu
|
||||
And I click on "Hide" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be hidden
|
||||
And I open "Test forum name" actions menu
|
||||
And I click on "Show" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be visible
|
||||
|
||||
@@ -555,12 +555,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||
// Prevent the default button action
|
||||
ev.preventDefault();
|
||||
|
||||
// Return early if the current section is hidden
|
||||
var section = activity.ancestor(M.course.format.get_section_selector(Y));
|
||||
if (section && section.hasClass(CSS.SECTIONHIDDENCLASS)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Get the element we're working on
|
||||
var element = activity;
|
||||
var value = this.handle_resource_dim(button, activity, action);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -555,12 +555,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||
// Prevent the default button action
|
||||
ev.preventDefault();
|
||||
|
||||
// Return early if the current section is hidden
|
||||
var section = activity.ancestor(M.course.format.get_section_selector(Y));
|
||||
if (section && section.hasClass(CSS.SECTIONHIDDENCLASS)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Get the element we're working on
|
||||
var element = activity;
|
||||
var value = this.handle_resource_dim(button, activity, action);
|
||||
|
||||
-6
@@ -351,12 +351,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
|
||||
// Prevent the default button action
|
||||
ev.preventDefault();
|
||||
|
||||
// Return early if the current section is hidden
|
||||
var section = activity.ancestor(M.course.format.get_section_selector(Y));
|
||||
if (section && section.hasClass(CSS.SECTIONHIDDENCLASS)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Get the element we're working on
|
||||
var element = activity;
|
||||
var value = this.handle_resource_dim(button, activity, action);
|
||||
|
||||
Reference in New Issue
Block a user