Merge branch 'MDL-86498-405' of https://github.com/junpataleta/moodle into MOODLE_405_STABLE

This commit is contained in:
Mihail Geshoski
2025-09-10 17:43:44 +08:00
5 changed files with 59 additions and 11 deletions
@@ -69,7 +69,9 @@ class manage_badge_action_bar extends base_action_bar {
$elements['button'] = new single_button(new moodle_url('/badges/index.php', $params), get_string('back'), 'get');
$badgenav = $this->generate_badge_navigation();
if ($badgenav) {
$elements['urlselect'] = new url_select($badgenav, $this->page->url->out(false), null);
$badgenavselect = new url_select($badgenav, $this->page->url->out(false), null);
$badgenavselect->set_label(get_string('badgesnavigation', 'badges'), ['class' => 'sr-only']);
$elements['urlselect'] = $badgenavselect;
}
foreach ($elements as $key => $element) {
$elements[$key] = $element->export_for_template($output);
+32 -10
View File
@@ -187,10 +187,22 @@ class core_badges_renderer extends plugin_renderer_base {
$dl[get_string('createdon', 'search')] = userdate($badge->timecreated);
$dl[get_string('badgeimage', 'badges')] = print_badge_image($badge, $context, 'large');
$dl[get_string('imageauthorname', 'badges')] = $badge->imageauthorname;
$dl[get_string('imageauthoremail', 'badges')] =
html_writer::tag('a', $badge->imageauthoremail, array('href' => 'mailto:' . $badge->imageauthoremail));
$dl[get_string('imageauthorurl', 'badges')] =
html_writer::link($badge->imageauthorurl, $badge->imageauthorurl, array('target' => '_blank'));
$dl[get_string('imageauthoremail', 'badges')] = '';
if (trim($badge->imageauthoremail)) {
$dl[get_string('imageauthoremail', 'badges')] = html_writer::tag(
'a',
$badge->imageauthoremail,
['href' => 'mailto:' . $badge->imageauthoremail],
);
}
$dl[get_string('imageauthorurl', 'badges')] = '';
if (trim($badge->imageauthorurl)) {
$dl[get_string('imageauthorurl', 'badges')] = html_writer::link(
$badge->imageauthorurl,
$badge->imageauthorurl,
['target' => '_blank'],
);
}
$dl[get_string('imagecaption', 'badges')] = $badge->imagecaption;
$tags = \core_tag_tag::get_item_tags('core_badges', 'badge', $badge->id);
$dl[get_string('tags', 'badges')] = $this->output->tag_list($tags, '');
@@ -200,12 +212,22 @@ class core_badges_renderer extends plugin_renderer_base {
$display .= $this->heading(get_string('issuerdetails', 'badges'), 3);
$dl = array();
$dl[get_string('issuername', 'badges')] = $badge->issuername;
$dl[get_string('contact', 'badges')] = html_writer::tag('a', $badge->issuercontact, array('href' => 'mailto:' . $badge->issuercontact));
$dl[get_string('issuerurl', 'badges')] = html_writer::tag(
'a',
$badge->issuerurl,
['href' => $badge->issuerurl, 'target' => '_blank'],
);
$dl[get_string('contact', 'badges')] = '';
if (trim($badge->issuercontact)) {
$dl[get_string('contact', 'badges')] = html_writer::tag(
'a',
$badge->issuercontact,
['href' => 'mailto:' . $badge->issuercontact],
);
}
$dl[get_string('issuerurl', 'badges')] = '';
if (trim($badge->issuerurl)) {
$dl[get_string('issuerurl', 'badges')] = html_writer::tag(
'a',
$badge->issuerurl,
['href' => $badge->issuerurl, 'target' => '_blank'],
);
}
$display .= $this->definition_list($dl);
// Issuance details if any.
+21
View File
@@ -0,0 +1,21 @@
@core @core_badges
Feature: Badge overview
In order to view a badge's information
As an user with the capability to view badges
I need to access the badge overview page
Background:
Given the following config values are set as admin:
| badges_defaultissuername | Test Badge Site |
@javascript @accessibility @_file_upload
Scenario: Test accessibility of badge overview page
Given I log in as "admin"
And I navigate to "Badges > Add a new badge" in site administration
And I set the following fields to these values:
| Name | Cool badge |
| Description | Badge for cool people |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
When I select "Overview" from the "Badges navigation" singleselect
Then the "region-main" "region" should meet accessibility standards with "best-practice" extra tests
+2
View File
@@ -24,6 +24,7 @@ Feature: Display badges
And I log in as "admin"
And I navigate to "Badges > Manage badges" in site administration
@accessibility
Scenario: Display badge without expired date
# Enable the badge.
Given I press "Enable access" action in the "Testing system badge" report row
@@ -44,6 +45,7 @@ Feature: Display badges
And I follow "More details"
And I should see "Catalan"
And I should see "1.1"
And the page should meet accessibility standards with "best-practice" extra tests
Scenario: Display badge with ALL criteria
# Add another criterion and enable the badge.
+1
View File
@@ -145,6 +145,7 @@ $string['backpackapiurl'] = 'Backpack API URL';
$string['backpackweburl'] = 'Backpack URL';
$string['backpackprovider'] = 'Backpack provider';
$string['badges'] = 'Badges';
$string['badgesnavigation'] = 'Badges navigation';
$string['badgedetails'] = 'Badge details';
$string['badgeimage'] = 'Image';
$string['badgeimage_help'] = 'The image should be at least 300 x 300 pixels in size. It will be displayed as 300 x 300 pixels on the badge page and 100 x 100 pixels on the user\'s profile page.';