Przeglądaj źródła

Updates to matches

Travis Chase 10 lat temu
rodzic
commit
ce962ca567
2 zmienionych plików z 5 dodań i 3 usunięć
  1. 1 2
      src/assets/js/search.js
  2. 4 1
      src/icons.html

+ 1 - 2
src/assets/js/search.js

@@ -70,7 +70,7 @@ $(function() {
             this.pullMatches(matches, this.result._highlightResult.aliases);
             this.pullMatches(matches, this.result._highlightResult.synonyms);
 
-            return this.template({ result: this.result, matches: matches.join(", ") });
+            return this.template({ result: this.result, matches: matches });
         },
 
         pullMatches: function(matches, list) {
@@ -84,7 +84,6 @@ $(function() {
         }
     });
 
-
     var $searchViewElement = $("[data-view=search]");
 
     if ($searchViewElement.length > 0) {

+ 4 - 1
src/icons.html

@@ -87,7 +87,10 @@ relative_path: ../
   <script type="text/template" id="result-template">
     <div class="fa-hover col-md-3 col-sm-4">
       <a href="{{ page.relative_path }}icon/<%= result.name %>">
-        <i class="fa <%= result.css_class %>"></i> <%= result._highlightResult.name.value %> <% if (matches !== "") { %>(<%= matches %>)<% } %>
+        <i class="fa <%= result.css_class %>"></i> <%= result._highlightResult.name.value %>
+        <% if (matches.length > 0) { %>
+          <span class="text-muted">(<%= matches.join(", ") %>)</span>
+        <% } %>
       </a>
     </div>
   </script>