From e621e333212253d0ae084a4d8b3ce6985846d7e2 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 8 Jun 2016 11:14:36 -0400 Subject: [PATCH] UX: Apply `no-text` to buttons without labels and content --- app/assets/javascripts/discourse/widgets/button.js.es6 | 10 ++++++++-- .../discourse/widgets/topic-admin-menu.js.es6 | 2 +- .../widgets/topic-notifications-button.js.es6 | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/button.js.es6 b/app/assets/javascripts/discourse/widgets/button.js.es6 index 8b8ae46dc1d..96b37087003 100644 --- a/app/assets/javascripts/discourse/widgets/button.js.es6 +++ b/app/assets/javascripts/discourse/widgets/button.js.es6 @@ -4,8 +4,14 @@ import { iconNode } from 'discourse/helpers/fa-icon'; export default createWidget('button', { tagName: 'button.widget-button', - buildClasses() { - if (this.attrs.className) { return this.attrs.className; } + buildClasses(attrs) { + const className = this.attrs.className || ''; + + if (!attrs.label && !attrs.contents) { + return className + ' no-text'; + } + + return className; }, buildAttributes() { diff --git a/app/assets/javascripts/discourse/widgets/topic-admin-menu.js.es6 b/app/assets/javascripts/discourse/widgets/topic-admin-menu.js.es6 index f2b9a57945e..c88c73a3835 100644 --- a/app/assets/javascripts/discourse/widgets/topic-admin-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/topic-admin-menu.js.es6 @@ -29,7 +29,7 @@ createWidget('topic-admin-menu-button', { const result = []; result.push(this.attach('button', { - className: 'btn no-text' + (attrs.fixed ? " show-topic-admin" : ""), + className: 'btn ' + (attrs.fixed ? " show-topic-admin" : ""), title: 'topic_admin_menu', icon: 'wrench', action: 'showAdminMenu', diff --git a/app/assets/javascripts/discourse/widgets/topic-notifications-button.js.es6 b/app/assets/javascripts/discourse/widgets/topic-notifications-button.js.es6 index f5d2deffb90..66223ebb40f 100644 --- a/app/assets/javascripts/discourse/widgets/topic-notifications-button.js.es6 +++ b/app/assets/javascripts/discourse/widgets/topic-notifications-button.js.es6 @@ -52,7 +52,7 @@ export default createWidget('topic-notifications-button', { if (this.attrs.showFullTitle) { button.label = `topic.notifications.${details.key}.title`; } else { - button.className = 'btn no-text notifications-dropdown'; + button.className = 'btn notifications-dropdown'; } return this.attach('button', button);