Browse Source

Merge branch 'master' of github.com:tracim/tracim

Bastien Sevajol (Algoo) 8 years ago
parent
commit
20e8023bf8

+ 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
+}

+ 4 - 4
tracim/tracim/templates/file/toolbar.mak View File

@@ -11,28 +11,28 @@
11 11
 
12 12
     <% download_url = tg.url('/workspaces/{}/folders/{}/files/{}/download?revision_id={}'.format(result.file.workspace.id, result.file.parent.id,result.file.id,result.file.selected_revision)) %>
13 13
     <% edit_disabled = ('', 'disabled')[file.selected_revision!='latest' or file.status.id[:6]=='closed'] %>
14
-    <% delete_or_archive_disabled = ('', 'disabled')[file.selected_revision!='latest'] %> 
14
+    <% delete_or_archive_disabled = ('', 'disabled')[file.selected_revision!='latest'] %>
15 15
     % if h.user_role(user, workspace)>1:
16 16
         <div class="btn-group btn-group-vertical">
17 17
             <a title="${_('Edit current file')}" class="btn btn-default ${edit_disabled}" data-toggle="modal" data-target="#file-edit-modal-dialog" data-remote="${tg.url('/workspaces/{}/folders/{}/files/{}/edit'.format(file.workspace.id, file.parent.id, file.id))}" >${ICON.FA_FW('fa fa-edit t-less-visible')} ${_('Edit')}</a>
18 18
         </div>
19 19
         <p></p>
20 20
     % endif
21
-    
21
+
22 22
     <div class="btn-group btn-group-vertical">
23 23
         <a href="${download_url}" role="button" class="btn btn-default" data-toggle="modal" title="${_('Download the file')}">${ICON.FA('fa fa-download t-less-visible')} ${_('Download')}</a>
24 24
         <a href="#file-versions" role="button" class="btn btn-default" data-toggle="modal" title="${_('View versions of the file')}">${ICON.FA('fa fa-history t-less-visible')} ${_('Revisions')}</a>
25 25
 ## RESTORE LINKS IF REQUIRED        <a href="#file-associated-links" role="button" class="btn btn-default" data-toggle="modal" title="${_('View all links')}">${TIM.ICO(32, 'apps/internet-web-browser')}</a>
26 26
     </div>
27 27
     <p></p>
28
-    
28
+
29 29
     % if user.profile.id>=3 or h.user_role(user, workspace)>=4:
30 30
         ## if the user can see the toolbar, it means he is the workspace manager.
31 31
         ## So now, we need to know if he alsa has right to delete workspaces
32 32
         <div class="btn-group btn-group-vertical">
33 33
             ## SHOW_ARCHIVE_BUTTON__BUG_#81
34 34
             <a title="${_('Archive file')}" class="btn btn-default ${delete_or_archive_disabled}" href="${tg.url('/workspaces/{}/folders/{}/files/{}/put_archive'.format(file.workspace.id, file.parent.id, file.id))}">
35
-                ${ICON.FA_FW('fa fa-archive t-less-visible')} ${_('Archive')}test
35
+                ${ICON.FA_FW('fa fa-archive t-less-visible')} ${_('Archive')}
36 36
             </a>
37 37
             <a title="${_('Delete file')}" class="btn btn-default ${delete_or_archive_disabled}" href="${tg.url('/workspaces/{}/folders/{}/files/{}/put_delete'.format(file.workspace.id, file.parent.id, file.id))}">
38 38
                 ${ICON.FA_FW('fa fa-trash t-less-visible')} ${_('Delete')}

+ 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)