changeset 995:d14723711d17 beta

fixes for journal, added paging now it's possible to view whole journal fixed tooltip events for shortlog and journal paging. Moved journal to it's own templates
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 04 Feb 2011 17:36:41 +0100
parents 7f9d23f6a526
children 69e744932d22
files docs/changelog.rst rhodecode/controllers/journal.py rhodecode/lib/helpers.py rhodecode/public/css/style.css rhodecode/templates/base/base.html rhodecode/templates/journal.html rhodecode/templates/journal/journal.html rhodecode/templates/shortlog/shortlog_data.html
diffstat 8 files changed, 116 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/docs/changelog.rst	Fri Feb 04 13:40:38 2011 +0100
+++ b/docs/changelog.rst	Fri Feb 04 17:36:41 2011 +0100
@@ -22,9 +22,9 @@
   into clone url
 - fixed #90 whoosh indexer can index chooses repositories passed in command 
   line
-- added dynamic download links in summary. With quick branch/tag selection
+- extended journal with day aggregates and paging
 - implemented #107 customizable code highlights on code sources
-
+- implemented #108 extended and more powerfull LDAP configuration
 fixes
 -----
 
--- a/rhodecode/controllers/journal.py	Fri Feb 04 13:40:38 2011 +0100
+++ b/rhodecode/controllers/journal.py	Fri Feb 04 17:36:41 2011 +0100
@@ -30,10 +30,11 @@
 
 from pylons import request, response, session, tmpl_context as c, url
 
+from webhelpers.paginate import Page
+
 from rhodecode.lib.auth import LoginRequired, NotAnonymous
 from rhodecode.lib.base import BaseController, render
 from rhodecode.lib.helpers import get_token
-from rhodecode.lib.utils import OrderedDict
 from rhodecode.model.db import UserLog, UserFollowing
 from rhodecode.model.scm import ScmModel
 
@@ -65,13 +66,17 @@
                         UserLog.repository_id.in_(repo_ids),
                         UserLog.user_id.in_(user_ids),
                         ))\
-            .order_by(UserLog.action_date.desc())\
-            .limit(30)\
-            .all()
+            .order_by(UserLog.action_date.desc())
+
 
-        c.journal_day_aggreagate = self._get_daily_aggregate(journal)
+        p = int(request.params.get('page', 1))
+        c.journal_pager = Page(journal, page=p, items_per_page=10)
+        c.journal_day_aggreagate = self._get_daily_aggregate(c.journal_pager)
+        c.journal_data = render('journal/journal_data.html')
+        if request.params.get('partial'):
+            return c.journal_data
 
-        return render('/journal.html')
+        return render('journal/journal.html')
 
 
     def _get_daily_aggregate(self, journal):
--- a/rhodecode/lib/helpers.py	Fri Feb 04 13:40:38 2011 +0100
+++ b/rhodecode/lib/helpers.py	Fri Feb 04 17:36:41 2011 +0100
@@ -479,7 +479,7 @@
         if len(revs) > revs_limit:
             uniq_id = revs[0]
             html_tmpl = ('<span> %s '
-            '<a class="show_more" id="_%s" href="#">%s</a> '
+            '<a class="show_more" id="_%s" href="#more">%s</a> '
             '%s</span>')
             cs_links += html_tmpl % (_('and'), uniq_id, _('%s more') \
                                         % (len(revs) - revs_limit),
--- a/rhodecode/public/css/style.css	Fri Feb 04 13:40:38 2011 +0100
+++ b/rhodecode/public/css/style.css	Fri Feb 04 17:36:41 2011 +0100
@@ -1405,6 +1405,35 @@
 padding-bottom:4px;
 }
 
+#journal .journal_day{
+font-size:20px;
+padding:10px 0px;
+border-bottom:2px solid #DDD;
+margin-left:10px;
+margin-right:10px;
+}
+
+#journal .journal_action{
+padding-top:4px;
+min-height:15px;
+}
+
+#journal .journal_icon{
+float: left;
+padding-top: 4px;
+padding-left:12px;
+}
+
+#journal .journal_repo{
+margin-left: 38px;
+padding-top: 5px;
+}
+
+#journal .journal_repo .journal_repo_name{
+font-weight: bold;
+font-size: 1.1em;
+}
+
 .trending_language_tbl,.trending_language_tbl td {
 border:0 !important;
 margin:0 !important;
--- a/rhodecode/templates/base/base.html	Fri Feb 04 13:40:38 2011 +0100
+++ b/rhodecode/templates/base/base.html	Fri Feb 04 17:36:41 2011 +0100
@@ -105,7 +105,12 @@
 		       <p>RhodeCode ${c.rhodecode_version} &copy; 2010 by Marcin Kuzminski</p>
 	       </div>
 	   </div>
-        <script type="text/javascript">${h.tooltip.activate()}</script>
+        <script type="text/javascript">
+        function tooltip_activate(){
+        ${h.tooltip.activate()}
+        }
+        tooltip_activate();
+        </script>
 	</div>
 	<!-- end footer -->
 </body>
--- a/rhodecode/templates/journal.html	Fri Feb 04 13:40:38 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-## -*- coding: utf-8 -*-
-<%inherit file="base/base.html"/>
-<%def name="title()">
-    ${_('Journal')} - ${c.rhodecode_name}
-</%def>
-<%def name="breadcrumbs()">
-	${c.rhodecode_name}
-</%def>
-<%def name="page_nav()">
-	${self.menu('home')}
-</%def>
-<%def name="main()">
-	
-    <div class="box box-left">
-	    <!-- box / title -->
-	    <div class="title">
-	        <h5>${_('Journal')}</h5>
-	    </div>
-	    <div>
-	    %if c.journal_day_aggreagate:
-            %for day,items in c.journal_day_aggreagate:
-            <div style="font-size:20px;padding:10px 5px">${day}</div>
-	            % for entry in items:
-	            <div style="padding:10px">
-	                <div class="gravatar">
-	                    <img alt="gravatar" src="${h.gravatar_url(entry.user.email)}"/>
-	                </div>
-	                <div>${entry.user.name} ${entry.user.lastname}</div>
-	                <div style="padding-left: 45px;padding-top:5px;min-height:20px">${h.action_parser(entry)}</div>
-	                <div style="float: left; padding-top: 8px;padding-left:18px">
-	                ${h.action_parser_icon(entry)}
-	                </div>
-	                <div style="margin-left: 45px;padding-top: 10px">
-	                <span style="font-weight: bold;font-size: 1.1em">
-			        %if entry.repository:
-			          ${h.link_to(entry.repository.repo_name,
-			                      h.url('summary_home',repo_name=entry.repository.repo_name))}
-			        %else:
-			          ${entry.repository_name}
-			        %endif             
-	                </span> - <span title="${entry.action_date}">${h.age(entry.action_date)}</span>
-	                </div>
-	            </div>
-	            <div style="clear:both;border-bottom:1px dashed #DDD;padding:3px 3px;margin:0px 10px 0px 10px"></div>
-	            %endfor
-            %endfor
-        %else:
-            ${_('No entries yet')}
-        %endif   
-	    </div>
-    </div>
-    
-    <div class="box box-right">
-        <!-- box / title -->
-        <div class="title">
-            <h5>${_('Following')}</h5>
-        </div>
-        <div>
-        %if c.following:
-            %for entry in c.following:
-                <div class="currently_following">
-                    %if entry.follows_user_id:
-                      <img title="${_('following user')}" alt="${_('user')}" src="/images/icons/user.png"/>
-                      ${entry.follows_user.full_contact}
-                    %endif
-                    
-                    %if entry.follows_repo_id:
-                    
-                      %if entry.follows_repository.private:
-                        <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/>
-                      %else:
-                        <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="/images/icons/lock_open.png"/>
-                      %endif
-                      
-                      ${h.link_to(entry.follows_repository.repo_name,h.url('summary_home',
-                        repo_name=entry.follows_repository.repo_name))}
-                      
-                    %endif
-                </div>
-            %endfor
-        %else:
-            ${_('You are not following any users or repositories')}
-        %endif               
-        </div>
-    </div>
-    
-    <script type="text/javascript">
-    YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
-        var el = e.target;
-        YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
-        YUD.setStyle(el.parentNode,'display','none');
-    });    
-    </script>
-    
-</%def>    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rhodecode/templates/journal/journal.html	Fri Feb 04 17:36:41 2011 +0100
@@ -0,0 +1,64 @@
+## -*- coding: utf-8 -*-
+<%inherit file="/base/base.html"/>
+<%def name="title()">
+    ${_('Journal')} - ${c.rhodecode_name}
+</%def>
+<%def name="breadcrumbs()">
+	${c.rhodecode_name}
+</%def>
+<%def name="page_nav()">
+	${self.menu('home')}
+</%def>
+<%def name="main()">
+	
+    <div class="box box-left">
+	    <!-- box / title -->
+	    <div class="title">
+	        <h5>${_('Journal')}</h5>
+	    </div>
+		<script type="text/javascript">
+		function show_more_event(){
+		YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
+		    var el = e.target;
+		    YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
+		    YUD.setStyle(el.parentNode,'display','none');
+		});
+		}
+		</script> 	    
+	    <div id="journal">${c.journal_data}</div>
+    </div>
+    
+    <div class="box box-right">
+        <!-- box / title -->
+        <div class="title">
+            <h5>${_('Following')}</h5>
+        </div>
+        <div>
+		%if c.following:
+		    %for entry in c.following:
+		        <div class="currently_following">
+		            %if entry.follows_user_id:
+		              <img title="${_('following user')}" alt="${_('user')}" src="/images/icons/user.png"/>
+		              ${entry.follows_user.full_contact}
+		            %endif
+		            
+		            %if entry.follows_repo_id:
+		            
+		              %if entry.follows_repository.private:
+		                <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/>
+		              %else:
+		                <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="/images/icons/lock_open.png"/>
+		              %endif
+		              
+		              ${h.link_to(entry.follows_repository.repo_name,h.url('summary_home',
+		                repo_name=entry.follows_repository.repo_name))}
+		              
+		            %endif
+		        </div>
+		    %endfor
+		%else:
+		    ${_('You are not following any users or repositories')}
+		%endif
+        </div>
+    </div>    
+</%def>    
--- a/rhodecode/templates/shortlog/shortlog_data.html	Fri Feb 04 13:40:38 2011 +0100
+++ b/rhodecode/templates/shortlog/shortlog_data.html	Fri Feb 04 17:36:41 2011 +0100
@@ -49,14 +49,15 @@
   var data_div = 'shortlog_data';
   YAHOO.util.Event.onDOMReady(function(){
     YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
-            YAHOO.util.Dom.setStyle('shortlog_data','opacity','0.3');});});
+            YAHOO.util.Dom.setStyle(data_div,'opacity','0.3');});});
 </script>
 
 <div class="pagination-wh pagination-left">
 ${c.repo_changesets.pager('$link_previous ~2~ $link_next',     
 onclick="""YAHOO.util.Connect.asyncRequest('GET','$partial_url',{
 success:function(o){YAHOO.util.Dom.get(data_div).innerHTML=o.responseText;
-YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
+tooltip_activate();
+YUE.on(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
         YAHOO.util.Dom.setStyle(data_div,'opacity','0.3');});       
 YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")}
 </div>