Browse Source

- increase opacity of full-screen editor

Damien Accorsi 11 years ago
parent
commit
b8748e9107

+ 1 - 14
pboard/pboard/controllers/root.py View File

@@ -119,12 +119,12 @@ class RootController(BaseController):
119 119
         loCurrentUser   = pld.PODStaticController.getCurrentUser()
120 120
         loApiController = pld.PODUserFilteredApiController(loCurrentUser.user_id)
121 121
 
122
-        # loRootNodeList   = pbm.DBSession.query(pbmd.PBNode).filter(pbmd.PBNode.parent_id==None).order_by(pbmd.PBNode.node_order).all()
123 122
         loRootNodeList = loApiController.buildTreeListForMenu(pbmd.PBNodeStatus.getVisibleIdsList())
124 123
         liNodeId         = int(node)
125 124
 
126 125
         loCurrentNode    = None
127 126
         loNodeStatusList = None
127
+
128 128
         try:
129 129
           loNodeStatusList = pbmd.PBNodeStatus.getChoosableList()
130 130
           loCurrentNode    = loApiController.getNode(liNodeId)
@@ -133,19 +133,6 @@ class RootController(BaseController):
133 133
 
134 134
         # FIXME - D.A - 2013-11-07 - Currently, the code build a new item if no item found for current user
135 135
         # the correct behavior should be to redirect to setup page
136
-        if loCurrentNode is not None and "%s"%loCurrentNode.node_id!=node:
137
-          redirect(tg.url('/document/%i'%loCurrentNode.node_id))
138
-
139
-        if loCurrentNode is None:
140
-          loCurrentNode = loApiController.getNode(0) # try to get an item
141
-          if loCurrentNode is not None:
142
-            flash(_('Document not found. Randomly showing item #%i')%(loCurrentNode.node_id), 'warning')
143
-            redirect(tg.url('/document/%i'%loCurrentNode.node_id))
144
-          else:
145
-            flash(_('Your first document has been automatically created'), 'info')
146
-            loCurrentNode = loApiController.createDummyNode()
147
-            pm.DBSession.flush()
148
-            redirect(tg.url('/document/%i'%loCurrentNode.node_id))
149 136
 
150 137
         return dict(
151 138
             root_node_list=loRootNodeList,

+ 1 - 1
pboard/pboard/model/data.py View File

@@ -333,7 +333,7 @@ class PBNode(DeclarativeBase):
333 333
           break
334 334
       return PBNodeStatus.getStatusItem(lsRealStatusId)
335 335
 
336
-  def getTruncatedLabel(self: PBNode, piCharNb: int):
336
+  def getTruncatedLabel(self, piCharNb: int):
337 337
     """
338 338
     return a truncated version of the data_label property.
339 339
     if piCharNb is not > 0, then the full data_label is returned

+ 6 - 4
pboard/pboard/public/css/style.css View File

@@ -127,10 +127,10 @@ body { padding-top: 60px; }
127 127
 
128 128
   padding: 0.5em 0.5em 0.5em 0.5em;
129 129
   
130
-  filter: alpha(opacity=90); /* internet explorer */
131
-  -khtml-opacity: 0.9;      /* khtml, old safari */
132
-  -moz-opacity: 0.9;       /* mozilla, netscape */
133
-  opacity: 0.9;           /* fx, safari, opera */
130
+  filter: alpha(opacity=95); /* internet explorer */
131
+  -khtml-opacity: 0.95;      /* khtml, old safari */
132
+  -moz-opacity: 0.95;       /* mozilla, netscape */
133
+  opacity: 0.95;           /* fx, safari, opera */
134 134
 }
135 135
 
136 136
 .full-size-overlay-inner {
@@ -190,3 +190,5 @@ div.search-result-item > h5 {
190 190
   margin-bottom: 0;
191 191
 }
192 192
 
193
+ul.nav-tabs li.active > a { background-color: #efefef; }
194
+div.tab-pane > h4 { background-color: #efefef; padding: 0.5em; margin: 0 0 0.5em 0;}

+ 11 - 4
pboard/pboard/public/javascript/pod.js View File

@@ -1,3 +1,13 @@
1
+  function generateStringId(charNb = 32, allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
2
+    var text = "";
3
+
4
+    for( var i=0; i < charNb; i++ ) {
5
+      text += allowedChars.charAt(Math.floor(Math.random() * allowedChars.length));
6
+    }
7
+
8
+    return text;
9
+  }
10
+
1 11
   function toggleFullScreen(outerWidgetId, innerWidgetId) {
2 12
     if($(outerWidgetId).hasClass('full-size-overlay')) {
3 13
       // Toggle from fullscreen to "normal"
@@ -97,10 +107,7 @@
97 107
       $("#current-document-content-edit-form" ).css("display", "block");
98 108
       $("#current-document-toobar").css("display", "none");
99 109
     });
100
-    $("#current-document-content" ).dblclick(function() {
101
-      $("#current-document-content" ).css("display", "none");
102
-      $("#current-document-content-edit-form" ).css("display", "block");
103
-    });
110
+
104 111
     $("#current-document-content-edit-cancel-button, #current-document-content-edit-cancel-button-top" ).click(function() {
105 112
       $("#current-document-content" ).css("display", "block");
106 113
       $("#current-document-content-edit-form" ).css("display", "none");

+ 198 - 12
pboard/pboard/templates/document-widgets.mak View File

@@ -4,7 +4,7 @@
4 4
 <%def name="node_treeview_for_set_parent_menu(node_id, node_list, indentation=-1)">
5 5
   % if indentation==-1:
6 6
     <li>
7
-      <a href="${tg.url('/api/set_parent_node?node_id=%i&new_parent_id=0'%(current_node.node_id))}">
7
+      <a href="${tg.url('/api/set_parent_node', dict(node_id=node_id, new_parent_id=0))}">
8 8
         <i class="fa fa-file-text-o"></i> ${_('Home')}
9 9
       </a>
10 10
       ${node_treeview_for_set_parent_menu(node_id, node_list, 0)}
@@ -14,7 +14,7 @@
14 14
       <ul style="list-style: none;">
15 15
       % for new_parent_node in node_list:
16 16
         <li>
17
-          <a href="${tg.url('/api/set_parent_node?node_id=%i&new_parent_id=%i'%(node_id, new_parent_node.node_id))}"><i class="fa fa-file-text-o"></i> ${new_parent_node.getTruncatedLabel(40-indentation*2)}
17
+          <a href="${tg.url('/api/set_parent_node', dict(node_id=node_id, new_parent_id=new_parent_node.node_id))}"><i class="fa fa-file-text-o"></i> ${new_parent_node.getTruncatedLabel(40-indentation*2)}
18 18
           </a>
19 19
           ${node_treeview_for_set_parent_menu(node_id, new_parent_node.getStaticChildList(), indentation+1)}
20 20
         </li>
@@ -27,9 +27,7 @@
27 27
 <%def name="Toolbar(poNode, plNodeStatusList, plRootNodes, psDivId)">
28 28
   <div id="${psDivId}">
29 29
     <div class="btn-group">
30
-  % if poNode.parent_id!=None and poNode.parent_id!=0:
31 30
       ${POD.EditButton('current-document-content-edit-button', True)}
32
-  % endif
33 31
       <button class="btn btn-small"  data-toggle="dropdown" href="#"> 
34 32
         <i class="fa  fa-signal"></i>
35 33
         ${_("Change status")}
@@ -103,7 +101,7 @@
103 101
       </ul>
104 102
       <a
105 103
         class="btn btn-small btn-danger"
106
-        href='${tg.url('/api/edit_status?node_id=%i&node_status=%s'%(poNode.node_id, 'deleted'))}'
104
+        href='${tg.url('/api/edit_status', dict(node_id=poNode.node_id, node_status='deleted'))}'
107 105
         id='current-document-force-delete-button' onclick="return confirm('${_('Delete current document?')}');"
108 106
         title="${_('Delete')}"
109 107
         ><i class="fa fa-trash-o"></i></a>
@@ -116,13 +114,15 @@
116 114
     <li>
117 115
       <span class="divider"> / Documents /</span>
118 116
     </li>
119
-    % for breadcrumb_node in poNode.getBreadCrumbNodes():
120
-    <li>
121
-      <a href="${tg.url('/document/%s'%(breadcrumb_node.node_id))}">${breadcrumb_node.getTruncatedLabel(30)}</a>
122
-      <span class="divider">/</span>
123
-    </li>
124
-    % endfor
125
-    <li class="active">${poNode.data_label}</li>
117
+    % if poNode!=None:
118
+      % for breadcrumb_node in poNode.getBreadCrumbNodes():
119
+      <li>
120
+        <a href="${tg.url('/document/%s'%(breadcrumb_node.node_id))}">${breadcrumb_node.getTruncatedLabel(30)}</a>
121
+        <span class="divider">/</span>
122
+      </li>
123
+      % endfor
124
+      <li class="active">${poNode.data_label}</li>
125
+    % endif
126 126
   </ul>
127 127
 </%def>
128 128
 
@@ -172,8 +172,32 @@
172 172
   <h3 id="${psId}" title="Document ${poNode.node_id}: ${poNode.data_label}">
173 173
     ${poNode.data_label}
174 174
     <sup class="label ${poNode.getStatus().css}" href="#">
175
+      <i class="${poNode.getStatus().icon_id}"></i>
175 176
       ${poNode.getStatus().label}
176 177
     </sup>
178
+    
179
+    % if poNode.is_shared==False:
180
+      <sup class="label label-info" title="${_('This document is private')}">
181
+        <i class="fa fa-key"></i>
182
+        ${_('private')}
183
+      </sup>
184
+    % else:
185
+      <sup class="label label-warning" title="${_('This document is collaborative')}">
186
+        <i class="fa fa-group"></i>
187
+        ${_('collaborative')}
188
+      </sup>
189
+    % endif
190
+######
191
+##
192
+## 2014-05-06 - D.A. - The document is not yet internet-sharable
193
+##
194
+##    % if poNode.is_public==True:
195
+##      <sup class="label label-warning" href="#">
196
+##        <i class="fa fa-globe"></i>
197
+##        <span title="${_('This document is published through internet at %s')%poNode.public_url_key}">${_('shared')}</span>
198
+##      </sup>
199
+##    % endif
200
+
177 201
   </h3>
178 202
 </%def>
179 203
 
@@ -192,3 +216,165 @@
192 216
   </a>
193 217
 </%def>
194 218
 
219
+
220
+<%def name="FirstTimeFakeDocument()">
221
+  <div id='application-document-panel' class="span5">
222
+    <div id='current-document-content' class="">
223
+      <p class="alert alert-info">
224
+        <i class="fa  fa-smile-o"></i> <strong>${_('Welcome aboard.')}</strong>
225
+      </p>
226
+      <p>
227
+        ${_('It appears you do not have any document yet. We suggest you to start by creating a new document.')}
228
+      </p>
229
+      <p>
230
+        ${_('We suggest you to start by creating a new document.')}
231
+      </p>
232
+      <p class="alert alert-info">
233
+        <i class="fa fa-info-circle"></i> ${_('<strong>Note :</strong> You can even create a dummy document: you will be able to remove it later.')|n}
234
+      </p>
235
+      <p class="pull-right">
236
+        <a href="#create-new-document-modal-form" role="button" class="btn btn-success" data-toggle="modal">
237
+          <i class="fa fa-plus"></i>
238
+          ${_('Create your first document')}
239
+        </a>
240
+      </p>
241
+  
242
+      ${DocumentEditModalDialog(None, None, tg.url('/api/create_document'), 'create-new-document-modal-form', 'Create your first document')}
243
+    </div>
244
+    <script>
245
+    </script>
246
+  </div>
247
+</%def>
248
+
249
+<%def name="DocumentEditModalDialog(piParentNodeId, poNode, psPostUrl, psModalId, psTitle)">
250
+  <div
251
+    id="${psModalId}"
252
+    class="modal hide"
253
+    tabindex="-1"
254
+    role="dialog"
255
+    aria-labelledby="myModalLabel"
256
+    aria-hidden="true">
257
+    
258
+   <div class="modal-header">
259
+## MODAL HEADER
260
+      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
261
+      <h3 id="myModalLabel">${psTitle}</h3>
262
+## MODAL HEADER [END]
263
+    </div>
264
+
265
+    <div class="modal-body">
266
+## MODAL BODY
267
+      <form id='${psModalId}-form' method="GET" action="${psPostUrl}">
268
+        <div style="padding: 0.5em 0 0 0">
269
+          % if poNode!=None:
270
+            <input type="hidden" name="node_id" value="${poNode.node_id}"/>
271
+          % endif
272
+          <input type="hidden" name="parent_id" value="${piParentNodeId if piParentNodeId else 0}"/>
273
+          
274
+          <input type="hidden" name="data_content" id="${psModalId}-textarea" />
275
+          <input
276
+            type="text"
277
+            name="data_label"
278
+            value="${poNode.data_label if poNode!=None else ''}"
279
+            class="span4"
280
+            placeholder="${_('document title')}"
281
+          />
282
+        </div>
283
+        <div>
284
+          ${POD.RichTextEditor(psModalId+'-textarea-wysiwyg', poNode.data_content if poNode!=None else '')}
285
+        </div>
286
+      </form>
287
+
288
+## MODAL BODY [END]
289
+    </div>
290
+    
291
+    <div class="modal-footer">
292
+## MODAL FOOTER
293
+      <button class="btn" data-dismiss="modal" aria-hidden="true">
294
+        <i class="fa fa-ban"></i> ${_('Cancel')}
295
+      </button>
296
+      <button class="btn btn-success" id="${psModalId}-form-submit-button">
297
+        <i class="fa fa-check"></i> ${_('Save changes')}
298
+      </button>
299
+## MODAL FOOTER [END]
300
+      <script>
301
+        $('#${psModalId}-form-submit-button').click(function(){
302
+          $('#${psModalId}-textarea-wysiwyg').cleanHtml();
303
+          $('#${psModalId}-textarea').val($('#${psModalId}-textarea-wysiwyg').html());
304
+          $('#${psModalId}-form')[0].submit();
305
+        });
306
+      </script>
307
+    </div>
308
+  </div>
309
+</%def>
310
+
311
+
312
+<%def name="FileEditModalDialog(piParentNodeId, poNode, psPostUrl, psModalId, psTitle)">
313
+  <div
314
+    id="${psModalId}"
315
+    class="modal hide"
316
+    tabindex="-1"
317
+    role="dialog"
318
+    aria-labelledby="myModalLabel"
319
+    aria-hidden="true">
320
+    
321
+   <div class="modal-header">
322
+## MODAL HEADER
323
+      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
324
+      <h3 id="myModalLabel">${psTitle}</h3>
325
+## MODAL HEADER [END]
326
+    </div>
327
+
328
+    <div class="modal-body">
329
+## MODAL BODY
330
+      <form id='${psModalId}-form' method="POST" action="${psPostUrl}" enctype="multipart/form-data">
331
+          % if poNode!=None:
332
+            <input type="hidden" name="node_id" value="${poNode.node_id}"/>
333
+          % endif
334
+          <input type="hidden" name="parent_id" value="${piParentNodeId if piParentNodeId else 0}"/>
335
+          <input type="hidden" name="data_content" id="${psModalId}-textarea" />
336
+        <div>
337
+          <label>
338
+            ${_('Title')}
339
+            <input
340
+              type="text"
341
+              name="data_label"
342
+              value="${poNode.data_label if poNode!=None else ''}"
343
+              class="span4"
344
+              placeholder="${_('this field is optionnal')}"
345
+            />
346
+          </label>
347
+          <label>
348
+            ${_('Choose a file...')}
349
+            <input type="file" class="span4" placeholder="${_('choose a file...')}" name="data_file"/>
350
+          </label>
351
+          
352
+        </div>
353
+        <div>
354
+          <label>${_('File description (optionnal)')}</label>
355
+          ${POD.RichTextEditor(psModalId+'-textarea-wysiwyg', poNode.data_content if poNode!=None else '', '')}
356
+        </div>
357
+      </form>
358
+
359
+## MODAL BODY [END]
360
+    </div>
361
+    
362
+    <div class="modal-footer">
363
+## MODAL FOOTER
364
+      <button class="btn" data-dismiss="modal" aria-hidden="true">
365
+        <i class="fa fa-ban"></i> ${_('Cancel')}
366
+      </button>
367
+      <button class="btn btn-success" id="${psModalId}-form-submit-button">
368
+        <i class="fa fa-check"></i> ${_('Save changes')}
369
+      </button>
370
+## MODAL FOOTER [END]
371
+      <script>
372
+        $('#${psModalId}-form-submit-button').click(function(){
373
+          $('#${psModalId}-textarea-wysiwyg').cleanHtml();
374
+          $('#${psModalId}-textarea').val($('#${psModalId}-textarea-wysiwyg').html());
375
+          $('#${psModalId}-form')[0].submit();
376
+        });
377
+      </script>
378
+    </div>
379
+  </div>
380
+</%def>

+ 73 - 53
pboard/pboard/templates/document.mak View File

@@ -1,16 +1,21 @@
1 1
 <%inherit file="local:templates.master"/>
2 2
 <%namespace name="POD" file="pboard.templates.pod"/>
3 3
 <%namespace name="DOC" file="pboard.templates.document-widgets"/>
4
+<%namespace name="DOCTABS" file="pboard.templates.document-widgets-tabs"/>
4 5
 
5 6
 <%def name="title()">
6
-pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id} / ${current_node.getStatus().label}]
7
+  % if current_node!=None:
8
+    pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id} / ${current_node.getStatus().label}]
9
+  % else:
10
+    pod :: document root
11
+  % endif
7 12
 </%def>
8 13
 
9 14
 <%def name="node_treeview(node_list, indentation=-1)">
10 15
   % if indentation==-1:
11 16
     <div id='pod-menu-item-0' class="pod-toolbar-parent" style="padding-left: 0.5em; position: relative;">
12 17
       <a class="toggle-child-menu-items"><i class='fa fa-folder-open'></i></a>
13
-      <a href="?node=0" title="${_('Root')}">
18
+      <a href="${tg.url('/document')}" title="${_('Root')}">
14 19
         ${_('Root')}
15 20
       </a>
16 21
       <div class="pod-toolbar">
@@ -22,7 +27,7 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
22 27
   % else:
23 28
     % if len(node_list)>0:
24 29
       % for node in node_list:
25
-        <div id='pod-menu-item-${node.node_id}' class="pod-toolbar-parent ${'pod-status-active' if node.node_id==current_node.node_id else ''}" style="padding-left: ${(indentation+2)*0.5}em; position: relative;">
30
+        <div id='pod-menu-item-${node.node_id}' class="pod-toolbar-parent ${'pod-status-active' if current_node!=None and node.node_id==current_node.node_id else ''}" style="padding-left: ${(indentation+2)*0.5}em; position: relative;">
26 31
           <a class="toggle-child-menu-items"><i class='${node.getIconClass()}'></i></a>
27 32
           <a href="${tg.url('/document/%s'%(node.node_id))}" title="${node.data_label}">
28 33
             % if node.getStatus().status_family=='closed' or node.getStatus().status_family=='invisible':
@@ -80,6 +85,12 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
80 85
     </div>
81 86
     <div id='application-main-panel' class="span9">
82 87
 
88
+      % if current_node==None:
89
+        <div class="row">
90
+          ${DOC.FirstTimeFakeDocument()}
91
+        </div>
92
+        
93
+      % else:
83 94
       <div class="row">
84 95
         <div id='application-document-panel' class="span5">
85 96
           <div id='current-document-content' class="">
@@ -97,7 +108,7 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
97 108
         </div>
98 109
         <div id='application-metadata-panel' class="span4">
99 110
           <div class="tabbable">
100
-            <ul class="nav nav-tabs" style="margin-bottom: 0.5em;">
111
+            <ul class="nav nav-tabs" style="margin-bottom: 0em;">
101 112
                 <li>${DOC.MetadataTab('#subdocuments', 'tab', _('Subdocuments'), 'fa-file-text-o', current_node.getChildren())}</li>
102 113
                 <li class="active">${DOC.MetadataTab('#events', 'tab', _('Calendar'), 'fa-calendar', current_node.getEvents())}</li>
103 114
                 <li>${DOC.MetadataTab('#contacts', 'tab', _('Address book'), 'fa-user', current_node.getContacts())}</li>
@@ -113,20 +124,22 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
113 124
                 ################################
114 125
                 <!-- DEBUG - D.A. - 2013-11-07 - Not using tags for th moment -->
115 126
                 <div class="tab-pane" id="subdocuments">
116
-                  <p><strong>Sub-documents</strong></p> 
127
+                  <h4>${_('Sub-documents')}</h4>
128
+                  ${DOC.DocumentEditModalDialog(current_node.node_id, None, tg.url('/api/create_document'), 'add-subdocument-modal-%i'%current_node.node_id, _('New Sub-document'))}
129
+                  
117 130
                 % if len(current_node.getChildren())<=0:
118 131
                   <p class="pod-grey">
119 132
                     ${_("There is currently no child documents.")}<br/>
120 133
                   </p>
121 134
                   <p>
122
-                    
123
-                    <a class="btn btn-success btn-small" href="${tg.url('/api/create_document?parent_id=%i'%current_node.node_id)}">
124
-                      <i class="fa fa-plus"></i> ${_("Add one")}
135
+                    <a href="#add-subdocument-modal-${current_node.node_id}" role="button" class="btn btn-success btn-small" data-toggle="modal">
136
+                      <i class="fa fa-plus"></i>
137
+                      ${_("Add one")}
125 138
                     </a>
126 139
                   </p>
127 140
                 % else:
128 141
                   <p>
129
-                    <a class="btn btn-success btn-small" href="${tg.url('/api/create_document?parent_id=%i'%current_node.node_id)}">
142
+                    <a href="#add-subdocument-modal-${current_node.node_id}" role="button" class="btn btn-success btn-small" data-toggle="modal">
130 143
                       <i class="fa fa-plus"></i> ${_("Add one")}
131 144
                     </a>
132 145
                   </p>
@@ -150,7 +163,7 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
150 163
                 ##
151 164
                 ################################
152 165
                 <div class="tab-pane active" id="events">
153
-                  <p><strong>Calendar</strong></p> 
166
+                  <h4>${_('Calendar')}</h4> 
154 167
                 % if len(current_node.getEvents())<=0:
155 168
                   <p class="pod-grey">${_("The calendar is empty.")}<br/></p>
156 169
                   <p>${POD.AddButton('current-document-add-event-button', True, _(' Add first event'))}</p>
@@ -227,7 +240,7 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
227 240
                 ##
228 241
                 ##############################
229 242
                 <div class="tab-pane" id="contacts">
230
-                  <p><strong>${_('Address book')}</strong></p> 
243
+                  <h4>${_('Address book')}</h4> 
231 244
                 % if len(current_node.getContacts())<=0:
232 245
                   <p class="pod-grey">${_("The address book is empty.")}<br/></p>
233 246
                   <p>${POD.AddButton('current-document-add-contact-button', True, _(' Add first contact'), True)}</p>
@@ -275,53 +288,54 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
275 288
                 ## PANEL SHOWING LIST OF COMMENTS
276 289
                 ##
277 290
                 ################################
278
-                <div class="tab-pane" id="comments">
279
-                  <p><strong>${_('Comment thread')}</strong></p> 
291
+                <div class="tab-pane" id="comments" style="margin: 0;">
292
+                  <h4>${_('Comment thread')}</h4>
280 293
                 % if len(current_node.getComments())<=0:
281 294
                   <p class="pod-grey">${_("The comment thread is empty.")}<br/></p>
282
-                  <p>${POD.AddButton('current-document-add-comment-button', True, _('Add first comment'), True)}</p>
283
-                % else:
284
-                  <p>${POD.AddButton('current-document-add-comment-button', True, _('Add a comment'))}</p>
285 295
                 % endif
286
-
287
-                  <!-- ADD COMMENT FORM -->
288
-                  <form style='display: none;' id='current-document-add-comment-form' action='${tg.url('/api/create_comment')}' method='post' class="well">
289
-                    <input type="hidden" name='parent_id' value='${current_node.node_id}'/>
290
-                    <fieldset>
291
-                      <legend>${_('Add a comment')}</legend>
292
-                      <label>
293
-                        <input type="text" name='data_label' placeholder="Title"/>
294
-                      </label>
295
-                      <label>
296
-                        <div>
297
-                          <input type="hidden" id="add_comment_data_content_textarea" name='data_content' />
298
-                          ${POD.RichTextEditor('add_comment_data_content_textarea_wysiwyg', '', 'boldanditalic|undoredo|fullscreen')}
299
-                        </div>
300
-                      </label>
301
-                      ${POD.CancelButton('current-document-add-comment-cancel-button', True)}
302
-                      ${POD.SaveButton('current-document-add-comment-save-button', True)}
303
-                    </fieldset>
304
-                  </form>
305
-
306 296
                   <!-- LIST OF COMMENTS -->
307 297
                 % if len(current_node.getComments())>0:
308
-                  <table class="table table-striped table-hover table-condensed">
298
+                  <div>
309 299
                     % for comment in current_node.getComments():
310
-                      <tr title="Last updated: ${comment.updated_at}">
311
-                        <td>
312
-                          <i>The ${comment.getFormattedDate(comment.updated_at)} at ${comment.getFormattedTime(comment.updated_at)}: </i><br/>
313
-                          <b>${comment.data_label}</b>
314
-                          ## TODO - 2013-11-20 - Use the right form in order to update meta-data
315
-                          <a class="pull-right" href="${tg.url('/document/%i'%comment.node_id)}"><i class="fa fa-edit"></i></a>
316
-                          <br/>
317
-                          <p>
318
-                            ${comment.data_content|n}
319
-                          </p>
320
-                        </td>
321
-                      </tr>
300
+                      <p>
301
+                        <a href="${tg.url('/api/toggle_share_status', dict(node_id=comment.node_id))}">
302
+                          % if comment.is_shared:
303
+                            <span class="label label-warning" title="${_('Shared comment. Click to make private.')}"><i class="fa fa-group"></i></span>
304
+                          % else:
305
+                            <span class="label label-info" title="${_('Private comment. Click to share.')}"><i class="fa fa-key"></i></span>
306
+                          % endif
307
+                        </a>
308
+                        <strong>${comment._oOwner.display_name}</strong>
309
+                        <i class="pull-right">
310
+                          The ${comment.getFormattedDate(comment.updated_at)} 
311
+                          at ${comment.getFormattedTime(comment.updated_at)}
312
+                        </i>
313
+                        <br/>
314
+                        ${comment.data_content|n}
315
+                        <hr style="border-top: 1px dotted #ccc; margin: 0;"/>
316
+                      </p>
322 317
                     % endfor
323
-                  </table>
318
+                  </div>
324 319
                 % endif
320
+
321
+                  <!-- ADD COMMENT FORM -->
322
+                  <form class="form" id='current-document-add-comment-form' action='${tg.url('/api/create_comment')}' method='post'>
323
+                    <input type="hidden" name='parent_id' value='${current_node.node_id}'/>
324
+                    <input type="hidden" name='data_label' value=""/>
325
+                    <input type="hidden" id="add_comment_data_content_textarea" name='data_content' />
326
+                    ${POD.RichTextEditor('add_comment_data_content_textarea_wysiwyg', '', '')}
327
+                    <label>
328
+                      <input type="checkbox" name='is_shared'/> ${_('Share this comment')}
329
+                    </label>
330
+                    <span class="pull-right">
331
+                      % if len(current_node.getComments())<=0:
332
+                        ${POD.SaveButton('current-document-add-comment-save-button', True, _('Add first comment'))}
333
+                      % else:
334
+                        ${POD.SaveButton('current-document-add-comment-save-button', True, _('Comment'))}
335
+                      % endif
336
+                    </span>
337
+                  </form>
338
+
325 339
                 </div>
326 340
                 ################################
327 341
                 ##
@@ -329,7 +343,11 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
329 343
                 ##
330 344
                 ################################
331 345
                 <div class="tab-pane" id="files">
332
-                  <p><strong>${_('Attachments')}</strong></p> 
346
+                  ${DOCTABS.FilesTabContent(current_node)}
347
+                </div>
348
+
349
+                <div class="tab-pane" id="files">
350
+                  <h4>${_('Attachments')}</h4> 
333 351
                 % if len(current_node.getFiles())<=0:
334 352
                   <p class="pod-grey">${_("There is currently no attachment.")}<br/></p>
335 353
                   <p>${POD.AddButton('current-document-add-file-button', True, _(' Attach first file'))}</p>
@@ -390,14 +408,16 @@ pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id}
390 408
                 ## PANEL SHOWING ACCESS MANAGEMENT
391 409
                 ##
392 410
                 ################################
411
+                
393 412
                 <div class="tab-pane" id="accessmanagement">
394
-                  blabla
413
+                  ${DOCTABS.AccessManagementTab(current_node)}
395 414
                 </div>
396 415
               </div>
397 416
             </div>
398 417
           </div>
399 418
         </div>
400 419
       </div>
420
+      % endif
401 421
     </div>
402 422
   </div>
403
-
423
+</div>

+ 1 - 1
pboard/pboard/templates/master.mak View File

@@ -95,7 +95,7 @@
95 95
             </li>
96 96
 
97 97
             <li title="Rebuild document index">
98
-            % if current_node is UNDEFINED:
98
+            % if current_node is UNDEFINED or current_node==None:
99 99
               <a href="${tg.url('/api/reindex_nodes?back_to_node_id=0')}"><i class="fa fa-refresh"></i></a>
100 100
             % else:
101 101
               <a href="${tg.url('/api/reindex_nodes?back_to_node_id=%i'%(current_node.node_id))}"><i class="fa fa-refresh"></i></a>

+ 9 - 2
pboard/pboard/templates/pod.mak View File

@@ -35,8 +35,9 @@
35 35
   <button id='${piId}' type="button" class="${psButtonCssClass}" title="${psButtonTitle}"><i class="${psButtonIcon}"></i>${'' if (pbWithLabel==False) else ' %s'%(psButtonLabel)}</button>
36 36
 </%def>
37 37
 
38
-<%def name="SaveButton(piId, pbWithLabel=False)" >
39
-  ${Button(piId, pbWithLabel, 'btn btn-small btn-success', _('Save'), ' icon-g-ok-2 icon-g-white', _('Save'))}
38
+<%def name="SaveButton(piId, pbWithLabel=False, psLabel='Save')" >
39
+## FIXME - Make the default value use _() in order to be translated
40
+  ${Button(piId, pbWithLabel, 'btn btn-small btn-success', psLabel, ' icon-g-ok-2 icon-g-white', psLabel)}
40 41
 </%def>
41 42
 <%def name="EditButton(piId, pbWithLabel=False)" >
42 43
   ${Button(piId, pbWithLabel, 'btn btn-small', _('Edit'), 'fa fa-edit', _('Edit'))}
@@ -51,6 +52,12 @@
51 52
   ${Button(piId, pbWithLabel, 'btn btn-small', psLabel or _('New'), 'fa fa-plus', psLabel or _('New'))}
52 53
 % endif
53 54
 </%def>
55
+<%def name="OpenModalButton(psModalAnchor, psLabel)">
56
+  <a href="#${psModalAnchor}" role="button" class="btn btn-success btn-small" data-toggle="modal">
57
+    <i class="fa fa-plus"></i>${psLabel}
58
+  </a>
59
+</%def>
60
+
54 61
 <%def name='Badge(psLabel, psCssClass="")'>
55 62
   <span class='badge ${psCssClass}'>${psLabel}</span>
56 63
 </%def>