MDL-73359 core_badges: Badge pages polish
This commit is contained in:
+1
-1
@@ -189,7 +189,7 @@ if ($totalcount) {
|
||||
|
||||
echo $output->render($badges);
|
||||
} else {
|
||||
echo $output->notification(get_string('nobadges', 'badges'));
|
||||
echo $output->notification(get_string('nobadges', 'badges'), 'info');
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
+1
-1
@@ -380,7 +380,7 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
$localhtml .= $backpackconnect . $countmessage . $searchform;
|
||||
$localhtml .= $htmlpagingbar . $htmllist . $htmlpagingbar . $downloadall;
|
||||
} else {
|
||||
$localhtml .= $searchform . $this->output->notification(get_string('nobadges', 'badges'));
|
||||
$localhtml .= $searchform . $this->output->notification(get_string('nobadges', 'badges'), 'info');
|
||||
}
|
||||
$localhtml .= html_writer::end_tag('div');
|
||||
|
||||
|
||||
@@ -136,8 +136,7 @@ Feature: Add badges to the system
|
||||
And I add the "Navigation" block if not present
|
||||
When I click on "Site pages" "list_item" in the "Navigation" "block"
|
||||
And I click on "Site badges" "link" in the "Navigation" "block"
|
||||
Then I should see "Manage badges"
|
||||
And I should see "Add a new badge"
|
||||
Then I should see "Add a new badge"
|
||||
# Add a badge.
|
||||
When I press "Add a new badge"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
@core @core_badges @_file_upload @javascript
|
||||
Feature: Manage badges is not shown when there are no existing badges.
|
||||
|
||||
Scenario: Check navigation at site level with no badges
|
||||
Given I log in as "admin"
|
||||
When I navigate to "Badges > Manage badges" in site administration
|
||||
And I should see "There are no badges available"
|
||||
Then "Manage badges" "button" should not exist
|
||||
|
||||
Scenario: Check navigation at course level with no badges
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher | Teacher | 1 | teacher@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format | enablecompletion |
|
||||
| Course 1 | C1 | topics | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher | C1 | editingteacher |
|
||||
And I log in as "teacher"
|
||||
And I am on "Course 1" course homepage
|
||||
When I navigate to "Badges" in current page administration
|
||||
Then "Manage badges" "button" should not exist
|
||||
And I click on "Add a new badge" "button"
|
||||
And I set the following fields to these values:
|
||||
| Name | Testing course badge |
|
||||
| Version | 1.1 |
|
||||
| Language | Basque |
|
||||
| Description | Testing course badge description |
|
||||
| Image author | http://author.example.com |
|
||||
| Image caption | Test caption image |
|
||||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||
And I click on "Create badge" "button"
|
||||
And I click on "Back" "button"
|
||||
And I should see "Testing course badge"
|
||||
And I click on "Back" "button"
|
||||
And "Manage badges" "button" should exist
|
||||
# Badge is not enabled so is not listed.
|
||||
And I should not see "Testing course badge"
|
||||
And I click on "Manage badges" "button"
|
||||
And I click on "Edit" "link" in the "Testing course badge" "table_row"
|
||||
And I click on "Add criteria" "button"
|
||||
And I set the field "type" to "Manual issue by role"
|
||||
And I expand all fieldsets
|
||||
And I set the field "Teacher" to "1"
|
||||
And I click on "Save" "button"
|
||||
And I click on "Back" "button"
|
||||
And I should see "Testing course badge"
|
||||
And I click on "Back" "button"
|
||||
And "Manage badges" "button" should exist
|
||||
# Badge is not enabled yet so is not listed.
|
||||
And I should not see "Testing course badge"
|
||||
And I click on "Manage badges" "button"
|
||||
And I click on "Enable access" "link" in the "Testing course badge" "table_row"
|
||||
And I click on "Continue" "button"
|
||||
And I should see "Testing course badge"
|
||||
And I click on "Back" "button"
|
||||
And "Manage badges" "button" should exist
|
||||
# Badge is already enabled so is listed.
|
||||
And I should see "Testing course badge"
|
||||
+6
-1
@@ -97,6 +97,11 @@ $canmanage = has_any_capability(array('moodle/badges:viewawarded',
|
||||
'moodle/badges:configuredetails',
|
||||
'moodle/badges:deletebadge'), $context);
|
||||
|
||||
if ($canmanage) {
|
||||
// Check there are non archived badges on the course.
|
||||
$allbadgescount = count(badges_get_badges($type, $courseid));
|
||||
$canmanage = ($allbadgescount > 0);
|
||||
}
|
||||
$actionbar = new \core_badges\output\standard_action_bar($PAGE, $type, $canmanage);
|
||||
echo $output->header();
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
@@ -119,7 +124,7 @@ if ($totalcount) {
|
||||
|
||||
echo $output->render($badges);
|
||||
} else {
|
||||
echo $output->notification(get_string('nobadges', 'badges'));
|
||||
echo $output->notification(get_string('nobadges', 'badges'), 'info');
|
||||
}
|
||||
// Trigger event, badge listing viewed.
|
||||
$eventparams = array('context' => $PAGE->context, 'other' => $eventotherparams);
|
||||
|
||||
Reference in New Issue
Block a user