FIX: missing titles and aria-labels on sharing links

This commit is contained in:
Sam 2015-05-07 12:14:12 +10:00
parent 4f53b85ee2
commit 4191d97d48
2 changed files with 5 additions and 1 deletions

View File

@ -19,12 +19,14 @@ export default {
return "http://twitter.com/intent/tweet?url=" + encodeURIComponent(link) + "&text=" + encodeURIComponent(title); return "http://twitter.com/intent/tweet?url=" + encodeURIComponent(link) + "&text=" + encodeURIComponent(title);
}, },
shouldOpenInPopup: true, shouldOpenInPopup: true,
title: I18n.t('share.twitter'),
popupHeight: 265 popupHeight: 265
}); });
Sharing.addSource({ Sharing.addSource({
id: 'facebook', id: 'facebook',
faIcon: 'fa-facebook-square', faIcon: 'fa-facebook-square',
title: I18n.t('share.facebook'),
generateUrl: function(link, title) { generateUrl: function(link, title) {
return "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(link) + '&t=' + encodeURIComponent(title); return "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(link) + '&t=' + encodeURIComponent(title);
}, },
@ -34,6 +36,7 @@ export default {
Sharing.addSource({ Sharing.addSource({
id: 'google+', id: 'google+',
faIcon: 'fa-google-plus-square', faIcon: 'fa-google-plus-square',
title: I18n.t('share.google+'),
generateUrl: function(link) { generateUrl: function(link) {
return "https://plus.google.com/share?url=" + encodeURIComponent(link); return "https://plus.google.com/share?url=" + encodeURIComponent(link);
}, },
@ -44,6 +47,7 @@ export default {
Sharing.addSource({ Sharing.addSource({
id: 'email', id: 'email',
faIcon: 'fa-envelope-square', faIcon: 'fa-envelope-square',
title: I18n.t('share.email'),
generateUrl: function(link, title) { generateUrl: function(link, title) {
return "mailto:?to=&subject=" + encodeURIComponent('[' + Discourse.SiteSettings.title + '] ' + title) + "&body=" + encodeURIComponent(link); return "mailto:?to=&subject=" + encodeURIComponent('[' + Discourse.SiteSettings.title + '] ' + title) + "&body=" + encodeURIComponent(link);
} }

View File

@ -1,4 +1,4 @@
<a href {{action "share" source}} {{bind-attr title="title"}}> <a href {{action "share" source}} title="{{unbound source.title}}" aria-label="{{unbound source.title}}" >
{{#if source.faIcon}} {{#if source.faIcon}}
<i {{bind-attr class=":fa source.faIcon"}}></i> <i {{bind-attr class=":fa source.faIcon"}}></i>
{{else}} {{else}}