From d0c80cf6a27d5012fe2c45ee3f72f2683e84e17b Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Fri, 1 Jul 2016 21:23:03 -0700 Subject: [PATCH] search ux comma --- app/app/components/search/search-results.js | 15 ++++++++++++++- app/app/styles/view/page-search.scss | 8 -------- .../components/search/search-results.hbs | 18 ++++++++++-------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/app/app/components/search/search-results.js b/app/app/components/search/search-results.js index 8e1c56c0..453e27dc 100644 --- a/app/app/components/search/search-results.js +++ b/app/app/components/search/search-results.js @@ -21,9 +21,22 @@ export default Ember.Component.extend({ let documents = []; _.each(temp, function(document) { + let refs = []; + + if (document.length > 1) { + refs = document.slice(1); + } + + _.each(refs, function(ref, index) { + ref.comma = index === refs.length-1 ? "" : ", "; + }); + + let hasRefs = refs.length > 0; + documents.pushObject( { doc: document[0], - ref: document + ref: refs, + hasReferences: hasRefs }); }); diff --git a/app/app/styles/view/page-search.scss b/app/app/styles/view/page-search.scss index c0787ad7..6a177a91 100644 --- a/app/app/styles/view/page-search.scss +++ b/app/app/styles/view/page-search.scss @@ -66,14 +66,6 @@ color: $color-link; text-decoration: underline; } - - &:after { - content: 'ยท' - } - - &:last-of-type:after { - content: '' - } } } } diff --git a/app/app/templates/components/search/search-results.hbs b/app/app/templates/components/search/search-results.hbs index df82b3a1..87c16def 100644 --- a/app/app/templates/components/search/search-results.hbs +++ b/app/app/templates/components/search/search-results.hbs @@ -8,14 +8,16 @@
{{ result.doc.documentExcerpt }}
{{search/tag-list documentTags=result.doc.documentTags}}
-
- referenced » - {{#each result.ref as |ref index|}} - - {{ref.pageTitle}} - - {{/each}} -
+ {{#if result.hasReferences}} +
+ referenced » + {{#each result.ref as |ref index|}} + + {{ref.pageTitle}}{{ref.comma}} + + {{/each}} +
+ {{/if}} {{/each}}