Changeset - f6cdfc730831
[Not reviewed]
codereview
0 2 0
Marcin Kuzminski - 14 years ago 2012-05-07 22:51:26
marcin@python-works.com
Added compare buttons into branch views
2 files changed with 21 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/templates/branches/branches.html
Show inline comments
 
@@ -22,38 +22,52 @@
 
<div class="box">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${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},
 
    {key:"date",label:"${_('Date')}",sortable:true,
 
        sortOptions: { sortFunction: dateSort }},
 
    {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"));
 

	
 
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
 

	
 
myDataSource.responseSchema = {
 
    fields: [
 
        {key:"name"},
 
        {key:"date"},
 
        {key:"author"},
 
        {key:"revision"},
 
        {key:"compare"},
 
    ]
 
};
 

	
 
var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
 
        {
 
         sortedBy:{key:"name",dir:"asc"},
rhodecode/templates/branches/branches_data.html
Show inline comments
 
@@ -4,12 +4,13 @@
 
      <thead>
 
        <tr>
 
            <th class="left">${_('name')}</th>
 
            <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()):
 
		<tr class="parity${cnt%2}">
 
            <td>
 
                <span class="logtags">
 
@@ -21,12 +22,16 @@
 
            <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
 
            <td>
 
                <div>
 
                    <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:
 
          %for cnt,branch in enumerate(c.repo_closed_branches.items()):
 
          <tr class="parity${cnt%2}">
 
              <td>
 
@@ -39,12 +44,13 @@
 
              <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
 
              <td>
 
                <div>
 
                    <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
 
    </table>
 
    </div>
 
%else:
0 comments (0 inline, 0 general)