MDL-77764 contentbank: add field label to context selection element.

This commit is contained in:
Paul Holden
2023-03-27 16:55:00 +01:00
parent 8af994f1f0
commit ff1b86ab60
2 changed files with 26 additions and 28 deletions
+4 -3
View File
@@ -149,14 +149,15 @@ class bankcontent implements renderable, templatable {
$allowedcontexts['courses'] = [get_string('courses') => $options];
}
if (!empty($allowedcontexts)) {
$url = new \moodle_url('/contentbank/index.php');
$strchoosecontext = get_string('choosecontext', 'core_contentbank');
$singleselect = new \single_select(
$url,
new \moodle_url('/contentbank/index.php'),
'contextid',
$allowedcontexts,
$this->context->id,
get_string('choosecontext', 'core_contentbank')
$strchoosecontext
);
$singleselect->set_label($strchoosecontext, ['class' => 'sr-only']);
$data->allowedcontexts = $singleselect->export_for_template($output);
}
@@ -34,21 +34,20 @@ Feature: Navigate to different contexts in the content bank
And I add the "Navigation" block if not present
And I expand "Site pages" node
When I click on "Content bank" "link"
And "contextid" "select" should exist
And the "contextid" select box should contain "System"
And the "contextid" select box should contain "Cat 1"
And the "contextid" select box should contain "Cat 2"
And the "contextid" select box should contain "C0"
And the "contextid" select box should contain "C1"
And the "contextid" select box should contain "C2"
And the "Choose course or category" select box should contain "System"
And the "Choose course or category" select box should contain "Cat 1"
And the "Choose course or category" select box should contain "Cat 2"
And the "Choose course or category" select box should contain "C0"
And the "Choose course or category" select box should contain "C1"
And the "Choose course or category" select box should contain "C2"
And I should see "santjordi.h5p"
And I should not see "santjordi_rose.h5p"
And I should not see "Dragon.h5p"
And I set the field "contextid" to "Cat 1"
And I set the field "Choose course or category" to "Cat 1"
Then I should not see "santjordi.h5p"
And I should see "santjordi_rose.h5p"
And I should not see "Dragon.h5p"
And I set the field "contextid" to "C0"
And I set the field "Choose course or category" to "C0"
And I should not see "santjordi.h5p"
And I should not see "santjordi_rose.h5p"
And I should see "Dragon.h5p"
@@ -69,18 +68,17 @@ Feature: Navigate to different contexts in the content bank
And I add the "Navigation" block if not present
And I expand "Site pages" node
When I click on "Content bank" "link"
And "contextid" "select" should exist
And the "contextid" select box should contain "C0"
And the "contextid" select box should contain "C1"
And the "contextid" select box should not contain "System"
And the "contextid" select box should not contain "Cat 1"
And the "contextid" select box should not contain "Cat 2"
And the "contextid" select box should not contain "C2"
And the "Choose course or category" select box should contain "C0"
And the "Choose course or category" select box should contain "C1"
And the "Choose course or category" select box should not contain "System"
And the "Choose course or category" select box should not contain "Cat 1"
And the "Choose course or category" select box should not contain "Cat 2"
And the "Choose course or category" select box should not contain "C2"
And I should see "Dragon.h5p"
And I should not see "princess.h5p"
And I should not see "santjordi.h5p"
And I should not see "santjordi_rose.h5p"
And I set the field "contextid" to "C1"
And I set the field "Choose course or category" to "C1"
Then I should not see "Dragon.h5p"
And I should see "princess.h5p"
And I should not see "santjordi.h5p"
@@ -91,14 +89,13 @@ Feature: Navigate to different contexts in the content bank
And I am on the "C0" "Course" page logged in as "teacher"
And I expand "Site pages" node
When I click on "Content bank" "link"
And "contextid" "select" should exist
And the "contextid" select box should contain "C0"
And the "contextid" select box should contain "C1"
And the "contextid" select box should contain "Cat 1"
And the "contextid" select box should not contain "System"
And the "contextid" select box should not contain "Cat 2"
And the "contextid" select box should not contain "C2"
And the "Choose course or category" select box should contain "C0"
And the "Choose course or category" select box should contain "C1"
And the "Choose course or category" select box should contain "Cat 1"
And the "Choose course or category" select box should not contain "System"
And the "Choose course or category" select box should not contain "Cat 2"
And the "Choose course or category" select box should not contain "C2"
And I should see "Dragon.h5p"
And I set the field "contextid" to "Cat 1"
And I set the field "Choose course or category" to "Cat 1"
And I should not see "Dragon.h5p"
And I should see "santjordi_rose.h5p"