UX: Include metadata in composer link modal search results

Metadata includes topic status (closed, pinned, solved, etc.) as well as category and tags.
This commit is contained in:
Penar Musaraj 2019-10-16 10:17:27 -04:00
parent 7ba914f1e1
commit c6e255f4e0
3 changed files with 22 additions and 6 deletions

View File

@ -169,7 +169,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
if (!e.metaKey && !e.ctrlKey) { if (!e.metaKey && !e.ctrlKey) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.selectLink(e.target); this.selectLink(e.target.closest(".search-link"));
} }
}, },
search() { search() {

View File

@ -11,13 +11,21 @@
{{/if}} {{/if}}
{{#if searchResults}} {{#if searchResults}}
<div class="internal-link-results"> <div class="internal-link-results">
{{#each searchResults as |r index|}} {{#each searchResults as |result|}}
<a <a
class="search-link" class="search-link"
href="{{r.url}}" href="{{result.url}}"
onclick={{action "linkClick"}} onclick={{action "linkClick"}}
data-title="{{r.title}}"> data-title="{{result.title}}">
{{replace-emoji r.fancy_title}} {{topic-status topic=result disableActions=true}}
{{replace-emoji result.fancy_title}}
<div class="search-category">
{{#if result.category.parentCategory}}
{{category-link result.category.parentCategory}}
{{/if}}
{{category-link result.category hideParent=true}}
{{discourse-tags result}}
</div>
</a> </a>
{{/each}} {{/each}}
</div> </div>

View File

@ -225,7 +225,7 @@
max-height: 150px; max-height: 150px;
width: 90%; width: 90%;
overflow-y: auto; overflow-y: auto;
> a { > .search-link {
padding: 6px; padding: 6px;
border-bottom: 1px solid $primary-low; border-bottom: 1px solid $primary-low;
cursor: pointer; cursor: pointer;
@ -234,6 +234,14 @@
&:focus { &:focus {
background-color: $highlight-medium; background-color: $highlight-medium;
} }
.search-category {
display: flex;
align-items: center;
}
.discourse-tags {
display: inline-block;
font-size: $font-down-1;
}
} }
} }
} }