Bläddra i källkod

Limit visibility of Global Search, My Cards and Due Cards to logged in users, because they do not work without logging in.

Thanks to xet7 !
Lauri Ojansivu 4 år sedan
förälder
incheckning
4180224fd9

+ 65 - 61
client/components/main/dueCards.jade

@@ -1,69 +1,73 @@
 template(name="dueCardsHeaderBar")
-  h1
-    i.fa.fa-calendar
-    | {{_ 'dueCards-title'}}
+  if currentUser
+    h1
+      i.fa.fa-calendar
+      | {{_ 'dueCards-title'}}
 
-  .board-header-btns.left
-    a.board-header-btn.js-due-cards-view-change(title="{{_ 'dueCardsViewChange-title'}}")
-      i.fa.fa-caret-down
-      if $eq dueCardsView 'me'
-        i.fa.fa-user
-        | {{_ 'dueCardsViewChange-choice-me'}}
-      if $eq dueCardsView 'all'
-        i.fa.fa-users
-        | {{_ 'dueCardsViewChange-choice-all'}}
+    .board-header-btns.left
+      a.board-header-btn.js-due-cards-view-change(title="{{_ 'dueCardsViewChange-title'}}")
+        i.fa.fa-caret-down
+        if $eq dueCardsView 'me'
+          i.fa.fa-user
+          | {{_ 'dueCardsViewChange-choice-me'}}
+        if $eq dueCardsView 'all'
+          i.fa.fa-users
+          | {{_ 'dueCardsViewChange-choice-all'}}
 
 template(name="dueCardsModalTitle")
-  h2
-    i.fa.fa-keyboard-o
-    | {{_ 'dueCards-title'}}
+  if currentUser
+    h2
+      i.fa.fa-keyboard-o
+      | {{_ 'dueCards-title'}}
 
 template(name="dueCards")
-  if isPageReady.get
-    .wrapper
-      .due-cards-dueat-list-wrapper
-        each card in dueCardsList
-          .due-cards-card-wrapper
-            a.minicard-wrapper.card-title(href=card.absoluteUrl)
-              +minicard(card)
-            ul.due-cards-context-list
-              li.due-cards-context(title="{{_ 'board'}}")
-                +viewer
-                  = card.getBoard.title
-              li.due-cards-context.due-cards-context-separator
-                = ' '
-                | {{_ 'context-separator'}}
-                = ' '
-              li.due-cards-context(title="{{_ 'swimlane'}}")
-                +viewer
-                  = card.getSwimlane.title
-              li.due-cards-context
-                = ' '
-                | {{_ 'context-separator'}}
-                = ' '
-              li.due-cards-context(title="{{_ 'list'}}")
-                +viewer
-                  = card.getList.title
-  else
-    +spinner
+  if currentUser
+    if isPageReady.get
+      .wrapper
+        .due-cards-dueat-list-wrapper
+          each card in dueCardsList
+            .due-cards-card-wrapper
+              a.minicard-wrapper.card-title(href=card.absoluteUrl)
+                +minicard(card)
+              ul.due-cards-context-list
+                li.due-cards-context(title="{{_ 'board'}}")
+                  +viewer
+                    = card.getBoard.title
+                li.due-cards-context.due-cards-context-separator
+                  = ' '
+                  | {{_ 'context-separator'}}
+                  = ' '
+                li.due-cards-context(title="{{_ 'swimlane'}}")
+                  +viewer
+                    = card.getSwimlane.title
+                li.due-cards-context
+                  = ' '
+                  | {{_ 'context-separator'}}
+                  = ' '
+                li.due-cards-context(title="{{_ 'list'}}")
+                  +viewer
+                    = card.getList.title
+    else
+      +spinner
 
 template(name="dueCardsViewChangePopup")
-  ul.pop-over-list
-    li
-      with "dueCardsViewChange-choice-me"
-        a.js-due-cards-view-me
-          i.fa.fa-user.colorful
-          | {{_ 'dueCardsViewChange-choice-me'}}
-          if $eq Utils.dueCardsView "me"
-            i.fa.fa-check
-    hr
-    li
-      with "dueCardsViewChange-choice-all"
-        a.js-due-cards-view-all
-          i.fa.fa-users.colorful
-          | {{_ 'dueCardsViewChange-choice-all'}}
-          span.sub-name
-            +viewer
-              | {{_ 'dueCardsViewChange-choice-all-description' }}
-          if $eq Utils.dueCardsView "all"
-            i.fa.fa-check
+  if currentUser
+    ul.pop-over-list
+      li
+        with "dueCardsViewChange-choice-me"
+          a.js-due-cards-view-me
+            i.fa.fa-user.colorful
+            | {{_ 'dueCardsViewChange-choice-me'}}
+            if $eq Utils.dueCardsView "me"
+              i.fa.fa-check
+      hr
+      li
+        with "dueCardsViewChange-choice-all"
+          a.js-due-cards-view-all
+            i.fa.fa-users.colorful
+            | {{_ 'dueCardsViewChange-choice-all'}}
+            span.sub-name
+              +viewer
+                | {{_ 'dueCardsViewChange-choice-all-description' }}
+            if $eq Utils.dueCardsView "all"
+              i.fa.fa-check

+ 75 - 71
client/components/main/globalSearch.jade

@@ -1,78 +1,82 @@
 template(name="globalSearchHeaderBar")
-  h1
-    i.fa.fa-search
-    | {{_ 'globalSearch-title'}}
+  if currentUser
+    h1
+      i.fa.fa-search
+      | {{_ 'globalSearch-title'}}
 
 template(name="globalSearchModalTitle")
-  h2
-    i.fa.fa-keyboard-o
-    | {{_ 'globalSearch-title'}}
+  if currentUser
+    h2
+      i.fa.fa-keyboard-o
+      | {{_ 'globalSearch-title'}}
 
 template(name="globalSearch")
-  .wrapper
-    form.global-search-instructions.js-search-query-form
-      input.global-search-query-input(type="text" name="searchQuery" placeholder="{{_ 'search-example'}}" autofocus dir="auto")
-    if searching.get
-      +spinner
-    else if hasResults.get
-      .global-search-dueat-list-wrapper
-        h1
-          if $eq resultsCount.get 0
-            | {{_ 'no-cards-found' }}
-          else if $eq resultsCount.get 1
-            | {{_ 'one-card-found' }}
-          else if $eq resultsCount.get totalHits.get
-            | {{_ 'n-cards-found' resultsCount.get }}
-          else
-            | {{_ 'n-n-of-n-cards-found' 1 resultsCount.get totalHits.get }}
-        if queryErrors.get
-          div
-            each msg in errorMessages
-              span.global-search-error-messages
-                | {{_ msg.tag msg.value }}
-        each card in results
-          +resultCard(card)
-    else
-      .global-search-instructions
-        h1 Search Operators
-        +viewer
-          = 'Searches can include operators to refine the search.  Operators are specified by writing the operator'
-          = 'name and value separated by a colon.  For example, an operator specification of `list:Blocked` would limit the search'
-          = 'to cards that are contained in a list named *Blocked*.  If the value contains spaces or special characters'
-          = 'it must be enclosed in quotation marks (e.g. `list:"To Review"`).\n'
-          = 'Available operators are:\n'
-          = '* `board:title` - cards in boards matching the specified title\n'
-          = '* `list:title` - cards in lists matching the specified title\n'
-          = '* `swimlane:title` - cards in swimlanes matching the specified title\n'
-          = '* `label:color` - cards that have a label matching the given color\n'
-          = '* `label:name` - cards that have a label matching the given name\n'
-          = '* `user:username` - cards where the specified user is a member or assignee\n'
-          = '* `@username` - shorthand for `user:username`\n'
-          = '* `#label` - shorthand for `label:color-or-name`\n'
-          = '## Notes\n'
-          = '*  Multiple operators may be specified.\n'
-          = '*  Similar operators are *OR*ed together.  Cards that match any of the conditions will be returned.\n'
-          = '    `list:Available list:Blocked` would return cards contained in any list named *Blocked* or *Available*.\n'
-          = '*  Differing operators are *AND*ed together.  Only cards that match all of the differing operators are returned.\n'
-          = '`list:Available label:red` returns only cards in the list *Available* with a *red* label.\n'
-          = '* Text searches are case insensitive.\n'
+  if currentUser
+    .wrapper
+      form.global-search-instructions.js-search-query-form
+        input.global-search-query-input(type="text" name="searchQuery" placeholder="{{_ 'search-example'}}" autofocus dir="auto")
+      if searching.get
+        +spinner
+      else if hasResults.get
+        .global-search-dueat-list-wrapper
+          h1
+            if $eq resultsCount.get 0
+              | {{_ 'no-cards-found' }}
+            else if $eq resultsCount.get 1
+              | {{_ 'one-card-found' }}
+            else if $eq resultsCount.get totalHits.get
+              | {{_ 'n-cards-found' resultsCount.get }}
+            else
+              | {{_ 'n-n-of-n-cards-found' 1 resultsCount.get totalHits.get }}
+          if queryErrors.get
+            div
+              each msg in errorMessages
+                span.global-search-error-messages
+                  | {{_ msg.tag msg.value }}
+          each card in results
+            +resultCard(card)
+      else
+        .global-search-instructions
+          h1 Search Operators
+          +viewer
+            = 'Searches can include operators to refine the search.  Operators are specified by writing the operator'
+            = 'name and value separated by a colon.  For example, an operator specification of `list:Blocked` would limit the search'
+            = 'to cards that are contained in a list named *Blocked*.  If the value contains spaces or special characters'
+            = 'it must be enclosed in quotation marks (e.g. `list:"To Review"`).\n'
+            = 'Available operators are:\n'
+            = '* `board:title` - cards in boards matching the specified title\n'
+            = '* `list:title` - cards in lists matching the specified title\n'
+            = '* `swimlane:title` - cards in swimlanes matching the specified title\n'
+            = '* `label:color` - cards that have a label matching the given color\n'
+            = '* `label:name` - cards that have a label matching the given name\n'
+            = '* `user:username` - cards where the specified user is a member or assignee\n'
+            = '* `@username` - shorthand for `user:username`\n'
+            = '* `#label` - shorthand for `label:color-or-name`\n'
+            = '## Notes\n'
+            = '*  Multiple operators may be specified.\n'
+            = '*  Similar operators are *OR*ed together.  Cards that match any of the conditions will be returned.\n'
+            = '    `list:Available list:Blocked` would return cards contained in any list named *Blocked* or *Available*.\n'
+            = '*  Differing operators are *AND*ed together.  Only cards that match all of the differing operators are returned.\n'
+            = '`list:Available label:red` returns only cards in the list *Available* with a *red* label.\n'
+            = '* Text searches are case insensitive.\n'
 
 template(name="globalSearchViewChangePopup")
-  ul.pop-over-list
-    li
-      with "globalSearchViewChange-choice-me"
-        a.js-global-search-view-me
-          i.fa.fa-user.colorful
-          | {{_ 'globalSearchViewChange-choice-me'}}
-          if $eq Utils.globalSearchView "me"
-            i.fa.fa-check
-    li
-      with "globalSearchViewChange-choice-all"
-        a.js-global-search-view-all
-          i.fa.fa-users.colorful
-          | {{_ 'globalSearchViewChange-choice-all'}}
-          span.sub-name
-            +viewer
-              | {{_ 'globalSearchViewChange-choice-all-description' }}
-          if $eq Utils.globalSearchView "all"
-            i.fa.fa-check
+  if currentUser
+    ul.pop-over-list
+      li
+        with "globalSearchViewChange-choice-me"
+          a.js-global-search-view-me
+            i.fa.fa-user.colorful
+            | {{_ 'globalSearchViewChange-choice-me'}}
+            if $eq Utils.globalSearchView "me"
+              i.fa.fa-check
+      li
+        with "globalSearchViewChange-choice-all"
+          a.js-global-search-view-all
+            i.fa.fa-users.colorful
+            | {{_ 'globalSearchViewChange-choice-all'}}
+            span.sub-name
+              +viewer
+                | {{_ 'globalSearchViewChange-choice-all-description' }}
+            if $eq Utils.globalSearchView "all"
+              i.fa.fa-check

+ 82 - 78
client/components/main/myCards.jade

@@ -1,88 +1,92 @@
 template(name="myCardsHeaderBar")
-  h1
-    //a.back-btn(href="{{pathFor 'home'}}")
-    //  i.fa.fa-chevron-left
-    i.fa.fa-list
-    | {{_ 'my-cards'}}
+  if currentUser
+    h1
+      //a.back-btn(href="{{pathFor 'home'}}")
+      //  i.fa.fa-chevron-left
+      i.fa.fa-list
+      | {{_ 'my-cards'}}
 
-  .board-header-btns.left
-    a.board-header-btn.js-toggle-my-cards-choose-sort(title="{{_ 'myCardsSortChange-title'}}")
-      i.fa.fa-caret-down
-      if $eq myCardsSort 'board'
-        i.fa.fa-th-large
-        | {{_ 'myCardsSortChange-choice-board'}}
-      if $eq myCardsSort 'dueAt'
-        i.fa.fa-calendar
-        | {{_ 'myCardsSortChange-choice-dueat'}}
+    .board-header-btns.left
+      a.board-header-btn.js-toggle-my-cards-choose-sort(title="{{_ 'myCardsSortChange-title'}}")
+        i.fa.fa-caret-down
+        if $eq myCardsSort 'board'
+          i.fa.fa-th-large
+          | {{_ 'myCardsSortChange-choice-board'}}
+        if $eq myCardsSort 'dueAt'
+          i.fa.fa-calendar
+          | {{_ 'myCardsSortChange-choice-dueat'}}
 
 template(name="myCardsModalTitle")
-  h2
-    i.fa.fa-keyboard-o
-    | {{_ 'my-cards'}}
+  if currentUser
+    h2
+      i.fa.fa-keyboard-o
+      | {{_ 'my-cards'}}
 
 template(name="myCards")
-  if isPageReady.get
-    .wrapper
-      if $eq myCardsSort 'board'
-        each board in myCardsList
-          .my-cards-board-wrapper
-            .my-cards-board-title
-              +viewer
-                = board.title
-            each swimlane in board.mySwimlanes
-              .my-cards-swimlane-title(class="{{#if swimlane.colorClass}}{{ swimlane.colorClass }}{{else}}swimlane-default-color{{/if}}")
+  if currentUser
+    if isPageReady.get
+      .wrapper
+        if $eq myCardsSort 'board'
+          each board in myCardsList
+            .my-cards-board-wrapper
+              .my-cards-board-title
                 +viewer
-                  = swimlane.title
-              each list in swimlane.myLists
-                .my-cards-list-wrapper
-                  .my-cards-list-title(class=list.colorClass)
-                    +viewer
-                      = list.title
-                  each card in list.myCards
-                    .my-cards-card-wrapper
-                      a.minicard-wrapper(href=card.absoluteUrl)
-                        +minicard(card)
-      else
-        .my-cards-dueat-list-wrapper
-          each card in myDueCardsList
-            .my-cards-card-wrapper
-              a.minicard-wrapper.card-title(href=card.absoluteUrl)
-                +minicard(card)
-              ul.my-cards-context-list
-                li.my-cards-context(title="{{_ 'board'}}")
-                  +viewer
-                    = card.getBoard.title
-                li.my-cards-context.my-cards-context-separator
-                  = ' '
-                  | {{_ 'context-separator'}}
-                  = ' '
-                li.my-cards-context(title="{{_ 'swimlane'}}")
-                  +viewer
-                    = card.getSwimlane.title
-                li.my-cards-context
-                  = ' '
-                  | {{_ 'context-separator'}}
-                  = ' '
-                li.my-cards-context(title="{{_ 'list'}}")
+                  = board.title
+              each swimlane in board.mySwimlanes
+                .my-cards-swimlane-title(class="{{#if swimlane.colorClass}}{{ swimlane.colorClass }}{{else}}swimlane-default-color{{/if}}")
                   +viewer
-                    = card.getList.title
-  else
-    +spinner
+                    = swimlane.title
+                each list in swimlane.myLists
+                  .my-cards-list-wrapper
+                    .my-cards-list-title(class=list.colorClass)
+                      +viewer
+                        = list.title
+                    each card in list.myCards
+                      .my-cards-card-wrapper
+                        a.minicard-wrapper(href=card.absoluteUrl)
+                          +minicard(card)
+        else
+          .my-cards-dueat-list-wrapper
+            each card in myDueCardsList
+              .my-cards-card-wrapper
+                a.minicard-wrapper.card-title(href=card.absoluteUrl)
+                  +minicard(card)
+                ul.my-cards-context-list
+                  li.my-cards-context(title="{{_ 'board'}}")
+                    +viewer
+                      = card.getBoard.title
+                  li.my-cards-context.my-cards-context-separator
+                    = ' '
+                    | {{_ 'context-separator'}}
+                    = ' '
+                  li.my-cards-context(title="{{_ 'swimlane'}}")
+                    +viewer
+                      = card.getSwimlane.title
+                  li.my-cards-context
+                    = ' '
+                    | {{_ 'context-separator'}}
+                    = ' '
+                  li.my-cards-context(title="{{_ 'list'}}")
+                    +viewer
+                      = card.getList.title
+    else
+      +spinner
 
 template(name="myCardsSortChangePopup")
-  ul.pop-over-list
-    li
-      with "my-cards-sort-board"
-        a.js-my-cards-sort-board
-          i.fa.fa-th-large.colorful
-          | {{_ 'myCardsSortChange-choice-board'}}
-          if $eq Utils.myCardsSort "board"
-            i.fa.fa-check
-    hr
-    li
-      with "my-cards-sort-dueat"
-        a.js-my-cards-sort-dueat
-          i.fa.fa-calendar.colorful
-          | {{_ 'myCardsSortChange-choice-dueat'}}
-          if $eq Utils.myCardsSort "dueAt"
-            i.fa.fa-check
+  if currentUser
+    ul.pop-over-list
+      li
+        with "my-cards-sort-board"
+          a.js-my-cards-sort-board
+            i.fa.fa-th-large.colorful
+            | {{_ 'myCardsSortChange-choice-board'}}
+            if $eq Utils.myCardsSort "board"
+              i.fa.fa-check
+      hr
+      li
+        with "my-cards-sort-dueat"
+          a.js-my-cards-sort-dueat
+            i.fa.fa-calendar.colorful
+            | {{_ 'myCardsSortChange-choice-dueat'}}
+            if $eq Utils.myCardsSort "dueAt"
+              i.fa.fa-check