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
 
@@ -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 @@ var myColumnDefs = [
 
    {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 @@ myDataSource.responseSchema = {
 
        {key:"date"},
 
        {key:"author"},
 
        {key:"revision"},
 
        {key:"compare"},
 
    ]
 
};
 

	
rhodecode/templates/branches/branches_data.html
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)