MDL-64819 output: Activity menu icons

Remove duplicate alt text from activity menu icons and the links to add new sections.
This commit is contained in:
Damyon Wiese 2019-02-11 09:34:18 +08:00 committed by Sara Arjona
parent f9e436a2b6
commit cce54c4732
6 changed files with 39 additions and 51 deletions

File diff suppressed because one or more lines are too long

View file

@ -341,30 +341,21 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
* @param {String} image new image name ("i/show", "i/hide", etc.)
* @param {String} stringname new string for the action menu item
* @param {String} stringcomponent
* @param {String} titlestr string for "title" attribute (if different from stringname)
* @param {String} titlecomponent
* @param {String} titlestr not used
* @param {String} titlecomponent not used
* @param {String} newaction new value for data-action attribute of the link
* @return {Promise} promise which is resolved when the replacement has completed
*/
var replaceActionItem = function(actionitem, image, stringname,
stringcomponent, titlestr, titlecomponent, newaction) {
var stringRequests = [{key: stringname, component: stringcomponent}];
if (titlestr) {
stringRequests.push({key: titlestr, component: titlecomponent});
}
// Do not provide an icon with duplicate, different text to the menu item.
return str.get_strings(stringRequests).then(function(strings) {
actionitem.find('span.menu-action-text').html(strings[0]);
actionitem.attr('title', strings[0]);
var title = '';
if (titlestr) {
title = strings[1];
actionitem.attr('title', title);
}
return templates.renderPix(image, 'core', title);
return templates.renderPix(image, 'core');
}).then(function(pixhtml) {
actionitem.find('.icon').replaceWith(pixhtml);
actionitem.attr('data-action', newaction);