Browse Source

[closes #56] added a button to invert thread messages order

Come 8 years ago
parent
commit
66e9155549

+ 7 - 3
tracim/tracim/controllers/content.py View File

@@ -527,7 +527,7 @@ class UserWorkspaceFolderThreadRestController(TIMWorkspaceContentRestController)
527 527
 
528 528
     @tg.require(current_user_is_reader())
529 529
     @tg.expose('tracim.templates.thread.getone')
530
-    def get_one(self, thread_id):
530
+    def get_one(self, thread_id, inverted: str=''):
531 531
         thread_id = int(thread_id)
532 532
         user = tmpl_context.current_user
533 533
         workspace = tmpl_context.workspace
@@ -543,7 +543,11 @@ class UserWorkspaceFolderThreadRestController(TIMWorkspaceContentRestController)
543 543
         fake_api = Context(CTX.FOLDER).toDict(fake_api_content)
544 544
 
545 545
         dictified_thread = Context(CTX.THREAD).toDict(thread, 'thread')
546
-        return DictLikeClass(result = dictified_thread, fake_api=fake_api)
546
+
547
+        if inverted:
548
+          dictified_thread.thread.history = reversed(dictified_thread.thread.history)
549
+
550
+        return DictLikeClass(result=dictified_thread, fake_api=fake_api, inverted=inverted)
547 551
 
548 552
 
549 553
 
@@ -949,4 +953,4 @@ class UserWorkspaceFolderRestController(TIMRestControllerWithBreadcrumb):
949 953
             back_url = self._parent_url.format(item.workspace_id, item.parent_id)
950 954
             msg = _('{} not un-deleted: {}').format(self._item_type_label, str(e))
951 955
             tg.flash(msg, CST.STATUS_ERROR)
952
-            tg.redirect(back_url)
956
+            tg.redirect(back_url)

+ 4 - 0
tracim/tracim/i18n/fr/LC_MESSAGES/tracim.po View File

@@ -1965,6 +1965,10 @@ msgstr ""
1965 1965
 msgid "Post a reply..."
1966 1966
 msgstr "Poster une réponse..."
1967 1967
 
1968
+#: tracim/templates/thread/getone.mak:97
1969
+msgid "Invert order"
1970
+msgstr "Inverser l'ordre"
1971
+
1968 1972
 #: tracim/templates/thread/toolbar.mak:16
1969 1973
 msgid "Edit current thread"
1970 1974
 msgstr "Modifier le sujet de discussion"

+ 8 - 0
tracim/tracim/public/assets/css/dashboard.css View File

@@ -382,3 +382,11 @@ span.info.readonly {
382 382
 .no-padding {
383 383
     padding: 0px;
384 384
 }
385
+.threads-history-reverse {
386
+  float: right;
387
+  padding: 10px 15px 0 0;
388
+  font-size: 16px;
389
+}
390
+.threads-history-reverse > i {
391
+  font-size: 12px;
392
+}

+ 12 - 0
tracim/tracim/templates/thread/getone.mak View File

@@ -85,6 +85,17 @@
85 85
 
86 86
 <div class="row">
87 87
     <div class="col-sm-7 col-sm-offset-3">
88
+        <div class="threads-history-reverse">
89
+        % if inverted:
90
+            <a href="${tg.url('/workspaces/{}/folders/{}/threads/{}'.format(result.thread.workspace.id, result.thread.parent.id, result.thread.id))}">
91
+                <i class="fa fa-chevron-down" aria-hidden="true"></i>
92
+        % else:
93
+            <a href="${tg.url('/workspaces/{}/folders/{}/threads/{}?inverted=1'.format(result.thread.workspace.id, result.thread.parent.id, result.thread.id))}">
94
+                <i class="fa fa-chevron-up" aria-hidden="true"></i>
95
+        % endif
96
+                ${_('Invert order')}
97
+            </a>
98
+        </div>
88 99
         % if h.user_role(fake_api.current_user, result.thread.workspace)<=1:
89 100
             ## READONLY USER
90 101
             <% a = 'b' %>
@@ -101,6 +112,7 @@
101 112
     </div>
102 113
 </div>
103 114
 
115
+<!-- % for event in reversed(result.thread.history): -->
104 116
 % for event in result.thread.history:
105 117
     ## TODO - D.A. - 2015-08-20
106 118
     ## Allow to show full history (with status change and archive/unarchive)