Browse Source

several improvments: clean homepage, moved reindex method to api controller, popover for history view, etc

damien 11 years ago
parent
commit
f49a4bb4f8

+ 16 - 0
pboard/pboard/controllers/api.py View File

@@ -170,3 +170,19 @@ class PODApiController(BaseController):
170 170
         pm.DBSession.delete(loNode)
171 171
       redirect(lurl('/document/%i'%(liParentId or 0)))
172 172
 
173
+    @expose()
174
+    def reindex_nodes(self, back_to_node_id=0):
175
+      """show the user dashboard"""
176
+      loRootNodeList   = pm.DBSession.query(pmd.PBNode).order_by(pmd.PBNode.parent_id).all()
177
+      for loNode in loRootNodeList:
178
+        if loNode.parent_id==None:
179
+          loNode.node_depth = 0
180
+          loNode.parent_tree_path = '/'
181
+        else:
182
+          loNode.node_depth = loNode._oParent.node_depth+1
183
+          loNode.parent_tree_path = '%s%i/'%(loNode._oParent.parent_tree_path,loNode.parent_id)
184
+      
185
+      pm.DBSession.flush()
186
+      flash(_('Documents re-indexed'), 'info')
187
+      redirect(lurl('/document/%s'%(back_to_node_id)))
188
+

+ 3 - 22
pboard/pboard/controllers/root.py View File

@@ -18,6 +18,8 @@ import pboard.controllers as pbc
18 18
 from pboard.lib import dbapi as pld
19 19
 from pboard.controllers import api as pbca
20 20
 
21
+import pboard.model.data as pbmd
22
+
21 23
 __all__ = ['RootController']
22 24
 
23 25
 
@@ -48,7 +50,7 @@ class RootController(BaseController):
48 50
     @expose('pboard.templates.index')
49 51
     def index(self):
50 52
         """Handle the front-page."""
51
-        return dict(page='index')
53
+        return dict()
52 54
 
53 55
     @expose('pboard.templates.about')
54 56
     def about(self):
@@ -134,24 +136,3 @@ class RootController(BaseController):
134 136
         print "===> DDD"
135 137
         return dict(root_node_list=loRootNodeList, current_node=loCurrentNode, node_status_list = loNodeStatusList)
136 138
 
137
-
138
-    @expose()
139
-    def fill_treepath(self):
140
-        """show the user dashboard"""
141
-        import pboard.model.data as pbmd
142
-        
143
-        loRootNodeList   = pbm.DBSession.query(pbmd.PBNode).order_by(pbmd.PBNode.parent_id).all()
144
-        for loNode in loRootNodeList:
145
-          if loNode.parent_id==None:
146
-            loNode.node_depth = 0
147
-            loNode.parent_tree_path = '/'
148
-          else:
149
-            loNode.node_depth = loNode._oParent.node_depth+1
150
-            loNode.parent_tree_path = '%s%i/'%(loNode._oParent.parent_tree_path,loNode.parent_id)
151
-        
152
-        pbm.DBSession.flush()
153
-        
154
-        return 
155
-
156
-
157
-

+ 0 - 2
pboard/pboard/lib/dbapi.py View File

@@ -106,7 +106,5 @@ def buildTreeListForMenu():
106 106
         loTmpDict[loNode.parent_id] = getNode(loNode.parent_id)
107 107
       loTmpDict[loNode.parent_id].appendStaticChild(loNode)
108 108
 
109
-  print "=================="
110
-  print loTmpDict[101].getStaticChildList()
111 109
   return loTreeList
112 110
 

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

@@ -169,7 +169,7 @@ class PBNode(DeclarativeBase):
169 169
   node_id          = Column(Integer, Sequence('pb_nodes__node_id__sequence'), primary_key=True)
170 170
   parent_id        = Column(Integer, ForeignKey('pb_nodes.node_id'), nullable=True, default=None)
171 171
   node_depth       = Column(Integer, unique=False, nullable=False, default=0)
172
-  parent_tree_path = Column(Unicode(255), unique=False, nullable=False, default=u'data')
172
+  parent_tree_path = Column(Unicode(255), unique=False, nullable=False, default=u'')
173 173
 
174 174
   node_order  = Column(Integer, nullable=True, default=1)
175 175
   node_type   = Column(Unicode(16), unique=False, nullable=False, default=u'data')

+ 5 - 4
pboard/pboard/templates/document.mak View File

@@ -118,7 +118,6 @@ POD :: ${current_node.getTruncatedLabel(40)} [${current_node.getStatus().label}]
118 118
         <a href='${tg.url('/api/force_delete_node?node_id=%i'%(current_node.node_id))}' id='current-document-force-delete-button' class="btn" onclick="return confirm('${_('Delete current document?')}');"><i class="icon-g-remove"></i> ${_('Delete')}</a>
119 119
       </div>
120 120
       
121
-            <!--</div> PAGE HEADER -->
122 121
       <h3 id="current-document-title">#${current_node.node_id} - ${current_node.data_label}</h3>
123 122
         <form style='display: none; margin-top: 1em;' id="current-document-title-edit-form" method='post' action='${tg.url('/api/edit_label')}'>
124 123
           <div class="input-prepend input-append">
@@ -147,8 +146,8 @@ POD :: ${current_node.getTruncatedLabel(40)} [${current_node.getStatus().label}]
147 146
     <div id='application-metadata-panel' class="span4">
148 147
       <div class="tabbable">
149 148
         <ul class="nav nav-tabs">
150
-            <li class="active"><a href="#tags" data-toggle="tab" title="${_('Tags')}"><i class='icon-g-tags'></i></a></li>
151
-            <li><a href="#events" data-toggle="tab" title="History"><i class="icon-g-history"></i>${POD.ItemNb(current_node.getEvents())}</a></li>
149
+            ## DEBUG - D.A. - 2013-11-07 -  <li class="active"><a href="#tags" data-toggle="tab" title="${_('Tags')}"><i class='icon-g-tags'></i></a></li>
150
+            <li class="active"><a href="#events" data-toggle="tab" title="History"><i class="icon-g-history"></i>${POD.ItemNb(current_node.getEvents())}</a></li>
152 151
             <li><a href="#contacts" data-toggle="tab" title="Contacts"><i class="icon-g-user""></i>${POD.ItemNb(current_node.getContacts())}</a></li>
153 152
             <li><a href="#comments" data-toggle="tab" title="Comments"><i class="icon-g-conversation"></i>${POD.ItemNb(current_node.getComments())}</a></li>
154 153
             <li><a href="#files" data-toggle="tab" title="Files"><i class="icon-g-attach"></i>${POD.ItemNb(current_node.getFiles())}</a></li>
@@ -159,6 +158,7 @@ POD :: ${current_node.getTruncatedLabel(40)} [${current_node.getStatus().label}]
159 158
             ## PANEL SHOWING LIST OF TAGS
160 159
             ##
161 160
             ################################
161
+            <!-- DEBUG - D.A. - 2013-11-07 - Not using tags for th moment
162 162
             <div class="tab-pane" id="tags">
163 163
               <div class="well">
164 164
                 <p>
@@ -176,6 +176,7 @@ POD :: ${current_node.getTruncatedLabel(40)} [${current_node.getStatus().label}]
176 176
                 % endfor
177 177
               </div>
178 178
             </div>
179
+            -->
179 180
             ################################
180 181
             ##
181 182
             ## PANEL SHOWING LIST OF EVENTS
@@ -234,7 +235,7 @@ POD :: ${current_node.getTruncatedLabel(40)} [${current_node.getStatus().label}]
234 235
                   </tr>
235 236
                 </thead>
236 237
                 % for event in current_node.getEvents():
237
-                  <tr title="Last updated: ${event.updated_at}">
238
+                  <tr class="item-with-data-popoverable" data-content="${event.data_content}" rel="popover" data-placement="left" data-trigger="hover">
238 239
                     <td>${event.getFormattedDate(event.data_datetime)}</td>
239 240
                     <td>${event.getFormattedTime(event.data_datetime)}</td>
240 241
                     <td>${event.data_label}</td>

+ 13 - 108
pboard/pboard/templates/index.mak View File

@@ -11,75 +11,24 @@
11 11
       </div>
12 12
 
13 13
       <div class="row">
14
-        <div class="span3">
15
-          <h3>Store structured data</h3>
16
-          <ul>
17
-            <li>contact information,</li>
18
-            <li>notes, files,</li>
19
-            <li>todos, events, reminders,</li>
20
-            <li>...</li>
21
-          </ul>
14
+        <div class="span2 alert alert-success">
15
+          <p><button><i class="icon-g-cardio"></i> <strong>Track</strong> projects</button></p>
16
+          <p><button><i class="icon-g-edit"></i> <strong>Take</strong> notes</button></p>
17
+          <p><button><i class="icon-g-attach"></i> <strong>Keep</strong> files</button></p>
18
+          <span><button><i class="icon-g-ok"></i> <strong>Manage</strong> status</button></span>
22 19
         </div>
23
-
24
-        <div class="span3">
25
-          <h3>Share information</h3>
20
+        <div class="span6 well well-small">
21
+          <h5>
22
+            <i class="icon-g-group"></i>
23
+            Use cases
24
+          </h5>
26 25
           <ul>
27
-            <li>Data is private, shared or public,</li>
28
-            <li>Send notification to co-workers,</li>
29
-            <li>Work together on the same data,</li>
26
+            <li>Search a job</li>
27
+            <li>Manage clients</li>
28
+            <li>Track tasks</li>
30 29
             <li>...</li>
31 30
           </ul>
32 31
         </div>
33
-
34
-        <div class="span3">
35
-          <h3>Manage Lifetime</h3>
36
-          <ul>
37
-            <li>Real life and information timelines,</li>
38
-            <li>Explore the life of information,</li>
39
-            <li>Create, open and close projects,</li>
40
-            <li>...</li>
41
-          </ul>
42
-        </div>
43
-      </div>
44
-
45
-      <div class="row">
46
-        <div class="span9">
47
-          <h3>Is it for me ?</h3>
48
-          <p>
49
-            You are prospecting clients? Looking for a job? Taking notes for your work? You're not sure ?
50
-          </p>
51
-          <p class="alert aler-warning">
52
-            Hey! What do you risk? Give it a try!
53
-          </p>
54
-        </div>
55
-      </div>
56
-      <div>
57
-        <h2>What can I do with pod ?</h2>
58
-        <ul style="list-style:none;">
59
-          <li><i class="icon-chevron-right"></i> Manage projects and tasks during their entire life:
60
-            <ul style="list-style:none;">
61
-              <li><i class="icon-chevron-right"></i> Create events and reminders</li>
62
-              <li><i class="icon-chevron-right"></i> Take and keep notes</li>
63
-              <li><i class="icon-chevron-right"></i> Keep contact information about people</li>
64
-              <li><i class="icon-chevron-right"></i> Organise data and information</li>
65
-            </ul>
66
-          </li>
67
-          <li>
68
-            <i class="icon-chevron-right"></i> Share up-to-date information:
69
-            <ul style="list-style:none;">
70
-              <li><i class="icon-chevron-right"></i> Organize and update information</li>
71
-              <li><i class="icon-chevron-right"></i> Send notifications to friends</li>
72
-              <li><i class="icon-chevron-right"></i> Manage information life</li>
73
-            </ul>
74
-          </li>
75
-        </ul>
76
-        If you see this page it means your installation was successful!</p>
77
-        <p>TurboGears 2 is rapid web application development toolkit designed to make your life easier.</p>
78
-        <p>
79
-          <a class="btn btn-primary btn-large" href="http://www.turbogears.org" target="_blank">
80
-            ${h.icon('book', True)} Learn more
81
-          </a>
82
-        </p>
83 32
       </div>
84 33
     </div>
85 34
     <div class="span3">
@@ -92,51 +41,7 @@
92 41
           <input type="submit" id="submit" value="Sign up" /><br/>
93 42
         </fieldset>
94 43
       </form>
95
-      
96
-      <div class="popover bottom">
97
-        <div class="arrow"></div>
98
-        <h3 class="popover-title">
99
-          Why to sign up ?
100
-        </h3>
101
-        <div>
102
-          <p>
103
-            blabla
104
-          </p>
105
-        </div>
106
-      </div>
107
-      <div class="alert alert-info">
108
-        <strong>Why to sign up ?</strong>
109
-      </div>
110
-      <div class="well">
111
-        <p>
112
-          <i class="icon-signal"></i> Make information live
113
-        </p>
114
-        <p>
115
-          <i class="icon-refresh"></i> Share up-to-date information
116
-        </p>
117
-        <p>
118
-          <i class="icon-list"></i> Manage tasks and projects
119
-        </p>
120
-      </div>
121 44
     </div>
122 45
   </div>
123 46
 
124
-  <div class="row">
125
-    <div class="span4">
126
-      <h3>Code your data model</h3>
127
-      <p> Design your data <code>model</code>, Create the database, and Add some bootstrap data.</p>
128
-    </div>
129
-
130
-    <div class="span4">
131
-      <h3>Design your URL architecture</h3>
132
-      <p> Decide your URLs, Program your <code>controller</code> methods, Design your
133
-        <code>templates</code>, and place some static files (CSS and/or Javascript). </p>
134
-    </div>
135
-
136
-    <div class="span4">
137
-      <h3>Distribute your app</h3>
138
-      <p> Test your source, Generate project documents, Build a distribution.</p>
139
-    </div>
140
-  </div>
141 47
 
142
-  <div class="notice"> Thank you for choosing TurboGears.</div>

+ 27 - 9
pboard/pboard/templates/master.mak View File

@@ -445,6 +445,8 @@ tr:Hover td div.pod-toolbar {
445 445
                 });
446 446
               });
447 447
 
448
+$('.item-with-data-popoverable').popover({ html: true});
449
+
448 450
             </script>
449 451
 </body>
450 452
 
@@ -453,9 +455,10 @@ tr:Hover td div.pod-toolbar {
453 455
     flash=tg.flash_obj.render('flash', use_js=False)
454 456
   %>
455 457
   % if flash:
456
-    <div class="row"><div class="span8 offset2">
458
+    <div class="row">
459
+      <button type="button" class="close" data-dismiss="alert">&times;</button>
457 460
       ${flash | n}
458
-    </div></div>
461
+    </div>
459 462
   % endif
460 463
   ${self.body()}
461 464
 </%def>
@@ -478,25 +481,40 @@ tr:Hover td div.pod-toolbar {
478 481
   <div id="pod-navbar" class="navbar navbar-fixed-top">
479 482
     <div class="navbar-inner">
480 483
       <div class="container">
481
-        <a class="brand" href="#"><!--img src="${tg.url('/img/turbogears_logo.png')}" alt="TurboGears 2"/--> <strong>pod</strong></a>
482 484
         <div class="nav-collapse">
483 485
           <ul class="nav">
484
-            <li class="active"><a href="${tg.url('/document')}"><i class="icon-g-book-open"></i> ${_('Documents')}</a></li>
486
+            <li>
487
+              <a href="${tg.url('/')}">
488
+                <i class="icon-g-home"></i>
489
+                Home
490
+              </a>
491
+            </li>
492
+            <li>
493
+              <a href="${tg.url('/document')}"><i class="icon-g-book-open"></i> ${_('Documents')}</a>
494
+            </li>
485 495
             <li>
486 496
               <a title="${_('Toggle view mode: narrow')}" id='view-size-toggle-button-small' style="display: none;"><i class='icon-g-eye-open'></i> ${_('View mode')}</a>
487 497
               <a title="${_('Toggle view mode: medium')}" id='view-size-toggle-button-medium'><i class='icon-g-eye-open'></i> ${_('View mode')}</a>
488 498
               <a title="${_('Toggle view mode: large')}" id='view-size-toggle-button-large' style="display: none;"><i class='icon-g-eye-open'></i> ${_('View mode')}</a>
489 499
             </li>
490
-            <li><a href="${tg.url('/iconset')}"><i class="icon-g-show-thumbnails"></i> ${_('Icons')}</a></li>
500
+
501
+            <li>
502
+            % if current_node is UNDEFINED:
503
+              <a href="${tg.url('/api/reindex_nodes?back_to_node_id=0')}"><i class="icon-g-refresh"></i> Reindex documents</a>
504
+            % else:
505
+              <a href="${tg.url('/api/reindex_nodes?back_to_node_id=%i'%(current_node.node_id))}"><i class="icon-g-refresh"></i> Reindex documents</a>
506
+            % endif
507
+            </li>
491 508
 
492 509
           % if request.identity:
493 510
             <li class="dropdown">
494 511
               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Admin <b class="caret"></b></a>
495 512
               <ul class="dropdown-menu">
496
-                <li class="${('', 'active')[page=='admin']}"><a href="${tg.url('/admin')}">Manage</a></li>
497
-                <li class="${('', 'active')[page=='about']}"><a href="${tg.url('/about')}">About</a></li>
498
-                <li class="${('', 'active')[page=='data']}"><a href="${tg.url('/data')}">Serving Data</a></li>
499
-                <li class="${('', 'active')[page=='environ']}"><a href="${tg.url('/environ')}">WSGI Environment</a></li>
513
+                <li><a href="${tg.url('/admin')}">Manage</a></li>
514
+                <li><a href="${tg.url('/about')}">About</a></li>
515
+                <li><a href="${tg.url('/data')}">Serving Data</a></li>
516
+                <li><a href="${tg.url('/environ')}">WSGI Environment</a></li>
517
+                <li><a href="${tg.url('/iconset')}"><i class="icon-g-show-thumbnails"></i> ${_('Icons')}</a></li>
500 518
               </ul>
501 519
             </li>
502 520
           % endif