From 8e88bf019f0d54a0fdf9624d858a6b93a09cf585 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 7 Sep 2017 11:09:49 -0400 Subject: [PATCH] Add `span` to various labels so they can be targetted --- .../templates/components/category-drop.hbs | 2 +- .../discourse/widgets/header.js.es6 | 18 ++++++++++++------ .../javascripts/discourse/widgets/link.js.es6 | 8 +++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/templates/components/category-drop.hbs b/app/assets/javascripts/discourse/templates/components/category-drop.hbs index d660be87db3..ba5062a429b 100644 --- a/app/assets/javascripts/discourse/templates/components/category-drop.hbs +++ b/app/assets/javascripts/discourse/templates/components/category-drop.hbs @@ -4,7 +4,7 @@ {{#if category.read_restricted}} {{d-icon "lock"}} {{/if}} - {{category.name}} + {{category.name}} {{else}} {{#if noSubcategories}} diff --git a/app/assets/javascripts/discourse/widgets/header.js.es6 b/app/assets/javascripts/discourse/widgets/header.js.es6 index c131128f89a..1c7c1e6ce63 100644 --- a/app/assets/javascripts/discourse/widgets/header.js.es6 +++ b/app/assets/javascripts/discourse/widgets/header.js.es6 @@ -37,9 +37,12 @@ createWidget('header-notifications', { const unreadNotifications = user.get('unread_notifications'); if (!!unreadNotifications) { - contents.push(this.attach('link', { action: attrs.action, - className: 'badge-notification unread-notifications', - rawLabel: unreadNotifications })); + contents.push(this.attach('link', { + action: attrs.action, + className: 'badge-notification unread-notifications', + rawLabel: unreadNotifications, + omitSpan: true + })); } const unreadPMs = user.get('unread_private_messages'); @@ -55,9 +58,12 @@ createWidget('header-notifications', { } }; - contents.push(this.attach('link', { action: attrs.action, - className: 'badge-notification unread-private-messages', - rawLabel: unreadPMs })); + contents.push(this.attach('link', { + action: attrs.action, + className: 'badge-notification unread-private-messages', + rawLabel: unreadPMs, + omitSpan: true + })); } return contents; diff --git a/app/assets/javascripts/discourse/widgets/link.js.es6 b/app/assets/javascripts/discourse/widgets/link.js.es6 index c6426a86238..5774ccc7635 100644 --- a/app/assets/javascripts/discourse/widgets/link.js.es6 +++ b/app/assets/javascripts/discourse/widgets/link.js.es6 @@ -54,7 +54,13 @@ export default createWidget('link', { } 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;