Browse Source

Add resultCard component for standard display of a card search result

John R. Supplee 4 years ago
parent
commit
f00395a6b6

+ 23 - 0
client/components/cards/resultCard.jade

@@ -0,0 +1,23 @@
+template(name="resultCard")
+  .result-card-wrapper
+    a.minicard-wrapper.card-title(href=card.absoluteUrl)
+      +minicard(this)
+      //= card.title
+    ul.result-card-context-list
+      li.result-card-context(title="{{_ 'board'}}")
+        +viewer
+          = getBoard.title
+      li.result-card-context.result-card-context-separator
+        = ' '
+        | {{_ 'context-separator'}}
+        = ' '
+      li.result-card-context(title="{{_ 'swimlane'}}")
+        +viewer
+          = getSwimlane.title
+      li.result-card-context.result-card-context-separator
+        = ' '
+        | {{_ 'context-separator'}}
+        = ' '
+      li.result-card-context(title="{{_ 'list'}}")
+        +viewer
+          = getList.title

+ 11 - 0
client/components/cards/resultCard.js

@@ -0,0 +1,11 @@
+Template.resultCard.helpers({
+  userId() {
+    return Meteor.userId();
+  },
+});
+
+BlazeComponent.extendComponent({
+  events() {
+    return [{}];
+  },
+}).register('resultCard');

+ 21 - 0
client/components/cards/resultCard.styl

@@ -0,0 +1,21 @@
+.result-card-list-wrapper
+  margin: 1rem
+  border-radius: 5px
+  padding: 1.5rem
+  padding-top: 0.75rem
+  display: inline-block
+  min-width: 250px
+  max-width: 350px
+
+.result-card-wrapper
+  margin-top: 0
+  margin-bottom: 10px
+
+.result-card-context
+  display: inline-block
+
+.result-card-context-separator
+  font-weight: bold
+
+.result-card-context-list
+  margin-bottom: 0.7rem

+ 1 - 22
client/components/main/globalSearch.jade

@@ -29,28 +29,7 @@ template(name="globalSearch")
               span.global-search-error-messages
                 | {{_ msg.tag msg.value }}
         each card in results
-          .global-search-card-wrapper
-            a.minicard-wrapper.card-title(href=card.absoluteUrl)
-              +minicard(card)
-              //= card.title
-            ul.global-search-context-list
-              li.global-search-context(title="{{_ 'board'}}")
-                +viewer
-                  = card.getBoard.title
-              li.global-search-context.global-search-context-separator
-                = ' '
-                | {{_ 'context-separator'}}
-                = ' '
-              li.global-search-context(title="{{_ 'swimlane'}}")
-                +viewer
-                  = card.getSwimlane.title
-              li.global-search-context
-                = ' '
-                | {{_ 'context-separator'}}
-                = ' '
-              li.global-search-context(title="{{_ 'list'}}")
-                +viewer
-                  = card.getList.title
+          +resultCard(card)
     else
       .global-search-instructions
         h1 Search Operators