From 9482ddff7343d2e913a5177d2cdef100140b57f2 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 18 May 2020 14:07:40 +0200 Subject: [PATCH] UX: show caret only in topic footer buttons dropdown select boxes (#9816) --- .../javascripts/discourse/app/widgets/topic-timeline.js | 3 ++- .../javascripts/select-kit/app/components/pinned-options.js | 4 ++++ .../select-kit/app/components/topic-notifications-button.js | 1 + .../select-kit/app/components/topic-notifications-options.js | 3 ++- .../dropdown-select-box/dropdown-select-box-header.hbs | 4 +++- .../app/templates/components/topic-notifications-button.hbs | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/widgets/topic-timeline.js b/app/assets/javascripts/discourse/app/widgets/topic-timeline.js index 9d2ffd64677..55dcafa553e 100644 --- a/app/assets/javascripts/discourse/app/widgets/topic-timeline.js +++ b/app/assets/javascripts/discourse/app/widgets/topic-timeline.js @@ -390,7 +390,8 @@ createWidget("timeline-footer-controls", { showFullTitle: false, appendReason: false, placement: "bottom-end", - mountedAsWidget: true + mountedAsWidget: true, + showCaret: false }, ["notificationLevel"] ) diff --git a/app/assets/javascripts/select-kit/app/components/pinned-options.js b/app/assets/javascripts/select-kit/app/components/pinned-options.js index 0a3e9246ad3..f220617fe12 100644 --- a/app/assets/javascripts/select-kit/app/components/pinned-options.js +++ b/app/assets/javascripts/select-kit/app/components/pinned-options.js @@ -9,6 +9,10 @@ export default DropdownSelectBoxComponent.extend({ pluginApiIdentifiers: ["pinned-options"], classNames: ["pinned-options"], + selectKitOptions: { + showCaret: true + }, + modifySelection(content) { const pinnedGlobally = this.get("topic.pinned_globally"); const pinned = this.value; diff --git a/app/assets/javascripts/select-kit/app/components/topic-notifications-button.js b/app/assets/javascripts/select-kit/app/components/topic-notifications-button.js index dd5c985eab4..58329393e7c 100644 --- a/app/assets/javascripts/select-kit/app/components/topic-notifications-button.js +++ b/app/assets/javascripts/select-kit/app/components/topic-notifications-button.js @@ -9,6 +9,7 @@ export default Component.extend({ placement: "bottom-start", notificationLevel: null, topic: null, + showCaret: true, @action changeTopicNotificationLevel(levelId) { diff --git a/app/assets/javascripts/select-kit/app/components/topic-notifications-options.js b/app/assets/javascripts/select-kit/app/components/topic-notifications-options.js index ae3dd483175..5548eb27417 100644 --- a/app/assets/javascripts/select-kit/app/components/topic-notifications-options.js +++ b/app/assets/javascripts/select-kit/app/components/topic-notifications-options.js @@ -9,7 +9,8 @@ export default NotificationsButtonComponent.extend({ selectKitOptions: { i18nPrefix: "i18nPrefix", - i18nPostfix: "i18nPostfix" + i18nPostfix: "i18nPostfix", + showCaret: true }, i18nPrefix: "topic.notifications", diff --git a/app/assets/javascripts/select-kit/app/templates/components/dropdown-select-box/dropdown-select-box-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/dropdown-select-box/dropdown-select-box-header.hbs index 8ce66b4838e..297c4fde9db 100644 --- a/app/assets/javascripts/select-kit/app/templates/components/dropdown-select-box/dropdown-select-box-header.hbs +++ b/app/assets/javascripts/select-kit/app/templates/components/dropdown-select-box/dropdown-select-box-header.hbs @@ -7,4 +7,6 @@ shouldDisplayClearableButton=shouldDisplayClearableButton }} -{{d-icon caretIcon class="caret-icon"}} +{{#if selectKit.options.showCaret}} + {{d-icon caretIcon class="caret-icon"}} +{{/if}} diff --git a/app/assets/javascripts/select-kit/app/templates/components/topic-notifications-button.hbs b/app/assets/javascripts/select-kit/app/templates/components/topic-notifications-button.hbs index b111dd6a58b..50dd20e56eb 100644 --- a/app/assets/javascripts/select-kit/app/templates/components/topic-notifications-button.hbs +++ b/app/assets/javascripts/select-kit/app/templates/components/topic-notifications-button.hbs @@ -6,6 +6,7 @@ showFullTitle=showFullTitle placement=placement preventsClickPropagation=true + showCaret=showCaret ) }}