Skip to content

Commit

Permalink
MDL-64554 core_customfield: use modal forms for fields
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Feb 17, 2021
1 parent 72be49c commit aa33a22
Show file tree
Hide file tree
Showing 27 changed files with 282 additions and 259 deletions.
16 changes: 0 additions & 16 deletions course/classes/customfield/course_handler.php
Expand Up @@ -238,20 +238,4 @@ public function restore_instance_data_from_backup(\restore_task $task, array $da
}
}
}

/**
* Set up page customfield/edit.php
*
* @param field_controller $field
* @return string page heading
*/
public function setup_edit_page(field_controller $field) : string {
global $CFG, $PAGE;
require_once($CFG->libdir.'/adminlib.php');

$title = parent::setup_edit_page($field);
admin_externalpage_setup('course_customfield');
$PAGE->navbar->add($title);
return $title;
}
}
40 changes: 34 additions & 6 deletions course/tests/behat/customfields_locked.feature
@@ -1,5 +1,5 @@
@core @core_course @core_customfield
Feature: Fields locked control where they are displayed
@core @core_course @core_customfield @javascript
Feature: Fields locked control who is able to edit it
In order to display custom fields on course listing
As a manager
I can change the visibility of the fields
Expand All @@ -19,12 +19,40 @@ Feature: Fields locked control where they are displayed
| user | course | role |
| teacher1 | C1 | editingteacher |

Scenario: Display course custom fields on homepage
Scenario: Editing locked and not locked custom fields
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
| Name | Test field |
| Short name | testfield |
| Locked | No |
| Name | Test field1 |
| Short name | testfield1 |
| Locked | No |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
| Name | Test field2 |
| Short name | testfield2 |
| Locked | Yes |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
And I am on "Course 1" course homepage
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Test field1 | testcontent1 |
| Test field2 | testcontent2 |
And I press "Save and display"
And I am on site homepage
Then I should see "Test field1: testcontent1"
And I should see "Test field2: testcontent2"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Edit settings" in current page administration
And I expand all fieldsets
And the field "Test field1" matches value "testcontent1"
And I should not see "Test field2"
And I press "Save and display"
And I am on site homepage
And I should see "Test field1: testcontent1"
And I should see "Test field2: testcontent2"
8 changes: 4 additions & 4 deletions course/tests/behat/customfields_visibility.feature
@@ -1,4 +1,4 @@
@core @core_course @core_customfield
@core @core_course @core_customfield @javascript
Feature: The visibility of fields control where they are displayed
In order to display custom fields on course listing
As a manager
Expand Down Expand Up @@ -28,7 +28,7 @@ Feature: The visibility of fields control where they are displayed
| Name | Test field |
| Short name | testfield |
| Visible to | Everyone |
And I press "Save changes"
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
And I log out
Then I log in as "teacher1"
And I am on "Course 1" course homepage
Expand All @@ -48,7 +48,7 @@ Feature: The visibility of fields control where they are displayed
| Name | Test field |
| Short name | testfield |
| Visible to | Nobody |
And I press "Save changes"
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
Expand All @@ -68,7 +68,7 @@ Feature: The visibility of fields control where they are displayed
| Name | Test field |
| Short name | testfield |
| Visible to | Teachers |
And I press "Save changes"
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage
Expand Down
2 changes: 1 addition & 1 deletion customfield/amd/build/form.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aa33a22

Please sign in to comment.