Add span to various labels so they can be targetted

This commit is contained in:
Robin Ward 2017-09-07 11:09:49 -04:00
parent 70d0e175a2
commit 8e88bf019f
3 changed files with 20 additions and 8 deletions

View File

@ -4,7 +4,7 @@
{{#if category.read_restricted}} {{#if category.read_restricted}}
{{d-icon "lock"}} {{d-icon "lock"}}
{{/if}} {{/if}}
{{category.name}} <span class='d-label'>{{category.name}}</span>
</a> </a>
{{else}} {{else}}
{{#if noSubcategories}} {{#if noSubcategories}}

View File

@ -37,9 +37,12 @@ createWidget('header-notifications', {
const unreadNotifications = user.get('unread_notifications'); const unreadNotifications = user.get('unread_notifications');
if (!!unreadNotifications) { if (!!unreadNotifications) {
contents.push(this.attach('link', { action: attrs.action, contents.push(this.attach('link', {
className: 'badge-notification unread-notifications', action: attrs.action,
rawLabel: unreadNotifications })); className: 'badge-notification unread-notifications',
rawLabel: unreadNotifications,
omitSpan: true
}));
} }
const unreadPMs = user.get('unread_private_messages'); const unreadPMs = user.get('unread_private_messages');
@ -55,9 +58,12 @@ createWidget('header-notifications', {
} }
}; };
contents.push(this.attach('link', { action: attrs.action, contents.push(this.attach('link', {
className: 'badge-notification unread-private-messages', action: attrs.action,
rawLabel: unreadPMs })); className: 'badge-notification unread-private-messages',
rawLabel: unreadPMs,
omitSpan: true
}));
} }
return contents; return contents;

View File

@ -54,7 +54,13 @@ export default createWidget('link', {
} }
if (!attrs.hideLabel) { if (!attrs.hideLabel) {
result.push(this.label(attrs)); let label = this.label(attrs);
if (attrs.omitSpan) {
result.push(label);
} else {
result.push(h('span.d-label', label));
}
} }
const currentUser = this.currentUser; const currentUser = this.currentUser;