Browse Source

improve user interface for calendar

Damien ACCORSI 8 years ago
parent
commit
3421ed7160

+ 2 - 2
tracim/tracim/model/serializers.py View File

@@ -963,9 +963,9 @@ def serialize_workspace_in_list(workspace: pmd.Workspace, context: Context):
963 963
     result['label'] = workspace.label
964 964
     result['description'] = workspace.description
965 965
     result['member_nb'] = len(workspace.roles)
966
+    result['calendar_enabled'] = workspace.calendar_enabled
967
+    result['calendar_url'] = workspace.calendar_url
966 968
 
967
-    #    roles = serializableObject.roles
968
-    #    result['users'] = context.toDict(serializableObject.roles)
969 969
     return result
970 970
 
971 971
 

+ 15 - 3
tracim/tracim/templates/admin/workspace_getall.mak View File

@@ -45,10 +45,13 @@
45 45
                                         <label for="workspaceDescription">${_('Description')}</label>
46 46
                                         <textarea name="description" class="form-control" id="workspaceDescription" placeholder="${_('You may add a description of the workspace')}"></textarea>
47 47
                                     </div>
48
-                                    <div class="form-group">
49
-                                        <label for="workspaceCalendarEnabled">${_('Calendar enabled')}</label>
50
-                                        <input id="workspaceCalendarEnabled" name="calendar_enabled" class="form-control" type="checkbox" checked />
48
+                                    <div class="checkbox form-group">
49
+                                        <label for="workspaceCalendarEnabled">
50
+                                            <input id="workspaceCalendarEnabled" name="calendar_enabled" type="checkbox" checked >
51
+                                            <b>${_('Activate associated calendar')}</b>
52
+                                        </label>
51 53
                                     </div>
54
+
52 55
                                     <div class="form-group">
53 56
                                         <p class="form-control-static">${_('<u>Note</u>: members will be added during next step.')|n}</p>
54 57
                                     </div>
@@ -80,6 +83,7 @@
80 83
                                     <th>${_('Workspace')}</th>
81 84
                                     <th>${_('Description')}</th>
82 85
                                     <th>${_('User Nb')}</th>
86
+                                    <th>${_('Calendar')}</th>
83 87
                                 </tr>
84 88
                             </thead>
85 89
                             % for workspace in result.workspaces:
@@ -88,6 +92,14 @@
88 92
                                     <td><a href="${tg.url('/admin/workspaces/{}'.format(workspace.id))}">${workspace.label}</a></td>
89 93
                                     <td>${workspace.description}</td>
90 94
                                     <td>${workspace.member_nb}</td>
95
+                                    <td class="text-center">
96
+                                        % if workspace.calendar_enabled:
97
+                                            ${ICON.FA('fa-check-square-o fa-lg t-enabled-color')}
98
+                                        % else:
99
+                                            ${ICON.FA('fa-square-o fa-lg t-disabled-color')}
100
+                                        % endif
101
+
102
+                                    </td>
91 103
                                 </tr>
92 104
                             % endfor
93 105
                         </table>

+ 16 - 0
tracim/tracim/templates/admin/workspace_getone.mak View File

@@ -48,6 +48,22 @@
48 48
             </div>
49 49
 
50 50
             <div class="row">
51
+                % if not result.workspace.calendar_enabled:
52
+                    <div class="col-sm-7 col-md-offset-3">
53
+                        ${_('The calendar is disabled.')}
54
+                    </div>
55
+                % else:
56
+                    <div class="col-sm-7 col-md-offset-3">
57
+                        ${TITLE.H3(_('Calendar'), 'fa-calendar', 'workspace-members')}
58
+                        <p>${_('This workspace offers a calendar that you can configure in your software: Outlook, Thunderbird, etc.')}</p>
59
+                        <p>${_('The url to configure is the following one:')}</p>
60
+                        <p class="form-control">${result.workspace.calendar_url}"</p>
61
+
62
+                    </div>
63
+                % endif
64
+            </div>
65
+
66
+            <div class="row">
51 67
                 <div class="col-sm-7 col-md-offset-3">
52 68
                     <div>
53 69
                         <% potential_new_user_nb = sum(1 for user in fake_api.users if user.id not in (user.id for user in result.workspace.members)) %>

+ 21 - 4
tracim/tracim/templates/workspace/edit.mak View File

@@ -17,13 +17,30 @@
17 17
             <label for="workspaceDescription">${_('Description')}</label>
18 18
             <textarea name="description" class="form-control" id="workspaceDescription" placeholder="${_('You may add a description of the workspace')}">${result.workspace.description}</textarea>
19 19
         </div>
20
-        <div class="form-group">
21
-            <label for="workspaceCalendarEnabled">${_('Calendar enabled')}</label>
22
-            <input id="workspaceCalendarEnabled" name="calendar_enabled" class="form-control" type="checkbox" ${'checked' if result.workspace.calendar_enabled else ''} />
20
+        <div class="checkbox form-group">
21
+            <label for="workspaceCalendarEnabled">
22
+                <input id="workspaceCalendarEnabled" name="calendar_enabled" type="checkbox" checked >
23
+                <b>${_('Activate associated calendar')}</b>
24
+            </label>
23 25
         </div>
26
+        <script>
27
+            $('#workspaceCalendarEnabled').click(function() {
28
+                console.log('Value is' + $(this).val());
29
+                if($(this).is(':checked')) {
30
+                    console.log('hide url');
31
+                    $('.calendar-url').css('display', 'block');
32
+                } else {
33
+                    console.log('show url');
34
+                    $('.calendar-url').css('display', 'none');
35
+                }
36
+            });
37
+        </script>
24 38
         <div class="form-group calendar-url">
25
-            <label for="workspaceCalendarUrl">${_('Calendar URL')}</label>
39
+            <label for="workspace-name1">${_('Calendar Url')}</label>
26 40
             <input id="workspaceCalendarUrl" type="text" class="form-control"  disabled="disabled" value="${result.workspace.calendar_url}" />
41
+            <p>
42
+                ${_('This url is the one to configure in your calendar software: Outlook, Thunderbird, etc.')}
43
+            </p>
27 44
         </div>
28 45
     </div>
29 46
     <div class="modal-footer">

+ 25 - 19
tracim/tracim/templates/workspace/getone.mak View File

@@ -59,11 +59,6 @@
59 59
         % else:
60 60
             <p class="t-less-visible">${_('No description available')}</p>
61 61
         % endif
62
-        % if result.workspace.calendar_enabled:
63
-            <p>
64
-                ${_('Calendar URL')}: ${result.workspace.calendar_url}
65
-            </p>
66
-        % endif
67 62
 
68 63
         <% member_nb = len(result.workspace.members) %>
69 64
         % if member_nb<=0:
@@ -75,22 +70,33 @@
75 70
                 % else:
76 71
                     ${_('This workspace has {a_open}{member_nb} members{a_close}').format(a_open='<a data-toggle="collapse" href="#memberList" aria-expanded="false" aria-controls="memberList">', member_nb=member_nb, a_close='</a>')|n}
77 72
                 % endif
78
-                </p>
79
-                <div class="collapse" id="memberList">
80
-                    <table class="table">
81
-                        % for member in result.workspace.members:
82
-                            <tr>
83
-                                <td><strong>${member.name}</strong></td>
84
-                                <td>
85
-                                    ${TIM.ICO_FA_BADGED('fa fa-fw fa-flag', member.role_description, member.style)}
86
-                                    ${member.role_description}
87
-                                </td>
88
-                            </tr>
89
-                        % endfor
90
-                    </table>
91
-                </div>
92 73
             </p>
74
+            <div class="collapse" id="memberList">
75
+                <table class="table">
76
+                    % for member in result.workspace.members:
77
+                        <tr>
78
+                            <td><strong>${member.name}</strong></td>
79
+                            <td>
80
+                                ${TIM.ICO_FA_BADGED('fa fa-fw fa-flag', member.role_description, member.style)}
81
+                                ${member.role_description}
82
+                            </td>
83
+                        </tr>
84
+                    % endfor
85
+                </table>
86
+            </div>
87
+        % endif
88
+
89
+        % if result.workspace.calendar_enabled:
90
+            <p>
91
+                ${_('This workspace has {a_open}an associated calendar{a_close}').format(a_open='<a data-toggle="collapse" href="#calendarConfig" aria-expanded="false" aria-controls="calendarConfig">', a_close='</a>')|n}
92
+            </p>
93
+            <div class="collapse" id="calendarConfig">
94
+                <p>${_('You can access the calendar using your own software: Outlook, Thunderbird, etc.')}</p>
95
+                <p>${_('The url to setup is the following one:')}</p>
96
+                <p class="form-control">${result.workspace.calendar_url}"</p>
97
+            </div>
93 98
         % endif
99
+
94 100
     </div>
95 101
 </div>
96 102