浏览代码

displays the name of the modifier too

Alexis CLEMENT 8 年前
父节点
当前提交
108e195898

+ 4 - 0
tracim/tracim/model/data.py 查看文件

@@ -1043,6 +1043,10 @@ class Content(DeclarativeBase):
1043 1043
         return self.revisions[0]  # FIXME
1044 1044
 
1045 1045
     @property
1046
+    def last_revision(self) -> ContentRevisionRO:
1047
+        return self.revisions[-1]
1048
+
1049
+    @property
1046 1050
     def is_editable(self) -> bool:
1047 1051
         return not self.is_archived and not self.is_deleted
1048 1052
 

+ 2 - 0
tracim/tracim/model/serializers.py 查看文件

@@ -392,6 +392,7 @@ def serialize_node_for_page(content: Content, context: Context):
392 392
             label=data_container.label,
393 393
             icon=ContentType.get_icon(content.type),
394 394
             owner=context.toDict(content.first_revision.owner),
395
+            last_author=context.toDict(content.last_revision.owner),
395 396
             status=context.toDict(data_container.get_status()),
396 397
             links=[],
397 398
             revision_nb = len(content.revisions),
@@ -463,6 +464,7 @@ def serialize_node_for_thread(item: Content, context: Context):
463 464
             label = item.label,
464 465
             links=[],
465 466
             owner = context.toDict(item.owner),
467
+            last_author=context.toDict(item.last_revision.owner),
466 468
             parent = context.toDict(item.parent),
467 469
             selected_revision = 'latest',
468 470
             status = context.toDict(item.get_status()),

+ 7 - 4
tracim/tracim/templates/file/getone.mak 查看文件

@@ -52,10 +52,13 @@
52 52
             <div style="margin: -1.5em auto -1.5em auto;" class="tracim-less-visible">
53 53
                 <% created_localized = h.get_with_timezone(result.file.created) %>
54 54
                 <% updated_localized = h.get_with_timezone(result.file.updated) %>
55
-              <p>${_('file created on {date} at {time} by <b>{author}</b>').format(date=h.date(created_localized), time=h.time(created_localized), author=result.file.owner.name)|n}</p>
56
-              % if result.file.revision_nb > 1:
57
-                  <p>${_(' (last modification on {update_date} at {update_time})').format(update_date=h.update_date(updated_localized), update_time=h.update_time(updated_localized))|n}</p>
58
-              % endif
55
+                <% last_author = result.file.last_author.name %>
56
+              <p>${_('file created on {date} at {time} by <b>{author}</b>').format(date=h.date(created_localized), time=h.time(created_localized), author=result.file.owner.name)|n}
57
+                  % if result.file.revision_nb > 1:
58
+                      ${_(' (last modification on {update_date} at {update_time} by {last_author})').format(update_date=h.update_date(updated_localized), update_time=h.update_time(updated_localized), last_author = last_author)|n}
59
+                  % endif
60
+              </p>
61
+
59 62
             </div>
60 63
         </div>
61 64
     </div>

+ 7 - 4
tracim/tracim/templates/page/getone.mak 查看文件

@@ -50,10 +50,13 @@
50 50
             <div style="margin: -1.5em auto -1.5em auto;" class="tracim-less-visible">
51 51
                 <% created_localized = h.get_with_timezone(result.page.created) %>
52 52
                 <% updated_localized = h.get_with_timezone(result.page.updated) %>
53
-                <p>${_('page created on {date} at {time} by <b>{author}</b> ').format(date=h.date(created_localized), time=h.time(created_localized), author=result.page.owner.name)|n}</p>
54
-              % if result.page.revision_nb > 1:
55
-                  <p>${_(' (last modification on {update_date} at {update_time})').format(update_date=h.update_date(updated_localized), update_time=h.update_time(updated_localized))|n}</p>
56
-              % endif
53
+                <% last_author = result.page.last_author.name %>
54
+                <p>
55
+                    ${_('page created on {date} at {time} by <b>{author}</b> ').format(date=h.date(created_localized), time=h.time(created_localized), author=result.page.owner.name)|n}
56
+                    % if result.page.revision_nb > 1:
57
+                      ${_('(last modification on {update_date} at {update_time} by {last_author})').format(update_date=h.update_date(updated_localized), update_time=h.update_time(updated_localized), last_author = last_author)|n}
58
+                    % endif
59
+                </p>
57 60
             </div>
58 61
         </div>
59 62
     </div>

+ 7 - 4
tracim/tracim/templates/thread/getone.mak 查看文件

@@ -52,10 +52,13 @@
52 52
             <div style="margin: -1.5em auto -1.5em auto;" class="tracim-less-visible">
53 53
                 <% created_localized = h.get_with_timezone(result.thread.created) %>
54 54
                 <% updated_localized = h.get_with_timezone(result.thread.updated) %>
55
-                <p>${_('page created on {date} at {time} by <b>{author}</b>').format(date=h.date(created_localized), time=h.time(created_localized), author=result.thread.owner.name)|n}</p>
56
-                % if result.thread.revision_nb > 1:
57
-                  <p>${_(' (last modification on {update_date} at {update_time})').format(update_date=h.update_date(updated_localized), update_time=h.update_time(updated_localized))|n}</p>
58
-              % endif
55
+                <% last_author = result.thread.last_author.name %>
56
+                <p>${_('page created on {date} at {time} by <b>{author}</b>').format(date=h.date(created_localized), time=h.time(created_localized), author=result.thread.owner.name)|n}
57
+                    % if result.thread.revision_nb > 1:
58
+                      ${_(' (last modification on {update_date} at {update_time} by {last_author})').format(update_date=h.update_date(updated_localized), update_time=h.update_time(updated_localized), last_author = last_author)|n}
59
+                    % endif
60
+                </p>
61
+
59 62
         </div>
60 63
     </div>
61 64