changeset 2243:f6cdfc730831 codereview

Added compare buttons into branch views
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 07 May 2012 22:51:26 +0200
parents 87e9718ab4a2
children 77e376fdc4c6
files rhodecode/templates/branches/branches.html rhodecode/templates/branches/branches_data.html
diffstat 2 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/templates/branches/branches.html	Mon May 07 22:07:55 2012 +0200
+++ b/rhodecode/templates/branches/branches.html	Mon May 07 22:51:26 2012 +0200
@@ -25,12 +25,24 @@
         ${self.breadcrumbs()}
     </div>
     <!-- end box / title -->
+    <div class="info_box" id="compare_branches" style="clear: both;padding: 10px 19px;vertical-align: right;text-align: right;"><a href="#" class="ui-btn small">${_('Compare branches')}</a></div>
     <div class="table">
         <%include file='branches_data.html'/>
     </div>
 </div>
 <script type="text/javascript">
-
+YUE.on('compare_branches','click',function(e){
+	YUE.preventDefault(e);
+	var org = YUQ('input[name=compare_org]:checked')[0];
+	var other = YUQ('input[name=compare_other]:checked')[0];
+	var compare_url = "${h.url('compare_home',repo_name=c.repo_name,ref='__ORG__...__OTHER__')}";
+	if(org && other){
+		var u = compare_url.replace('__ORG__','branch:'+org.value)
+		                   .replace('__OTHER__','branch:'+other.value);
+		window.location=u;
+	}
+	
+})
 // main table sorting
 var myColumnDefs = [
     {key:"name",label:"${_('Name')}",sortable:true},
@@ -39,6 +51,7 @@
     {key:"author",label:"${_('Author')}",sortable:true},
     {key:"revision",label:"${_('Revision')}",sortable:true,
         sortOptions: { sortFunction: revisionSort }},
+    {key:"compare",label:"${_('Compare')}",sortable:false,},
 ];
 
 var myDataSource = new YAHOO.util.DataSource(YUD.get("branches_data"));
@@ -51,6 +64,7 @@
         {key:"date"},
         {key:"author"},
         {key:"revision"},
+        {key:"compare"},
     ]
 };
 
--- a/rhodecode/templates/branches/branches_data.html	Mon May 07 22:07:55 2012 +0200
+++ b/rhodecode/templates/branches/branches_data.html	Mon May 07 22:51:26 2012 +0200
@@ -7,6 +7,7 @@
             <th class="left">${_('date')}</th>
             <th class="left">${_('author')}</th>
             <th class="left">${_('revision')}</th>
+            <th class="left">${_('compare')}</th>
         </tr>
       </thead>
 		%for cnt,branch in enumerate(c.repo_branches.items()):
@@ -24,6 +25,10 @@
                     <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id)}">r${branch[1].revision}:${h.short_id(branch[1].raw_id)}</a></pre>
                 </div>
             </td>
+            <td>
+                <input class="branch-compare" type="radio" name="compare_org" value="${branch[0]}"/>
+                <input class="branch-compare" type="radio" name="compare_other" value="${branch[0]}"/>
+            </td>
 		</tr>
 		%endfor
         % if hasattr(c,'repo_closed_branches') and c.repo_closed_branches:
@@ -42,6 +47,7 @@
                     <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id)}">r${branch[1].revision}:${h.short_id(branch[1].raw_id)}</a></pre>
                 </div>
               </td>
+              <td></td>
           </tr>
           %endfor
         %endif