summaryrefslogtreecommitdiffstats
path: root/client/components/activities/activities.jade
blob: c86936a019026df08075bdf222aad57fcd6a3f97 (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
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 activityData in currentBoard.activities
    +activity(activity=activityData card=card mode=mode)

template(name="cardActivities")
  each activityData in currentCard.activities
    +activity(activity=activityData card=card mode=mode)

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

      //- attachment activity -------------------------------------------------
      if($eq activity.activityType 'deleteAttachment')
        | {{{_ 'activity-delete-attach' cardLink}}}.

      if($eq activity.activityType 'addAttachment')
        | {{{_ 'activity-attached' attachmentLink cardLink}}}.
        if($neq mode 'board')
          if activity.attachment.isImage
            img.attachment-image-preview(src=activity.attachment.url)

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

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

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

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

      //- card activity -------------------------------------------------------
      if($eq activity.activityType 'createCard')
        if($eq mode 'card')
          | {{{_ 'activity-added' cardLabel activity.listName}}}.
        else
          | {{{_ 'activity-added' cardLabel boardLabel}}}.

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

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

      if($eq activity.activityType 'moveCardBoard')
        | {{{_ 'activity-moved' cardLink activity.oldBoardName activity.boardName}}}.

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

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

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

      if($eq activity.activityType 'removedChecklist')
        | {{{_ 'activity-checklist-removed' cardLink}}}.

      if($eq activity.activityType 'completeChecklist')
        | {{{_ 'activity-checklist-completed' activity.checklist.title cardLink}}}.

      if($eq activity.activityType 'uncompleteChecklist')
        | {{{_ 'activity-checklist-uncompleted' activity.checklist.title cardLink}}}.

      if($eq activity.activityType 'checkedItem')
        | {{{_ 'activity-checked-item' checkItem activity.checklist.title cardLink}}}.

      if($eq activity.activityType 'uncheckedItem')
        | {{{_ 'activity-unchecked-item' checkItem activity.checklist.title cardLink}}}.

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

      if($eq activity.activityType 'removedChecklistItem')
        | {{{_ 'activity-checklist-item-removed' activity.checklist.title cardLink}}}.

      //- comment activity ----------------------------------------------------
      if($eq mode 'card')
        //- if we are in card mode we display the comment in a way that it
        //- can be edited by the owner
        if($eq activity.activityType 'addComment')
          +inlinedForm(classNames='js-edit-comment')
            +editor(autofocus=true)
              = activity.comment.text
            .edit-controls
              button.primary(type="submit") {{_ 'edit'}}
          else
            .activity-comment
              +viewer
                = activity.comment.text
            span(title=activity.createdAt).activity-meta {{ moment activity.createdAt }}
              if ($eq currentUser._id activity.comment.userId)
                = ' - '
                a.js-open-inlined-form {{_ "edit"}}
                = ' - '
                a.js-delete-comment {{_ "delete"}}

        if($eq activity.activityType 'deleteComment')
          | {{{_ 'activity-deleteComment' currentData.commentId}}}.

        if($eq activity.activityType 'editComment')
          | {{{_ 'activity-editComment' currentData.commentId}}}.
      else
        //- if we are not in card mode we only display a summary of the comment
        if($eq activity.activityType 'addComment')
          | {{{_ 'activity-on' cardLink}}}
          a.activity-comment(href="{{ activity.card.absoluteUrl }}")
            +viewer
              = activity.comment.text

      //- customField activity ------------------------------------------------
      if($eq mode 'board')
        if($eq activity.activityType 'createCustomField')
          | {{_ 'activity-customfield-created' customField}}.

        if($eq activity.activityType 'setCustomField')
          | {{{_ 'activity-set-customfield' lastCustomField lastCustomFieldValue cardLink}}}.

        if($eq activity.activityType 'unsetCustomField')
          | {{{_ 'activity-unset-customfield' lastCustomField cardLink}}}.

      //- label activity ------------------------------------------------------
      if($eq activity.activityType 'addedLabel')
        | {{{_ 'activity-added-label' lastLabel cardLink}}}.

      if($eq activity.activityType 'removedLabel')
        | {{{_ 'activity-removed-label' lastLabel cardLink}}}.

      //- list activity -------------------------------------------------------
      if($neq mode 'card')
        if($eq activity.activityType 'createList')
          | {{{_ 'activity-added' listLabel boardLabel}}}.

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

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

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

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

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

      //- swimlane activity --------------------------------------------------
      if($neq mode 'card')
        if($eq activity.activityType 'createSwimlane')
          | {{{_ 'activity-added' activity.swimlane.title boardLabel}}}.

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


      //- I don't understand this part ----------------------------------------
      if(currentData.timeKey)
        | {{{_ activity.activityType }}}
        = ' '
        i(title=currentData.timeValue).activity-meta {{ moment currentData.timeValue 'LLL' }}
        if (currentData.timeOldValue)
          = ' '
            | {{{_ "previous_as" }}}
            = ' '
            i(title=currentData.timeOldValue).activity-meta {{ moment currentData.timeOldValue 'LLL' }}
        = ' @'
      else if(currentData.timeValue)
        | {{{_ activity.activityType currentData.timeValue}}}

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