summaryrefslogtreecommitdiffstats
path: root/client/components/activities/activities.jade
blob: fad147fcd80edac81424aae2313fc0962d1bf182 (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
template(name="activities")
  .activities.js-sidebar-activities
    //- We should use Template.dynamic here but there is a bug with
    //- blaze-components: https://github.com/peerlibrary/meteor-blaze-components/issues/30
    if $eq mode "board"
      +boardActivities
    else
      +cardActivities

template(name="boardActivities")
  each currentBoard.activities
    .activity
      +userAvatar(userId=user._id)
      p.activity-desc
        +memberName(user=user)

        if($eq activityType 'addAttachment')
          | {{{_ 'activity-attached' attachmentLink cardLink}}}.

        if($eq activityType 'addBoardMember')
          | {{{_ 'activity-added' memberLink boardLabel}}}.

        if($eq activityType 'addComment')
          | {{{_ 'activity-on' cardLink}}}
          a.activity-comment(href="{{ card.absoluteUrl }}")
            +viewer
              = comment.text

        if($eq activityType 'addChecklist')
          | {{{_ 'activity-checklist-added' cardLink}}}.
          .activity-checklist(href="{{ card.absoluteUrl }}")
            +viewer
              = checklist.title

        if($eq activityType 'archivedCard')
          | {{{_ 'activity-archived' cardLink}}}.

        if($eq activityType 'archivedList')
          | {{_ 'activity-archived' list.title}}.

        if($eq activityType 'createBoard')
          | {{_ 'activity-created' boardLabel}}.

        if($eq activityType 'createCard')
          | {{{_ 'activity-added' cardLink boardLabel}}}.

        if($eq activityType 'createList')
          | {{_ 'activity-added' list.title boardLabel}}.

        if($eq activityType 'removeList')
          | {{_ 'activity-removed' title boardLabel}}.

        if($eq activityType 'importBoard')
          | {{{_ 'activity-imported-board' boardLabel sourceLink}}}.

        if($eq activityType 'importCard')
          | {{{_ 'activity-imported' cardLink boardLabel sourceLink}}}.

        if($eq activityType 'importList')
          | {{{_ 'activity-imported' listLabel boardLabel sourceLink}}}.

        if($eq activityType 'joinMember')
          if($eq user._id member._id)
            | {{{_ 'activity-joined' cardLink}}}.
          else
            | {{{_ 'activity-added' memberLink cardLink}}}.

        if($eq activityType 'moveCard')
          | {{{_ 'activity-moved' cardLink oldList.title list.title}}}.

        if($eq activityType 'removeBoardMember')
          | {{{_ 'activity-excluded' memberLink boardLabel}}}.

        if($eq activityType 'restoredCard')
          | {{{_ 'activity-sent' cardLink boardLabel}}}.

        if($eq activityType 'unjoinMember')
          if($eq user._id member._id)
            | {{{_ 'activity-unjoined' cardLink}}}.
          else
            | {{{_ 'activity-removed' memberLink cardLink}}}.

        span(title=createdAt).activity-meta {{ moment createdAt }}

template(name="cardActivities")
  each currentCard.activities
    .activity
      +userAvatar(userId=user._id)
      p.activity-desc
        +memberName(user=user)
        if($eq activityType 'createCard')
          | {{_ 'activity-added' cardLabel list.title}}.
        if($eq activityType 'importCard')
          | {{{_ 'activity-imported' cardLabel list.title sourceLink}}}.
        if($eq activityType 'joinMember')
          if($eq user._id member._id)
            | {{_ 'activity-joined' cardLabel}}.
          else
            | {{{_ 'activity-added' memberLink cardLabel}}}.
        if($eq activityType 'unjoinMember')
          if($eq user._id member._id)
            | {{_ 'activity-unjoined' cardLabel}}.
          else
            | {{{_ 'activity-removed' cardLabel memberLink}}}.
        if($eq activityType 'archivedCard')
          | {{_ 'activity-archived' cardLabel}}.
        if($eq activityType 'restoredCard')
          | {{_ 'activity-sent' cardLabel boardLabel}}.
        if($eq activityType 'moveCard')
          | {{_ 'activity-moved' cardLabel oldList.title list.title}}.
        if($eq activityType 'addAttachment')
          | {{{_ 'activity-attached' attachmentLink cardLabel}}}.
          if attachment.isImage
            img.attachment-image-preview(src=attachment.url)
        if($eq activityType 'addChecklist')
          | {{{_ 'activity-checklist-added' cardLabel}}}.
          .activity-checklist
            +viewer
              = checklist.title

        if($eq activityType 'addComment')
          +inlinedForm(classNames='js-edit-comment')
            +editor(autofocus=true)
              = comment.text
            .edit-controls
              button.primary(type="submit") {{_ 'edit'}}
          else
            .activity-comment
              +viewer
                = comment.text
            span(title=createdAt).activity-meta {{ moment createdAt }}
              if ($eq currentUser._id comment.userId)
                = ' - '
                a.js-open-inlined-form {{_ "edit"}}
                = ' - '
                a.js-delete-comment {{_ "delete"}}

        else
          span(title=createdAt).activity-meta {{ moment createdAt }}