Pārlūkot izejas kodu

Merge pull request #181 from lebouquetin/master

Tracim 7 gadus atpakaļ
vecāks
revīzija
1aef286959

+ 44 - 38
tracim/tracim/templates/folder/getone.mak Parādīt failu

@@ -75,45 +75,53 @@
75 75
         <% user_role = h.user_role(fake_api.current_user, result.folder.workspace) %>
76 76
 
77 77
         <div class="t-spacer-above">
78
-            % if user_role > 1:
79
-                <div class="btn-group" role="group">
80
-                    % if (not result.folder.is_archived and not result.folder.is_deleted) :
81
-                        <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
82
-                            <i class="fa fa-plus"></i> ${_('New ...')}
83
-                            <span class="caret"></span>
84
-                        </button>
85
-                    % endif
86
-                    <ul class="dropdown-menu" role="menu">
87
-                        % for content_type in result.folder.allowed_content_types:
88
-                            % if content_type.id != 'folder' or user_role > 2:
89
-                                ## Only show 'new folder' to content managers
90
-                                <%
91
-                                    new_form_content_url = tg.url('/workspaces/{}/folders/{}/{}s/new'.format(result.folder.workspace.id, result.folder.id, content_type.id), params={'workspace_id': result.folder.workspace.id, 'parent_id': result.folder.id})
92
-                                    modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
93
-                                    icon_classes = content_type.icon+' '+content_type.color
94
-                                %>
95
-                                <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT(modal_dialog_id, content_type.label, new_form_content_url, icon_classes)}</li>
78
+            <div class="row">
79
+                <div class="col-md-4 col-sx-12">
80
+                    % if user_role > 1:
81
+                        <div class="btn-group" role="group">
82
+                            % if (not result.folder.is_archived and not result.folder.is_deleted) :
83
+                                <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
84
+                                    <i class="fa fa-plus"></i> ${_('New ...')}
85
+                                    <span class="caret"></span>
86
+                                </button>
96 87
                             % endif
97
-                        % endfor
98
-                    </ul>
99
-                </div>
100
-            % endif
101
-
102
-            % if len(fake_api.sub_items) > 0:
103
-                ## INFO - D.A. - 2015-05-25
104
-                ## We hide filtering/search buttons if no content yet.
105
-                ## This make the interface more easy to use
106
-                <div class="btn-group" role="group" aria-label="...">
107
-                    ${BUTTON.TEXT('', 'btn btn-default disabled', _('hide...'))}
108
-                    % for content_type in result.folder.allowed_content_types:
109
-                        ${BUTTON.TEXT('toggle-{type}-visibility'.format(type=content_type.id), 'btn btn-default t-active-color disabled-has-priority', content_type.label)}
110
-                    % endfor
88
+                            <ul class="dropdown-menu" role="menu">
89
+                                % for content_type in result.folder.allowed_content_types:
90
+                                    % if content_type.id != 'folder' or user_role > 2:
91
+                                        ## Only show 'new folder' to content managers
92
+                                        <%
93
+                                            new_form_content_url = tg.url('/workspaces/{}/folders/{}/{}s/new'.format(result.folder.workspace.id, result.folder.id, content_type.id), params={'workspace_id': result.folder.workspace.id, 'parent_id': result.folder.id})
94
+                                            modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
95
+                                            icon_classes = content_type.icon+' '+content_type.color
96
+                                        %>
97
+                                        <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT(modal_dialog_id, content_type.label, new_form_content_url, icon_classes)}</li>
98
+                                    % endif
99
+                                % endfor
100
+                            </ul>
101
+                        </div>
102
+                    % endif
111 103
                 </div>
112
-
113
-                <div class="btn-group pull-right" role="group" aria-label="...">
114
-                    <input id="filtering"  type="text" class="form-control t-bg-grey" placeholder="${_('search...')}" aria-describedby="basic-addon1">
104
+                <div class="col-md-8 text-right">
105
+                    % if len(fake_api.sub_items) > 0:
106
+                        ## INFO - D.A. - 2015-05-25
107
+                        ## We hide filtering/search buttons if no content yet.
108
+                        ## This make the interface more easy to use
109
+                        <div class="btn-group" role="group" aria-label="...">
110
+                            ${BUTTON.TEXT('', 'btn btn-default disabled', _('hide...'))}
111
+
112
+                            % for content_type in result.folder.allowed_content_types:
113
+                                ${BUTTON.TEXT('toggle-{type}-visibility'.format(type=content_type.id), 'btn btn-default t-active-color disabled-has-priority', content_type.label)}
114
+                            % endfor
115
+                        </div>
116
+                        <p></p>
117
+                        ${UI.GENERIC_DISPLAY_VIEW_BUTTONS_CONTAINER(tg.url('/workspaces/{}/folders/{}'.format(result.folder.workspace.id, result.folder.id)))}
118
+                        <p></p>
119
+                        <div class="btn-group" role="group" aria-label="...">
120
+                            <input id="filtering"  type="text" class="form-control t-bg-grey" placeholder="${_('filter...')}" aria-describedby="basic-addon1">
121
+                        </div>
122
+                    % endif
115 123
                 </div>
116
-            % endif
124
+            </div>
117 125
         </div>
118 126
 
119 127
         <div class="t-spacer-above">
@@ -134,8 +142,6 @@
134 142
                 % endif
135 143
             % endif
136 144
 
137
-            ${UI.GENERIC_DISPLAY_VIEW_BUTTONS_CONTAINER(tg.url('/workspaces/{}/folders/{}'.format(result.folder.workspace.id, result.folder.id)))}
138
-
139 145
             % if len(fake_api.sub_items) <= 0:
140 146
                 ${P.EMPTY_CONTENT(_('This folder has not yet content.'))}
141 147
             % else:

+ 1 - 1
tracim/tracim/templates/home.mak Parādīt failu

@@ -132,7 +132,7 @@
132 132
                             </tr>
133 133
                         </thead>
134 134
                         % for role in fake_api.current_user.roles:
135
-                            ${TABLE_ROW.USER_ROLE_IN_WORKSPACE(fake_api.current_user, role, show_id=False, enable_link='/user/me/workspaces/{workspace}/enable_notifications?next_url=/home', disable_link='/user/me/workspaces/{workspace}/disable_notifications?next_url=/home')}
135
+                            ${TABLE_ROW.USER_ROLE_IN_WORKSPACE(fake_api.current_user, role, show_id=False, enable_link='/user/me/workspaces/{workspace}/enable_notifications?next_url=/home', disable_link='/user/me/workspaces/{workspace}/disable_notifications?next_url=/home', base_link='/workspaces/{workspace}')}
136 136
                         % endfor
137 137
                     </table>
138 138
                 % endif

+ 1 - 0
tracim/tracim/templates/widgets/button.mak Parādīt failu

@@ -9,6 +9,7 @@
9 9
 
10 10
 
11 11
 <%def name="TEXT(dom_id, css_class, label='')"><button type="button" class="${css_class}" id="${dom_id}">${label}</button></%def>
12
+<%def name="TEXT_AND_ICON(dom_id, css_class, label='', icon_css='')"><button type="button" class="${css_class}" id="${dom_id}"><i class="${icon_css}"></i> ${label}</button></%def>
12 13
 <%def name="DATA_TARGET_AS_TEXT(dom_id, label='', classes='')"><a data-toggle="collapse" data-target="#${dom_id}" class="${classes}">${label}</a></%def>
13 14
 <%def name="DATA_TARGET_AS_TEXT_MODAL_WITH_REMOTE_CONTENT(dom_id, label, remote_url)"><a data-toggle="modal" data-target="#${dom_id}" data-remote="${remote_url}">${label}</a></%def>
14 15
 <%def name="DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT(dom_id, label, remote_url, icon_classes)"><a data-toggle="modal" data-target="#${dom_id}" data-remote="${remote_url}">${ICON.FA_FW(icon_classes)} ${label}</a></%def>

+ 2 - 2
tracim/tracim/templates/widgets/table_row.mak Parādīt failu

@@ -2,12 +2,12 @@
2 2
 <%namespace name="ICON" file="tracim.templates.widgets.icon"/>
3 3
 <%namespace name="SPAN" file="tracim.templates.widgets.span"/>
4 4
 
5
-<%def name="USER_ROLE_IN_WORKSPACE(current_user, role, show_id=True, enable_link=None, disable_link=None, role_types=None)">
5
+<%def name="USER_ROLE_IN_WORKSPACE(current_user, role, show_id=True, enable_link=None, disable_link=None, role_types=None, base_link='/admin/workspaces/{workspace}')">
6 6
     <tr>
7 7
         % if show_id:
8 8
             <td>${role.workspace.id}</td>
9 9
         % endif
10
-        <td><a href="${tg.url('/admin/workspaces/{}').format(role.workspace.id)}">${role.workspace.name}</a></td>
10
+        <td><a href="${tg.url(base_link).format(workspace=role.workspace.id)}">${role.workspace.name}</a></td>
11 11
 
12 12
         % if role_types:
13 13
             ## <td>${BUTTON.SECURED_ROLE_SELECTOR(fake_api.current_user, result.workspace, member, fake_api.role_types)}</td>

+ 8 - 18
tracim/tracim/templates/widgets/ui.mak Parādīt failu

@@ -2,28 +2,18 @@
2 2
 
3 3
 <%def name="GENERIC_DISPLAY_VIEW_BUTTONS_CONTAINER(base_url)">
4 4
     <div class="btn-group folder__filter" role="group" aria-label="...">
5
-        ${BUTTON.TEXT('', 'btn btn-default disabled', _('display...'))}
6 5
 
7
-        <% show_deleted_param = 1 %>
8
-        <% show_archived_param = 1 %>
6
+        <% show_deleted_param = int(not show_deleted) %>
7
+        <% show_archived_param = int(not show_archived) %>
8
+        <% show_deleted_url = '{}?show_deleted={}&show_archived={}'.format(base_url, show_deleted_param, int(show_archived)) %>
9
+        <% show_archive_url = '{}?show_deleted={}&show_archived={}'.format(base_url, int(show_deleted), show_archived_param) %>
9 10
 
10
-        % if show_deleted:
11
-            <% show_deleted_param = 0 %>
12
-        % endif
13
-        % if show_archived:
14
-            <% show_archived_param = 0 %>
15
-        % endif
16
-
17
-        <a href="${base_url}?show_deleted=${show_deleted_param}&show_archived=${show_archived if show_archived else 0}"
18
-           class="btn btn-default disabled-has-priority ${'t-inactive-color' if not show_deleted else ''}"
19
-        >
20
-            ${_('deleted')}
11
+        <a href="${show_deleted_url}" class="btn btn-default disabled-has-priority ${('t-inactive-color', '')[show_deleted ]}">
12
+            ${(_('Show trashed items'), _('Hide trashed items'))[show_deleted]} <i class="fa fa-fw fa-trash ${('t-inactive-color', 'tracim-less-visible')[show_deleted]}"></i>
21 13
         </a>
22 14
 
23
-        <a href="${base_url}?show_deleted=${show_deleted if show_deleted else 0}&show_archived=${show_archived_param}"
24
-           class="btn btn-default disabled-has-priority ${'t-inactive-color' if not show_archived else ''}"
25
-        >
26
-            ${_('archived')}
15
+        <a href="${show_archive_url}" class="btn btn-default disabled-has-priority ${('t-inactive-color', '')[show_archived]}">
16
+            ${(_('Show archives'),_('Hide archives'))[show_archived]} <i class="fa fa-fw fa-archive ${('t-inactive-color', 'tracim-less-visible')[show_archived]}"></i>
27 17
         </a>
28 18
     </div>
29 19
 </%def>

+ 79 - 58
tracim/tracim/templates/workspace/getone.mak Parādīt failu

@@ -113,16 +113,33 @@
113 113
         </div>
114 114
     % endif
115 115
 
116
-        <p>
117
-            ${_('This workspace is {a_open}accessible with webdav{a_close}').format(a_open='<a data-toggle="collapse" href="#webdavConfig" aria-expanded="false" aria-controls="webdavConfig">', a_close='</a>')|n}
118
-        </p>
119
-        <div class="collapse" id="webdavConfig">
120
-            <p>${_('Adress to connect to webdav with:')}</p>
121
-            <p>Linux : </p>
122
-            <p class="form-control">dav://${webdav_url}</p>
123
-            <p>Windows : </p>
124
-            <p class="form-control">http://${webdav_url}</p>
116
+    <p>
117
+        ${_('You can browse the content of this workspace {a_open}in your file explorer (webdav){a_close}').format(a_open='<a data-toggle="collapse" href="#webdavConfig" aria-expanded="false" aria-controls="webdavConfig">', a_close='</a>')|n}
118
+    </p>
119
+    <div class="collapse" id="webdavConfig">
120
+        <div class="row">
121
+            <div class="col-md-6">
122
+                <div class="input-group">
123
+                    <span class="input-group-addon" style="width: 8em;"><i class="fa fa-fw fa-windows"></i> Windows</span>
124
+                    <p class="form-control">http://${webdav_url}</p>
125
+                </div>
126
+                <p></p>
127
+                <div class="input-group">
128
+                    <span class="input-group-addon" style="width: 8em;"><i class="fa fa-fw fa-linux"></i> Linux</span>
129
+                    <p class="form-control">dav://${webdav_url}</p>
130
+                </div>
131
+            </div>
132
+            <div class="col-md-6">
133
+                <div class="alert alert-warning">
134
+                    <p>
135
+                        <i class="fa fa-fw fa-info"></i>
136
+                        ${_('Tracim implements a <a href="https://fr.wikipedia.org/wiki/WebDAV">webdav interface</a>.')|n}
137
+                    </p>
138
+                    <p>${_('You can configure your file explorer to use this interface and browse tracim content through it.')}</p>
139
+                </div>
140
+            </div>
125 141
         </div>
142
+    </div>
126 143
 
127 144
     <div class="t-half-spacer-above t-less-visible"></div>
128 145
 
@@ -131,59 +148,63 @@
131 148
             <% user_role = h.user_role(fake_api.current_user, result.workspace) %>
132 149
 
133 150
             ${TITLE.H3(_('Content'), 'fa-copy', 'workspace-content')}
134
-
135
-            % if user_role > 1:
136
-                <div class="btn-group" role="group">
137
-                    <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
138
-                        <i class="fa fa-plus"></i> ${_('New ...')}
139
-                        <span class="caret"></span>
140
-                    </button>
141
-                    <ul class="dropdown-menu" role="menu">
142
-                        % for content_type in result.workspace.allowed_content_types:
143
-                            % if content_type.id == 'folder' and user_role > 2:
144
-                                ## Only show 'new folder' to content managers
145
-                                <%
146
-                                    new_form_content_url = tg.url('/workspaces/{}/folders/new'.format(result.workspace.id), params={'workspace_id': result.workspace.id, 'parent_id': None})
147
-                                    modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
148
-                                    icon_classes = content_type.icon+' '+content_type.color
149
-                                %>
150
-                                <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT(modal_dialog_id, content_type.label, new_form_content_url, icon_classes)}</li>
151
-                            % else:
152
-                                <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT('', _('You are not allowed to create content'), '', 't-less-visible fa fa-ban')}</li>
153
-    ## Show new content entries in the menu is currently not available at root of a workspace
154
-    ## TODO - D.A. - 2015-08-20 - Allow to put content at root (and show related entry in the menu
155
-    ##                             % if user_role == 2:
156
-    ##                                 ## Only show 'new folder' to content managers
157
-    ##                                 <%
158
-    ##                                     new_form_content_url = tg.url('/workspaces/{}/folders/{}/{}s/new'.format(result.folder.workspace.id, result.folder.id, content_type.id), params={'workspace_id': result.folder.workspace.id, 'parent_id': result.folder.id})
159
-    ##                                     modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
160
-    ##                                     icon_classes = content_type.icon+' '+content_type.color
161
-    ##                                 %>
162
-    ##                                 <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT(modal_dialog_id, content_type.label, new_form_content_url, icon_classes)}</li>
163
-    ##                             % endif
164
-                            % endif
165
-                        % endfor
166
-                    </ul>
151
+                <div class="col-md-4 col-sx-12">
152
+                    % if user_role > 1:
153
+                        <div class="btn-group" role="group">
154
+                            <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
155
+                                <i class="fa fa-plus"></i> ${_('New ...')}
156
+                                <span class="caret"></span>
157
+                            </button>
158
+                            <ul class="dropdown-menu" role="menu">
159
+                                % for content_type in result.workspace.allowed_content_types:
160
+                                    % if content_type.id == 'folder' and user_role > 2:
161
+                                        ## Only show 'new folder' to content managers
162
+                                        <%
163
+                                            new_form_content_url = tg.url('/workspaces/{}/folders/new'.format(result.workspace.id), params={'workspace_id': result.workspace.id, 'parent_id': None})
164
+                                            modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
165
+                                            icon_classes = content_type.icon+' '+content_type.color
166
+                                        %>
167
+                                        <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT(modal_dialog_id, content_type.label, new_form_content_url, icon_classes)}</li>
168
+                                    % else:
169
+                                        <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT('', _('You are not allowed to create content'), '', 't-less-visible fa fa-ban')}</li>
170
+            ## Show new content entries in the menu is currently not available at root of a workspace
171
+            ## TODO - D.A. - 2015-08-20 - Allow to put content at root (and show related entry in the menu
172
+            ##                             % if user_role == 2:
173
+            ##                                 ## Only show 'new folder' to content managers
174
+            ##                                 <%
175
+            ##                                     new_form_content_url = tg.url('/workspaces/{}/folders/{}/{}s/new'.format(result.folder.workspace.id, result.folder.id, content_type.id), params={'workspace_id': result.folder.workspace.id, 'parent_id': result.folder.id})
176
+            ##                                     modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
177
+            ##                                     icon_classes = content_type.icon+' '+content_type.color
178
+            ##                                 %>
179
+            ##                                 <li>${BUTTON.DATA_TARGET_AS_TEXT_AND_ICON_MODAL_WITH_REMOTE_CONTENT(modal_dialog_id, content_type.label, new_form_content_url, icon_classes)}</li>
180
+            ##                             % endif
181
+                                    % endif
182
+                                % endfor
183
+                            </ul>
184
+                        </div>
185
+                    % endif
167 186
                 </div>
168
-            % endif
169
-
170
-            % if len(fake_api.sub_items) > 0:
171
-                ## INFO - D.A. - 2015-05-25
172
-                ## We hide filtering/search buttons if no content yet.
173
-                ## This make the interface more easy to use
174
-                <div class="btn-group" role="group" aria-label="...">
175
-                    ${BUTTON.TEXT('', 'btn btn-default disabled', _('hide...'))}
176
-                    % for content_type in result.workspace.allowed_content_types:
177
-                        ${BUTTON.TEXT('toggle-{type}-visibility'.format(type=content_type.id), 'btn btn-default t-active-color disabled-has-priority', content_type.label)}
178
-                    % endfor
187
+                <div class="col-md-8 text-right">
188
+                    % if len(fake_api.sub_items) > 0:
189
+                        ## INFO - D.A. - 2015-05-25
190
+                        ## We hide filtering/search buttons if no content yet.
191
+                        ## This make the interface more easy to use
192
+                        <div class="btn-group" role="group" aria-label="...">
193
+                            ${BUTTON.TEXT('', 'btn btn-default disabled', _('hide...'))}
194
+                            % for content_type in result.workspace.allowed_content_types:
195
+                                ${BUTTON.TEXT('toggle-{type}-visibility'.format(type=content_type.id), 'btn btn-default t-active-color disabled-has-priority', content_type.label)}
196
+                            % endfor
197
+                        </div>
198
+                        <p></p>
199
+                        ${UI.GENERIC_DISPLAY_VIEW_BUTTONS_CONTAINER(tg.url('/workspaces/{}'.format(result.workspace.id)))}
200
+                        <p></p>
201
+                        <div class="btn-group pull-right" role="group" aria-label="...">
202
+                            <input id="filtering"  type="text" class="form-control t-bg-grey" placeholder="${_('filter...')}" aria-describedby="basic-addon1">
203
+                        </div>
204
+                    % endif
179 205
                 </div>
180 206
 
181
-                <div class="btn-group pull-right" role="group" aria-label="...">
182
-                    <input id="filtering"  type="text" class="form-control t-bg-grey" placeholder="${_('search...')}" aria-describedby="basic-addon1">
183
-                </div>
184
-            % endif
185 207
 
186
-            ${UI.GENERIC_DISPLAY_VIEW_BUTTONS_CONTAINER(tg.url('/workspaces/{}'.format(result.workspace.id)))}
187 208
 
188 209
         </div>
189 210
         <div class="t-spacer-above">