summaryrefslogtreecommitdiffstats
path: root/client/components/cards/cardDetails.jade
blob: b4259ae6b6cd3299e8789c99ee327977bb971dce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
template(name="cardDetails")
  section.card-details.js-card-details.js-perfect-scrollbar: .card-details-canvas
    .card-details-header(class='{{#if colorClass}}card-details-{{colorClass}}{{/if}}')
      +inlinedForm(classNames="js-card-details-title")
        +editCardTitleForm
      else
        unless isMiniScreen
          a.fa.fa-times-thin.close-card-details.js-close-card-details
          if currentUser.isBoardMember
            a.fa.fa-navicon.card-details-menu.js-open-card-details-menu
            input.inline-input(type="text" id="cardURL_copy" value="{{ absoluteUrl }}")
            a.fa.fa-link.card-copy-button.js-copy-link(
              class="fa-link"
              title="{{_ 'copy-card-link-to-clipboard'}}"
              value="{{ absoluteUrl }}"
            )
        if isMiniScreen
          a.fa.fa-times-thin.close-card-details-mobile-web.js-close-card-details
          if currentUser.isBoardMember
            a.fa.fa-navicon.card-details-menu-mobile-web.js-open-card-details-menu
            a.fa.fa-link.card-copy-mobile-button
        h2.card-details-title.js-card-title(
          class="{{#if canModifyCard}}js-open-inlined-form is-editable{{/if}}")
            +viewer
              = getTitle
            if isWatching
              i.card-details-watch.fa.fa-eye
        .card-details-path
          each parentList
            |   >  
            a.js-parent-card(href=linkForCard) {{title}}
          // else
            {{_ 'top-level-card'}}
        if isLinkedCard
          a.linked-card-location.js-go-to-linked-card
            +viewer
              | {{getBoardTitle}} > {{getTitle}}

    if getArchived
      if isLinkedBoard
        p.warning {{_ 'board-archived'}}
      else
        p.warning {{_ 'card-archived'}}

    .card-details-items
      if currentBoard.allowsReceivedDate
        .card-details-item.card-details-item-received
          h3
            i.fa.fa-sign-out
            card-details-item-title {{_ 'card-received'}}
          if getReceived
            +cardReceivedDate
          else
            if canModifyCard
              unless currentUser.isWorker
                a.card-label.add-label.js-received-date
                  i.fa.fa-plus

      if currentBoard.allowsStartDate
        .card-details-item.card-details-item-start
          h3
            i.fa.fa-hourglass-start
            card-details-item-title {{_ 'card-start'}}
          if getStart
            +cardStartDate
          else
            if canModifyCard
              unless currentUser.isWorker
                a.card-label.add-label.js-start-date
                  i.fa.fa-plus

      if currentBoard.allowsDueDate
        .card-details-item.card-details-item-due
          h3
            i.fa.fa-sign-in
            card-details-item-title {{_ 'card-due'}}
          if getDue
            +cardDueDate
          else
            if canModifyCard
              unless currentUser.isWorker
                a.card-label.add-label.js-due-date
                  i.fa.fa-plus

      if currentBoard.allowsEndDate
        .card-details-item.card-details-item-end
          h3
            i.fa.fa-hourglass-end
            card-details-item-title {{_ 'card-end'}}
          if getEnd
            +cardEndDate
          else
            if canModifyCard
              unless currentUser.isWorker
                a.card-label.add-label.js-end-date
                  i.fa.fa-plus

      //.card-details-items
      if currentBoard.allowsMembers
        .card-details-item.card-details-item-members
          h3
            i.fa.fa-users
            card-details-item-title {{_ 'members'}}
          each getMembers
            +userAvatar(userId=this cardId=../_id)
            | {{! XXX Hack to hide syntaxic coloration /// }}
          if canModifyCard
            unless currentUser.isWorker
              a.member.add-member.card-details-item-add-button.js-add-members(title="{{_ 'card-members-title'}}")
                i.fa.fa-plus

      //if assigneeSelected
      if currentBoard.allowsAssignee
        .card-details-item.card-details-item-assignees
          h3
            i.fa.fa-user
            card-details-item-title {{_ 'assignee'}}
          each getAssignees
            +userAvatarAssignee(userId=this cardId=../_id)
            | {{! XXX Hack to hide syntaxic coloration /// }}
          if canModifyCard
            a.assignee.add-assignee.card-details-item-add-button.js-add-assignees(title="{{_ 'assignee'}}")
              i.fa.fa-plus
          if currentUser.isWorker
            unless assigneeSelected
              a.assignee.add-assignee.card-details-item-add-button.js-add-assignees(title="{{_ 'assignee'}}")
                i.fa.fa-plus

      if currentBoard.allowsLabels
        .card-details-item.card-details-item-labels
          h3
            i.fa.fa-tags
            card-details-item-title {{_ 'labels'}}
          a(class="{{#if canModifyCard}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
            each labels
              span.card-label(class="card-label-{{color}}" title=name)
                +viewer
                  = name
          if canModifyCard
            unless currentUser.isWorker
              a.card-label.add-label.js-add-labels(title="{{_ 'card-labels-title'}}")
                i.fa.fa-plus

      //.card-details-items
      each customFieldsWD
        .card-details-item.card-details-item-customfield
          h3.card-details-item-title
            +viewer
              = definition.name
          +cardCustomField

      //.card-details-items
      if getSpentTime
        .card-details-item.card-details-item-spent
          if getIsOvertime
            h3.card-details-item-title {{_ 'overtime-hours'}}
          else
            h3.card-details-item-title {{_ 'spent-time-hours'}}
          +cardSpentTime

      //.card-details-items
      if currentBoard.allowsRequestedBy
        .card-details-item.card-details-item-name
          h3
            i.fa.fa-shopping-cart
            card-details-item-title {{_ 'requested-by'}}
          if canModifyCard
            unless currentUser.isWorker
              +inlinedForm(classNames="js-card-details-requester")
                +editCardRequesterForm
              else
                a.js-open-inlined-form
                  if getRequestedBy
                    +viewer
                      = getRequestedBy
                  else
                    | {{_ 'add'}}
          else if getRequestedBy
            +viewer
              = getRequestedBy

      if currentBoard.allowsAssignedBy
        .card-details-item.card-details-item-name
          h3
            i.fa.fa-user-plus
            card-details-item-title {{_ 'assigned-by'}}
          if canModifyCard
            unless currentUser.isWorker
              +inlinedForm(classNames="js-card-details-assigner")
                +editCardAssignerForm
              else
                a.js-open-inlined-form
                  if getAssignedBy
                    +viewer
                      = getAssignedBy
                  else
                    | {{_ 'add'}}
          else if getRequestedBy
            +viewer
              = getAssignedBy

    if getVoteQuestion
      hr
      .vote-title
        h3
          i.fa.fa-thumbs-up
          card-details-item-title {{_ 'vote-question'}}
        .vote-result
          if votePublic
            a.card-label.card-label-green.js-show-positive-votes {{ voteCountPositive }}
            a.card-label.card-label-red.js-show-negative-votes {{ voteCountNegative }}
          else
            .card-label.card-label-green {{ voteCountPositive }}
            .card-label.card-label-red {{ voteCountNegative }}
          unless ($and currentBoard.isPublic voteAllowNonBoardMembers )
            .card-label.card-label-gray  {{ voteCount }} {{_ 'r-of' }} {{ currentBoard.activeMembers.length }}
      +viewer
        = getVoteQuestion
      button.card-details-green.js-vote.js-vote-positive(class="{{#if voteState}}voted{{/if}}") {{_ 'vote-for-it'}}
      button.card-details-red.js-vote.js-vote-negative(class="{{#if $eq voteState false}}voted{{/if}}") {{_ 'vote-against'}}

    //- XXX We should use "editable" to avoid repetiting ourselves
    if canModifyCard
      unless currentUser.isWorker
        if currentBoard.allowsDescriptionTitle
          hr
          h3
            i.fa.fa-align-left
            card-details-item-title {{_ 'description'}}
        if currentBoard.allowsDescriptionText
          +inlinedCardDescription(classNames="card-description js-card-description")
            +editor(autofocus=true)
              | {{getUnsavedValue 'cardDescription' _id getDescription}}
            .edit-controls.clearfix
              button.primary(type="submit") {{_ 'save'}}
              a.fa.fa-times-thin.js-close-inlined-form
          else
            if currentBoard.allowsDescriptionText
              a.js-open-inlined-form
                if getDescription
                  +viewer
                    = getDescription
                else
                  | {{_ 'edit'}}
              if (hasUnsavedValue 'cardDescription' _id)
                p.quiet
                  | {{_ 'unsaved-description'}}
                  a.js-open-inlined-form {{_ 'view-it'}}
                  = ' - '
                  a.js-close-inlined-form {{_ 'discard'}}
    else if getDescription
      if currentBoard.allowsDescriptionTitle
        hr
        h3.card-details-item-title {{_ 'description'}}
      if currentBoard.allowsDescriptionText
        +viewer
          = getDescription

    .card-checklist-attachmentGalerys
      .card-checklist-attachmentGalery.card-checklists
        if currentBoard.allowsChecklists
          hr
          +checklists(cardId = _id)
        if currentBoard.allowsSubtasks
          hr
          +subtasks(cardId = _id)
      if currentBoard.allowsAttachments
        hr
        h3
          i.fa.fa-paperclip
          | {{_ 'attachments'}}
        .card-checklist-attachmentGalery.card-attachmentGalery
          +attachmentsGalery

    hr
    unless currentUser.isNoComments
      .activity-title
        h3
          i.fa.fa-history
          | {{ _ 'activity'}}
        if currentUser.isBoardMember
          .material-toggle-switch
            span.toggle-switch-title {{_ 'hide-system-messages'}}
            if hiddenSystemMessages
              input.toggle-switch(type="checkbox" id="toggleButton" checked="checked")
            else
              input.toggle-switch(type="checkbox" id="toggleButton")
            label.toggle-label(for="toggleButton")
    if currentBoard.allowsComments
      if currentUser.isBoardMember
        unless currentUser.isNoComments
          +commentForm
    unless currentUser.isNoComments
      if isLoaded.get
        if isLinkedCard
          +activities(card=this mode="linkedcard")
        else if isLinkedBoard
          +activities(card=this mode="linkedboard")
        else
          +activities(card=this mode="card")

template(name="editCardTitleForm")
  textarea.js-edit-card-title(rows='1' autofocus dir="auto")
    = getTitle
  .edit-controls.clearfix
    button.primary.confirm.js-submit-edit-card-title-form(type="submit") {{_ 'save'}}
    a.fa.fa-times-thin.js-close-inlined-form

template(name="editCardRequesterForm")
  input.js-edit-card-requester(type='text' autofocus value=getRequestedBy dir="auto")
  .edit-controls.clearfix
    button.primary.confirm.js-submit-edit-card-requester-form(type="submit") {{_ 'save'}}
    a.fa.fa-times-thin.js-close-inlined-form

template(name="editCardAssignerForm")
  input.js-edit-card-assigner(type='text' autofocus value=getAssignedBy dir="auto")
  .edit-controls.clearfix
    button.primary.confirm.js-submit-edit-card-assigner-form(type="submit") {{_ 'save'}}
    a.fa.fa-times-thin.js-close-inlined-form

template(name="cardDetailsActionsPopup")
  ul.pop-over-list
    li
      a.js-toggle-watch-card
        if isWatching
          i.fa.fa-eye
          |  {{_ 'unwatch'}}
        else
          i.fa.fa-eye-slash
          |  {{_ 'watch'}}
  if canModifyCard
    unless currentUser.isWorker
      hr
      ul.pop-over-list
        //li: a.js-members {{_ 'card-edit-members'}}
        //li: a.js-labels {{_ 'card-edit-labels'}}
        //li: a.js-attachments {{_ 'card-edit-attachments'}}
        if getVoteQuestion
          li
            a.js-cancel-voting
              i.fa.fa-thumbs-up
              | {{_ 'card-cancel-voting'}}
        else
          li
            a.js-start-voting
              i.fa.fa-thumbs-up
              | {{_ 'card-start-voting'}}
        li
          a.js-custom-fields
            i.fa.fa-list-alt
            | {{_ 'card-edit-custom-fields'}}
        //li: a.js-received-date {{_ 'editCardReceivedDatePopup-title'}}
        //li: a.js-start-date {{_ 'editCardStartDatePopup-title'}}
        //li: a.js-due-date {{_ 'editCardDueDatePopup-title'}}
        //li: a.js-end-date {{_ 'editCardEndDatePopup-title'}}
        li
          a.js-spent-time
            i.fa.fa-clock-o
            | {{_ 'editCardSpentTimePopup-title'}}
        li
          a.js-set-card-color
            i.fa.fa-paint-brush
            | {{_ 'setCardColorPopup-title'}}
      hr
    ul.pop-over-list
      li
        a.js-move-card-to-top
          i.fa.fa-arrow-up
          | {{_ 'moveCardToTop-title'}}
      li
        a.js-move-card-to-bottom
          i.fa.fa-arrow-down
          | {{_ 'moveCardToBottom-title'}}
    unless currentUser.isWorker
      hr
      ul.pop-over-list
        li
          a.js-move-card
            i.fa.fa-arrow-right
            | {{_ 'moveCardPopup-title'}}
        li
          a.js-copy-card
            i.fa.fa-copy
            | {{_ 'copyCardPopup-title'}}
      hr
      ul.pop-over-list
        li
          a.js-copy-checklist-cards
            i.fa.fa-list
            i.fa.fa-copy
            | {{_ 'copyChecklistToManyCardsPopup-title'}}
      unless archived
        hr
        ul.pop-over-list
          li
            a.js-archive
              i.fa.fa-arrow-right
              i.fa.fa-archive
              | {{_ 'archive-card'}}
      hr
      ul.pop-over-list
        li
          a.js-more
            i.fa.fa-link
            | {{_ 'cardMorePopup-title'}}

template(name="moveCardPopup")
  +boardsAndLists

template(name="copyCardPopup")
  label(for='copy-card-title') {{_ 'title'}}:
  textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus)
    = getTitle
  +boardsAndLists

template(name="copyChecklistToManyCardsPopup")
  label(for='copy-checklist-cards-title') {{_ 'copyChecklistToManyCardsPopup-instructions'}}:
  textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus)
    | {{_ 'copyChecklistToManyCardsPopup-format'}}
  +boardsAndLists

template(name="boardsAndLists")
  label {{_ 'boards'}}:
  select.js-select-boards(autofocus)
    each boards
      if $eq _id currentBoard._id
        option(value="{{_id}}" selected) {{_ 'current'}}
      else
        option(value="{{_id}}") {{title}}

  label {{_ 'swimlanes'}}:
  select.js-select-swimlanes
    each swimlanes
      option(value="{{_id}}") {{title}}

  label {{_ 'lists'}}:
  select.js-select-lists
    each aBoardLists
      option(value="{{_id}}") {{title}}

  .edit-controls.clearfix
    button.primary.confirm.js-done {{_ 'done'}}

template(name="cardMembersPopup")
  ul.pop-over-list.js-card-member-list
    each board.activeMembers
      li.item(class="{{#if isCardMember}}active{{/if}}")
        a.name.js-select-member(href="#")
          +userAvatar(userId=user._id)
          span.full-name
            = user.profile.fullname
            | (<span class="username">{{ user.username }}</span>)
          if isCardMember
            i.fa.fa-check

template(name="cardAssigneesPopup")
  unless currentUser.isWorker
    ul.pop-over-list.js-card-assignee-list
      each board.activeMembers
        li.item(class="{{#if isCardAssignee}}active{{/if}}")
          a.name.js-select-assignee(href="#")
            +userAvatar(userId=user._id)
            span.full-name
              = user.profile.fullname
              | (<span class="username">{{ user.username }}</span>)
            if isCardAssignee
              i.fa.fa-check
  if currentUser.isWorker
    ul.pop-over-list.js-card-assignee-list
        li.item(class="{{#if currentUser.isCardAssignee}}active{{/if}}")
          a.name.js-select-assignee(href="#")
            +userAvatar(userId=currentUser._id)
            span.full-name
              = currentUser.profile.fullname
              | (<span class="username">{{ currentUser.username }}</span>)
            if currentUser.isCardAssignee
              i.fa.fa-check

template(name="userAvatarAssignee")
  a.assignee.js-assignee(title="{{userData.profile.fullname}} ({{userData.username}})")
    if userData.profile.avatarUrl
      img.avatar.avatar-image(src="{{userData.profile.avatarUrl}}")
    else
      +userAvatarAssigneeInitials(userId=userData._id)

    if showStatus
      span.assignee-presence-status(class=presenceStatusClassName)
      span.member-type(class=memberType)

    unless isSandstorm
      if showEdit
        if $eq currentUser._id userData._id
          a.edit-avatar.js-change-avatar
            i.fa.fa-pencil

template(name="cardAssigneePopup")
  .board-assignee-menu
    .mini-profile-info
      +userAvatar(userId=user._id showEdit=true)
      .info
        h3= user.profile.fullname
        p.quiet @{{ user.username }}
    ul.pop-over-list
      if currentUser.isNotCommentOnly
        unless currentUser.isWorker
          li: a.js-remove-assignee {{_ 'remove-member-from-card'}}

      unless currentUser.isWorker
        if $eq currentUser._id user._id
          with currentUser
            li: a.js-edit-profile {{_ 'edit-profile'}}

template(name="userAvatarAssigneeInitials")
  svg.avatar.avatar-assignee-initials(viewBox="0 0 {{viewPortWidth}} 15")
    text(x="50%" y="13" text-anchor="middle")= initials

template(name="cardMorePopup")
  p.quiet
    span.clearfix
      span {{_ 'link-card'}}
      = ' '
      i.fa.colorful(class="{{#if board.isPublic}}fa-globe{{else}}fa-lock{{/if}}")
      input.inline-input(type="text" id="cardURL" readonly value="{{ absoluteUrl }}" autofocus="autofocus")
      button.js-copy-card-link-to-clipboard(class="btn") {{_ 'copy-card-link-to-clipboard'}}
    span.clearfix
    br
    h2 {{_ 'change-card-parent'}}
    label {{_ 'source-board'}}:
      select.js-field-parent-board
        if isTopLevel
          option(value="none" selected) {{_ 'custom-field-dropdown-none'}}
        else
          option(value="none") {{_ 'custom-field-dropdown-none'}}
        each boards
          if isParentBoard
            option(value="{{_id}}" selected) {{title}}
          else
            option(value="{{_id}}") {{title}}

    label {{_ 'parent-card'}}:
      select.js-field-parent-card
        if isTopLevel
          option(value="none" selected) {{_ 'custom-field-dropdown-none'}}
        else
          option(value="none") {{_ 'custom-field-dropdown-none'}}
          each cards
            if isParentCard
              option(value="{{_id}}" selected) {{title}}
            else
              option(value="{{_id}}") {{title}}
    br
    | {{_ 'added'}}
    span.date(title=card.createdAt) {{ moment createdAt 'LLL' }}
    a.js-delete(title="{{_ 'card-delete-notice'}}") {{_ 'delete'}}

template(name="setCardColorPopup")
  form.edit-label
    .palette-colors: each colors
      unless $eq color 'white'
        span.card-label.palette-color.js-palette-color(class="card-details-{{color}}")
          if(isSelected color)
            i.fa.fa-check
    button.primary.confirm.js-submit {{_ 'save'}}
    button.js-remove-color.negate.wide.right {{_ 'unset-color'}}

template(name="cardDeletePopup")
  p {{_ "card-delete-pop"}}
  unless archived
   p {{_ "card-delete-suggest-archive"}}
  button.js-confirm.negate.full(type="submit") {{_ 'delete'}}

template(name="cardStartVotingPopup")
  form.edit-vote-question
    .fields
      label(for="vote") {{_ 'vote-question'}}
      input.js-vote-field#vote(type="text" name="vote" value="{{card.getVoteQuestion}}" autofocus)
      .check-div
        a.flex.js-toggle-vote-public
          .materialCheckBox#vote-public(name="vote-public")
          span {{_ 'vote-public'}}
      .check-div
        a.flex.js-toggle-vote-allow-non-members
          .materialCheckBox#vote-allow-non-members(name="vote-allow-non-members")
          span {{_ 'allowNonBoardMembers'}}
    button.primary.confirm.js-submit {{_ 'save'}}

template(name="positiveVoteMembersPopup")
  ul.pop-over-list.js-card-member-list
    each m in voteMemberPositive
      li.item
        a.name
          +userAvatar(userId=m._id)
          span.full-name
            = m.profile.fullname
            | (<span class="username">{{ m.username }}</span>)

template(name="negativeVoteMembersPopup")
  ul.pop-over-list.js-card-member-list
    each m in voteMemberNegative
      li.item
        a.name
          +userAvatar(userId=m._id)
          span.full-name
            = m.profile.fullname
            | (<span class="username">{{ m.username }}</span>)