Skip to content

Commit

Permalink
Merge branch 'MDL-76123' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
sarjona authored and HuongNV13 committed Aug 10, 2023
2 parents b8a93b9 + 6d9a45f commit 769e915
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
6 changes: 2 additions & 4 deletions course/format/classes/output/local/content/cm/cmicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ public function export_for_template(\renderer_base $output): array {
'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;
}

Expand Down
13 changes: 9 additions & 4 deletions course/format/templates/local/content/cm/cmicon.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
12 changes: 6 additions & 6 deletions course/format/tests/behat/activity_icon_tooltip.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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"
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
$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';
Expand Down

0 comments on commit 769e915

Please sign in to comment.