Skip to content

Commit

Permalink
MDL-72397 qbank_managecategories: UI enhancement
Browse files Browse the repository at this point in the history
This implementation will introduce a new user interface for
"qbank_managecategories" plugin which will allow user to drag and drop.
Having this plugin will give users the flexibility of reordering, adding
or editing
categories from the qbank_managecategories view.

Co-authored-by: Mark Johnson <[email protected]>
Co-authored-by: Luca Bösch <[email protected]>
  • Loading branch information
3 people committed Jun 5, 2024
1 parent bcd8e0d commit 6c23f79
Show file tree
Hide file tree
Showing 45 changed files with 3,356 additions and 680 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class custom_category_condition_helper extends \qbank_managecategories\helper {

public static function question_category_options(array $contexts, bool $top = false, int $currentcat = 0,
public static function question_category_options(array $contexts, bool $includetop = false, int $currentcat = 0,
bool $popupform = false, int $nochildrenof = -1,
bool $escapecontextnames = true): array {
global $CFG;
Expand All @@ -41,9 +41,9 @@ public static function question_category_options(array $contexts, bool $top = fa
}
$contextslist = join(', ', $pcontexts);

$categories = self::get_categories_for_contexts($contextslist, 'parent, sortorder, name ASC', $top);
$categories = self::get_categories_for_contexts($contextslist, 'parent, sortorder, name ASC', $includetop);

if ($top) {
if ($includetop) {
$categories = self::question_fix_top_names($categories);
}

Expand Down
22 changes: 6 additions & 16 deletions mod/quiz/tests/behat/editing_add.feature
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,12 @@ Feature: Edit quiz page - adding things
in various categories and add them to the question bank.

# Create a couple of sub categories.
When I am on the "Course 1" "core_question > course question categories" page
Then I should see "Add category"
And I follow "Add category"
Then I set the field "Parent category" to "Default for C1"
And I set the field "Name" to "Subcat 1"
And I set the field "Category info" to "This is sub category 1"
And I press "id_submitbutton"
And I should see "Subcat 1"

And I follow "Add category"
Then I set the field "Parent category" to "Default for C1"
And I set the field "Name" to "Subcat 2"
And I set the field "Category info" to "This is sub category 2"
And I press "id_submitbutton"
And I should see "Subcat 2"

Given the following "question categories" exist:
| contextlevel | reference | questioncategory | name |
| Course | C1 | Default for C1 | Subcat 1 |
| Course | C1 | Default for C1 | Subcat 2 |
When I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
And I select "Questions" from the "Question bank tertiary navigation" singleselect
And I should see "Question bank"

Expand Down
6 changes: 4 additions & 2 deletions mod/quiz/tests/behat/random_question.feature
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ Feature: Moving a question to another category should not affect random question
And I press "Add random question"
And I should see "Random question based on filter condition" on quiz page "1"
And I am on the "Course 1" "core_question > course question categories" page
And I click on "Edit this category" "link" in the "Used category" "list_item"
And I open the action menu in "Used category" "list_item"
And I choose "Edit" in the open action menu
And I set the following fields to these values:
| Name | Used category new |
| Category info | I was edited |
And I press "Save changes"
And I press "Edit category"
And I set the field "Show descriptions" to "1"
Then I should see "Used category new"
And I should see "I was edited" in the "Used category new" "list_item"
And I am on the "Quiz 1" "mod_quiz > Edit" page
Expand Down

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

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

Loading

0 comments on commit 6c23f79

Please sign in to comment.