From 2ea8fbb0bd1af5e89cf6924e0860ef07c3306744 Mon Sep 17 00:00:00 2001 From: VinhLe Date: Thu, 3 Jan 2019 10:15:22 +0700 Subject: [PATCH] MDL-64469 Question bank: Change link questions in category question. Make it easier to navigate from the category list to the questions in a category. --- question/category_class.php | 10 ++++------ question/tests/behat/question_categories.feature | 2 +- .../tests/behat/question_categories_idnumber.feature | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/question/category_class.php b/question/category_class.php index 88764291f62..a3394624d00 100644 --- a/question/category_class.php +++ b/question/category_class.php @@ -115,13 +115,11 @@ class question_category_list_item extends list_item { // Each section adds html to be displayed as part of this list item. $questionbankurl = new moodle_url('/question/edit.php', $this->parentlist->pageurl->params()); $questionbankurl->param('cat', $category->id . ',' . $category->contextid); - $catediturl = new moodle_url($this->parentlist->pageurl, array('edit' => $this->id)); $item = ''; - $item .= html_writer::tag('b', html_writer::link($catediturl, - format_string($category->name, true, array('context' => $this->parentlist->context)), - array('title' => $str->edit))) . ' '; - $item .= html_writer::link($questionbankurl, '(' . $category->questioncount . ')', - array('title' => $editqestions)) . ' '; + $text = format_string($category->name, true, ['context' => $this->parentlist->context]) + . ' (' . $category->questioncount . ')'; + $item .= html_writer::tag('b', html_writer::link($questionbankurl, $text, + ['title' => $editqestions]) . ' '); $item .= format_text($category->info, $category->infoformat, array('context' => $this->parentlist->context, 'noclean' => true)); diff --git a/question/tests/behat/question_categories.feature b/question/tests/behat/question_categories.feature index 772c66e02a4..6d7edf25f96 100644 --- a/question/tests/behat/question_categories.feature +++ b/question/tests/behat/question_categories.feature @@ -38,7 +38,7 @@ Feature: A teacher can put questions in categories in the question bank Scenario: A question category can be edited When I navigate to "Question bank > Categories" in current page administration - And I click on "Edit" "link" in the "Subcategory" "list_item" + And I click on "Edit this category" "link" in the "Subcategory" "list_item" And the field "parent" matches value "   Default for C1" And I set the following fields to these values: | Name | New name | diff --git a/question/tests/behat/question_categories_idnumber.feature b/question/tests/behat/question_categories_idnumber.feature index f5717be9dae..695a5a45d5c 100644 --- a/question/tests/behat/question_categories_idnumber.feature +++ b/question/tests/behat/question_categories_idnumber.feature @@ -44,7 +44,7 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers | Course | C1 | Top | top | | | Course | C1 | top | Used category | c1used | And I navigate to "Question bank > Categories" in current page administration - And I click on "Edit" "link" in the "Used category" "list_item" + And I click on "Edit this category" "link" in the "Used category" "list_item" And I press "Save changes" Then I should not see "This ID number is already in use"