Changeset - 574825da0d4e
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2013-04-30 02:06:56
marcin@python-works.com
added compare option into bookmarks
2 files changed with 21 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rhodecode/templates/bookmarks/bookmarks.html
Show inline comments
 
@@ -19,39 +19,55 @@ ${self.context_bar('switch-to')}
 
<div class="box">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${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},
 
    {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("bookmarks_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/bookmarks/bookmarks_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,book in enumerate(c.repo_bookmarks.items()):
 
        <tr class="parity${cnt%2}">
 
            <td>
 
                <span class="logbooks">
 
@@ -21,12 +22,16 @@
 
            <td title="${book[1].author}">${h.person(book[1].author)}</td>
 
            <td>
 
              <div>
 
                  <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>
 
    </div>
 
%else:
 
    ${_('There are no bookmarks yet')}
0 comments (0 inline, 0 general)