changeset 3798:574825da0d4e beta

added compare option into bookmarks
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 30 Apr 2013 02:06:56 +0200
parents d7488551578e
children a732bbc40c7e
files rhodecode/templates/bookmarks/bookmarks.html rhodecode/templates/bookmarks/bookmarks_data.html
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/templates/bookmarks/bookmarks.html	Sat Apr 27 11:24:25 2013 +0200
+++ b/rhodecode/templates/bookmarks/bookmarks.html	Tue Apr 30 02:06:56 2013 +0200
@@ -22,13 +22,27 @@
         ${self.breadcrumbs()}
     </div>
     <!-- end box / title -->
+    %if c.repo_bookmarks:
+    <div class="info_box" id="compare_bookmarks" style="clear: both;padding: 10px 19px;text-align: right;"><a href="#" class="ui-btn small">${_('Compare bookmarks')}</a></div>
+    %endif
     <div class="table">
         <%include file='bookmarks_data.html'/>
     </div>
 </div>
 
 <script type="text/javascript">
+YUE.on('compare_bookmarks','click',function(e){
+    YUE.preventDefault(e);
+    var org = YUQ('input[name=compare_org]:checked')[0];
+    var other = YUQ('input[name=compare_other]:checked')[0];
 
+    if(org && other){
+        var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='book',org_ref='__ORG__',other_ref_type='book',other_ref='__OTHER__')}";
+        var u = compare_url.replace('__ORG__',org.value)
+                           .replace('__OTHER__',other.value);
+        window.location=u;
+    }
+});
 // main table sorting
 var myColumnDefs = [
     {key:"name",label:"${_('Name')}",sortable:true},
@@ -37,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("bookmarks_data"));
@@ -49,6 +64,7 @@
         {key:"date"},
         {key:"author"},
         {key:"revision"},
+        {key:"compare"},
     ]
 };
 
--- a/rhodecode/templates/bookmarks/bookmarks_data.html	Sat Apr 27 11:24:25 2013 +0200
+++ b/rhodecode/templates/bookmarks/bookmarks_data.html	Tue Apr 30 02:06:56 2013 +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,book in enumerate(c.repo_bookmarks.items()):
@@ -24,6 +25,10 @@
                   <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id)}">r${book[1].revision}:${h.short_id(book[1].raw_id)}</a></pre>
               </div>
             </td>
+            <td>
+                <input class="branch-compare" type="radio" name="compare_org" value="${book[0]}"/>
+                <input class="branch-compare" type="radio" name="compare_other" value="${book[0]}"/>
+            </td>
         </tr>
     %endfor
     </table>