Browse Source

improve user interface

Damien ACCORSI 8 years ago
parent
commit
0107597fa1

+ 44 - 38
tracim/tracim/templates/folder/getone.mak View File

@@ -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 - 0
tracim/tracim/templates/widgets/button.mak View File

@@ -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 View File

@@ -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 View File

@@ -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>

+ 65 - 57
tracim/tracim/templates/workspace/getone.mak View File

@@ -113,16 +113,20 @@
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>
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
+        <div class="input-group">
121
+            <span class="input-group-addon" style="width: 8em;"><i class="fa fa-fw fa-windows"></i> Windows</span>
124 122
             <p class="form-control">http://${webdav_url}</p>
125 123
         </div>
124
+        <p></p>
125
+        <div class="input-group">
126
+            <span class="input-group-addon" style="width: 8em;"><i class="fa fa-fw fa-linux"></i> Linux</span>
127
+            <p class="form-control">dav://${webdav_url}</p>
128
+        </div>
129
+    </div>
126 130
 
127 131
     <div class="t-half-spacer-above t-less-visible"></div>
128 132
 
@@ -131,59 +135,63 @@
131 135
             <% user_role = h.user_role(fake_api.current_user, result.workspace) %>
132 136
 
133 137
             ${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>
138
+                <div class="col-md-4 col-sx-12">
139
+                    % if user_role > 1:
140
+                        <div class="btn-group" role="group">
141
+                            <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
142
+                                <i class="fa fa-plus"></i> ${_('New ...')}
143
+                                <span class="caret"></span>
144
+                            </button>
145
+                            <ul class="dropdown-menu" role="menu">
146
+                                % for content_type in result.workspace.allowed_content_types:
147
+                                    % if content_type.id == 'folder' and user_role > 2:
148
+                                        ## Only show 'new folder' to content managers
149
+                                        <%
150
+                                            new_form_content_url = tg.url('/workspaces/{}/folders/new'.format(result.workspace.id), params={'workspace_id': result.workspace.id, 'parent_id': None})
151
+                                            modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
152
+                                            icon_classes = content_type.icon+' '+content_type.color
153
+                                        %>
154
+                                        <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>
155
+                                    % else:
156
+                                        <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>
157
+            ## Show new content entries in the menu is currently not available at root of a workspace
158
+            ## TODO - D.A. - 2015-08-20 - Allow to put content at root (and show related entry in the menu
159
+            ##                             % if user_role == 2:
160
+            ##                                 ## Only show 'new folder' to content managers
161
+            ##                                 <%
162
+            ##                                     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})
163
+            ##                                     modal_dialog_id = '{content_type}-new-modal-dialog'.format(content_type=content_type.id)
164
+            ##                                     icon_classes = content_type.icon+' '+content_type.color
165
+            ##                                 %>
166
+            ##                                 <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>
167
+            ##                             % endif
168
+                                    % endif
169
+                                % endfor
170
+                            </ul>
171
+                        </div>
172
+                    % endif
167 173
                 </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
174
+                <div class="col-md-8 text-right">
175
+                    % if len(fake_api.sub_items) > 0:
176
+                        ## INFO - D.A. - 2015-05-25
177
+                        ## We hide filtering/search buttons if no content yet.
178
+                        ## This make the interface more easy to use
179
+                        <div class="btn-group" role="group" aria-label="...">
180
+                            ${BUTTON.TEXT('', 'btn btn-default disabled', _('hide...'))}
181
+                            % for content_type in result.workspace.allowed_content_types:
182
+                                ${BUTTON.TEXT('toggle-{type}-visibility'.format(type=content_type.id), 'btn btn-default t-active-color disabled-has-priority', content_type.label)}
183
+                            % endfor
184
+                        </div>
185
+                        <p></p>
186
+                        ${UI.GENERIC_DISPLAY_VIEW_BUTTONS_CONTAINER(tg.url('/workspaces/{}'.format(result.workspace.id)))}
187
+                        <p></p>
188
+                        <div class="btn-group pull-right" role="group" aria-label="...">
189
+                            <input id="filtering"  type="text" class="form-control t-bg-grey" placeholder="${_('filter...')}" aria-describedby="basic-addon1">
190
+                        </div>
191
+                    % endif
179 192
                 </div>
180 193
 
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 194
 
186
-            ${UI.GENERIC_DISPLAY_VIEW_BUTTONS_CONTAINER(tg.url('/workspaces/{}'.format(result.workspace.id)))}
187 195
 
188 196
         </div>
189 197
         <div class="t-spacer-above">