MDL-76123 course: multilingual module icon alt text attribute.

This commit is contained in:
Paul Holden 2023-07-11 15:29:28 +01:00
parent 1474f74687
commit 6d9a45f388
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
4 changed files with 18 additions and 14 deletions

View File

@ -84,13 +84,11 @@ class cmicon implements named_templatable, renderable {
'icon' => $iconurl,
'iconclass' => $iconclass,
'modname' => $mod->modname,
'pluginname' => get_string('pluginname', 'mod_' . $mod->modname),
'showtooltip' => $this->format->show_editor(),
'purpose' => plugin_supports('mod', $mod->modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER),
];
if ($this->format->show_editor()) {
$data['pluginname'] = get_string('pluginname', 'mod_' . $mod->modname);
}
return $data;
}

View File

@ -27,21 +27,26 @@
"iconclass": "",
"purpose": "content",
"modname": "resource",
"pluginname": "File"
"pluginname": "File",
"showtooltip": 1
}
}}
{{#url}}
{{#uservisible}}
<a href="{{url}}"
class="activity-icon activityiconcontainer smaller {{purpose}} btn btn-link courseicon align-self-start mr-2"
{{#pluginname}}data-toggle="tooltip" title="{{{pluginname}}}" data-placement="top"{{/pluginname}}
{{#showtooltip}}data-toggle="tooltip" title="{{{pluginname}}}" data-placement="top"{{/showtooltip}}
>
<img src="{{{icon}}}" class="activityicon {{iconclass}}" alt="{{{modname}}} icon">
<img src="{{{icon}}}" class="activityicon {{iconclass}}"
alt="{{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}}"
>
</a>
{{/uservisible}}
{{^uservisible}}
<div class="activity-icon activityiconcontainer smaller {{purpose}} courseicon align-self-start mr-2">
<img src="{{{icon}}}" class="activityicon {{iconclass}}" alt="{{{modname}}} icon">
<img src="{{{icon}}}" class="activityicon {{iconclass}}"
alt="{{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}}"
>
</div>
{{/uservisible}}
{{/url}}

View File

@ -25,19 +25,19 @@ Feature: Activity type tooltip.
Scenario: Teacher can see the activity type tooltip only while editing.
Given I am on the "C1" "Course" page logged in as "teacher1"
And I hover over the "assign icon" "link" in the "Activity sample 1" "activity"
And I hover over the "Assignment icon" "link" in the "Activity sample 1" "activity"
And "body>.tooltip" "css_element" should not exist
And I hover over the "page icon" "link" in the "Activity sample 2" "activity"
And I hover over the "Page icon" "link" in the "Activity sample 2" "activity"
And "body>.tooltip" "css_element" should not exist
And I turn editing mode on
When I hover over the "assign icon" "link" in the "Activity sample 1" "activity"
When I hover over the "Assignment icon" "link" in the "Activity sample 1" "activity"
Then I should see "Assignment" in the "body>.tooltip" "css_element"
And I hover over the "page icon" "link" in the "Activity sample 2" "activity"
And I hover over the "Page icon" "link" in the "Activity sample 2" "activity"
And I should see "Page" in the "body>.tooltip" "css_element"
Scenario: Student cannot see the activity type tooltip.
Given I am on the "C1" "Course" page logged in as "student1"
When I hover over the "assign icon" "link" in the "Activity sample 1" "activity"
When I hover over the "Assignment icon" "link" in the "Activity sample 1" "activity"
Then "body>.tooltip" "css_element" should not exist
Scenario: Student cannot see the activity icon link if does not have access.
@ -51,4 +51,4 @@ Feature: Activity type tooltip.
And I press "Save and return to course"
And I log out
And I am on the "C1" "Course" page logged in as "student1"
Then "page icon" "link" should not exist in the "Activity sample 2" "activity"
Then "Page icon" "link" should not exist in the "Activity sample 2" "activity"

View File

@ -34,6 +34,7 @@ $string['activities'] = 'Activities';
$string['activities_help'] = 'Activities, such as forums, quizzes and wikis, enable interactive content to be added to the course.';
$string['activity'] = 'Activity';
$string['activityclipboard'] = 'Moving this activity: {$a}';
$string['activityicon'] = '{$a} icon';
$string['activityiscurrentlyhidden'] = 'Sorry, this activity is currently hidden';
$string['activityheader'] = 'Activity menu';
$string['activitymodule'] = 'Activity module';