changeset 1070:f52aab02db29 beta

Added dynamic followers counter change after toggle following action
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 19 Feb 2011 12:04:49 +0100
parents b4254b54d277
children 8320d5cdccd0
files rhodecode/templates/base/base.html
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/templates/base/base.html	Sat Feb 19 11:51:52 2011 +0100
+++ b/rhodecode/templates/base/base.html	Sat Feb 19 12:04:49 2011 +0100
@@ -264,7 +264,7 @@
                     <span class="icon_short">
                         <img src="${h.url("/images/icons/heart.png")}" alt="${_('Followers')}" />
                     </span>
-                    <span class="short">${c.repository_followers}</span>
+                    <span id="current_followers_count" class="short">${c.repository_followers}</span>
                     </a>
                 </li>
                 <li>
@@ -351,13 +351,25 @@
 function onSuccess(target){
 	
 	var f = YUD.get(target.id);
+	var f_cnt = YUD.get('current_followers_count');
+	
     if(f.getAttribute('class')=='follow'){
         f.setAttribute('class','following');
         f.setAttribute('title',"${_('Stop following this repository')}");
+        
+        if(f_cnt){
+            var cnt = Number(f_cnt.innerHTML)+1;
+            f_cnt.innerHTML = cnt;
+        }
+        
     }
     else{
         f.setAttribute('class','follow');
         f.setAttribute('title',"${_('Start following this repository')}");
+        if(f_cnt){
+            var cnt = Number(f_cnt.innerHTML)+1;
+            f_cnt.innerHTML = cnt;
+        }      
     }
 }