Changeset - f22d103ba9e8
[Not reviewed]
default
0 4 0
Mads Kiilerich - 11 years ago 2014-07-18 18:45:54
madski@unity3d.com
changelog: use css for message expand and make it toggle so it also can be collapsed again
4 files changed with 16 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/public/css/style.css
Show inline comments
 
@@ -2590,96 +2590,108 @@ BIN_FILENODE = 6
 

	
 
#graph_content #changesets .container .date {
 
    width: 76px;
 
    color: #666;
 
    font-size: 10px;
 
}
 

	
 
#graph_content_pr .compare_view_commits .expand_commit,
 
#graph_content .container .expand_commit {
 
    width: 24px;
 
    cursor: pointer;
 
}
 

	
 
#graph_content #changesets .container .right {
 
    width: 120px;
 
    padding-right: 0px;
 
    overflow: visible;
 
    position: relative;
 
}
 

	
 
#graph_content .container .mid {
 
    padding: 0;
 
}
 

	
 
#graph_content .log-container {
 
    position: relative;
 
}
 

	
 
#graph_content .container .changeset_range {
 
    float: left;
 
    margin: 6px 3px;
 
}
 

	
 
#graph_content .container .author img {
 
    vertical-align: middle;
 
}
 

	
 
#graph_content .container .author .user {
 
    color: #444444;
 
}
 

	
 
#graph_content .container .mid .message {
 
    white-space: pre-wrap;
 
    padding: 0;
 
    overflow: hidden;
 
    height: 1.1em;
 
}
 

	
 
#graph_content_pr .compare_view_commits .message {
 
    white-space: normal !important;
 
    padding: 0 !important;
 
    height: 1.1em;
 
}
 

	
 
#graph_content .container .mid .message.expanded,
 
#graph_content_pr .compare_view_commits .message.expanded {
 
    height: auto;
 
    margin: 4px 0px 4px 0px;
 
}
 

	
 
#graph_content .container .extra-container {
 
    display: block;
 
    position: absolute;
 
    top: -15px;
 
    right: 0;
 
    padding-left: 5px;
 
    background: #FFFFFF;
 
    height: 41px;
 
}
 

	
 
#graph_content .comments-container,
 
#shortlog_data .comments-container,
 
#graph_content .logtags {
 
    display: block;
 
    float: left;
 
    overflow: hidden;
 
    padding: 0;
 
    margin: 0;
 
}
 

	
 
#graph_content .comments-container {
 
    margin: 0.8em 0;
 
    margin-right: 0.5em;
 
}
 

	
 
#graph_content  .tagcontainer {
 
    width: 80px;
 
    position: relative;
 
    float: right;
 
    height: 100%;
 
    top: 7px;
 
    margin-left: 0.5em;
 
}
 

	
 
#graph_content .logtags {
 
    min-width: 80px;
 
    height: 1.1em;
 
    position: absolute;
 
    left: 0px;
 
    width: auto;
 
    top: 0px;
 
}
 

	
 
#graph_content .logtags.tags {
 
    top: 14px;
 
}
 

	
 
#graph_content .logtags:hover {
kallithea/templates/changelog/changelog.html
Show inline comments
 
@@ -214,79 +214,78 @@ ${self.repo_context_bar('changelog', c.f
 
                                                                    'rev_start': rev_start,
 
                                                                    'rev_end': rev_end})
 

	
 
                        YUD.setStyle('compare_fork','display','none');
 
                    }else{
 
                        YUD.setStyle('rev_range_container','display','none');
 
                        YUD.setStyle('rev_range_clear','display','none');
 
                        %if c.revision:
 
                            YUD.get('open_new_pr').href = pyroutes.url('pullrequest_home',
 
                                                                       {'repo_name': '${c.repo_name}',
 
                                                                        'rev_end':'${c.first_revision.raw_id}'});
 
                        %else:
 
                            YUD.get('open_new_pr').href = pyroutes.url('pullrequest_home',
 
                                                                       {'repo_name': '${c.repo_name}',
 
                                                                        'branch':'${c.first_revision.branch}'});
 
                        %endif
 
                        YUD.setStyle('compare_fork','display','');
 
                    }
 
                };
 
                YUE.onDOMReady(checkbox_checker);
 
                YUE.on(checkboxes,'click', checkbox_checker);
 

	
 
                YUE.on('rev_range_clear','click',function(e){
 
                    for (var i=0; i<checkboxes.length; i++){
 
                        var cb = checkboxes[i];
 
                        cb.checked = false;
 
                    }
 
                    checkbox_checker();
 
                    YUE.preventDefault(e);
 
                });
 

	
 
                var msgs = YUQ('.message');
 
                // get first element height
 
                var el = YUQ('#graph_content .container')[0];
 
                var row_h = el.clientHeight;
 
                for(var i=0;i<msgs.length;i++){
 
                    var m = msgs[i];
 

	
 
                    var h = m.clientHeight;
 
                    var pad = YUD.getStyle(m,'padding');
 
                    if(h > row_h){
 
                        var offset = row_h - (h+12);
 
                        YUD.setStyle(m.nextElementSibling,'display','block');
 
                        YUD.setStyle(m.nextElementSibling,'margin-top',offset+'px');
 
                    };
 
                }
 

	
 
                $('.expand_commit').on('click',function(e){
 
                    $(this).children('i').hide();
 
                    var cid = $(this).attr('commit_id');
 
                    $('#C-'+cid).css({'height': 'auto', 'margin': '4px 0px 4px 0px'})
 
                    $('#C-'+cid).toggleClass('expanded');
 

	
 
                    //redraw the graph, r and jsdata are bound outside function
 
                    r.render(jsdata,100);
 
                });
 

	
 
                // change branch filter
 
                YUE.on(YUD.get('branch_filter'),'change',function(e){
 
                    var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
 
                    if(selected_branch != ''){
 
                        window.location = pyroutes.url('changelog_home', {'repo_name': '${c.repo_name}',
 
                                                                          'branch':selected_branch});
 
                    }else{
 
                        window.location = pyroutes.url('changelog_home', {'repo_name': '${c.repo_name}'});
 
                    }
 
                });
 

	
 
                var jsdata = ${c.jsdata|n};
 
                var r = new BranchRenderer('graph_canvas', 'graph_content');
 
                r.render(jsdata,100);
 
            });
 

	
 
        </script>
 
        %else:
 
            ${_('There are no changes yet')}
 
        %endif
 
    </div>
 
</div>
 
</%def>
kallithea/templates/compare/compare_cs.html
Show inline comments
 
## Changesets table !
 
<div class="container">
 
  %if not c.cs_ranges:
 
    <span class="empty_data">${_('No changesets')}</span>
 
  %else:
 

	
 
    %if c.ancestor:
 
    <div class="ancestor">${_('Ancestor')}:
 
      ${h.link_to(h.short_id(c.ancestor),h.url('changeset_home',repo_name=c.repo_name,revision=c.ancestor))}
 
    </div>
 
    %endif
 

	
 
    <table class="compare_view_commits noborder">
 
    %for cs in reversed(c.cs_ranges):
 
        <tr id="row-${cs.raw_id}">
 
        <td style="width:50px">
 
          %if cs.raw_id in c.statuses:
 
            <div title="${_('Changeset status: %s') % c.statuses[cs.raw_id][1]}" class="changeset-status-ico">
 
                <img height="16" width="16" src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cs.raw_id][0])}" />
 
            </div>
 
          %endif
 
        </td>
 
        <td style="width: 140px"><span class="tooltip" title="${h.tooltip(h.age(cs.date))}">${cs.date}</span></td>
 
        <td><div class="gravatar" commit_id="${cs.raw_id}"><img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),14)}" height="14" width="14"/></div></td>
 
        <td><div class="author">${h.person(cs.author)}</div></td>
 
        <td>${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.other_repo.repo_name,revision=cs.raw_id))}</td>
 
        <td>
 
        %if cs.branch:
 
        <span class="branchtag">${cs.branch}</span>
 
        %endif
 
        </td>
 
        <td class="expand_commit" commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
 
            <i class="icon-resize-vertical" style="color:#DDD"></i>
 
        </td>
 
        <td><div id="C-${cs.raw_id}" class="message" style="white-space:normal; height:1.1em; padding:0">${h.urlify_commit(cs.message, c.repo_name)}</div></td>
 
        <td><div id="C-${cs.raw_id}" class="message">${h.urlify_commit(cs.message, c.repo_name)}</div></td>
 
        </tr>
 
    %endfor
 
    </table>
 
    %if c.as_form:
 
      <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">
 
      ## links should perhaps use ('rev', c.org_rev) instead ...
 
      ${h.link_to(_('Show merge diff'),
 
        h.url('compare_url',
 
          repo_name=c.org_repo.repo_name,
 
          org_ref_type=c.org_ref_type, org_ref_name=c.org_ref_name,
 
          other_repo=c.other_repo.repo_name,
 
          other_ref_type=c.other_ref_type, other_ref_name=c.other_ref_name,
 
          merge='1'),
 
        )}
 
      </div>
 
      <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">
 
        ${_('Common ancestor')}:
 
        %if c.ancestor:
 
        ${h.link_to(h.short_id(c.ancestor),h.url('changeset_home',repo_name=c.repo_name,revision=c.ancestor))}
 
        %else:
 
        ${_('No common ancestor found - repositories are unrelated')}
 
        %endif
 
      </div>
 
    %endif
 
    %if c.cs_ranges_org is not None:
 
      ## TODO: list actual changesets?
 
      <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">
 
        ${h.link_to_ref(c.other_repo.repo_name, c.other_ref_type, c.other_ref_name, c.other_rev)}
 
        ${_('is')}
 
        <a href="${c.swap_url}">${_('%s changesets') % (len(c.cs_ranges_org))}</a>
 
        ${_('behind')}
 
        ${h.link_to_ref(c.org_repo.repo_name, c.org_ref_type, c.org_ref_name, c.org_rev)}
 
      </div>
 
    %endif
 
  %endif
 
</div>
 

	
 
<script>
 
$('.expand_commit').on('click',function(e){
 
    $(this).children('i').hide();
 
    var cid = $(this).attr('commit_id');
 
    $('#C-'+cid).css({'height': 'auto','width': 'auto', 'white-space': 'pre'})
 
    $('#C-'+cid).toggleClass('expanded');
 
});
 
$('.gravatar').on('click',function(e){
 
    var cid = $(this).attr('commit_id');
 
    $('#row-'+cid).toggleClass('hl', !$('#row-'+cid).hasClass('hl'));
 
});
 
</script>
kallithea/tests/functional/test_compare.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
from kallithea.tests import *
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.meta import Session
 
from kallithea.model.db import Repository
 
from kallithea.model.scm import ScmModel
 
from kallithea.lib.vcs.backends.base import EmptyChangeset
 
from kallithea.tests.fixture import Fixture
 

	
 
fixture = Fixture()
 

	
 

	
 
def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False):
 
    repo = Repository.get_by_repo_name(repo)
 
    _cs = parent
 
    if not parent:
 
        _cs = EmptyChangeset(alias=vcs_type)
 

	
 
    if newfile:
 
        nodes = {
 
            filename: {
 
                'content': content
 
            }
 
        }
 
        cs = ScmModel().create_nodes(
 
            user=TEST_USER_ADMIN_LOGIN, repo=repo,
 
            message=message,
 
            nodes=nodes,
 
            parent_cs=_cs,
 
            author=TEST_USER_ADMIN_LOGIN,
 
        )
 
    else:
 
        cs = ScmModel().commit_change(
 
            repo=repo.scm_instance, repo_name=repo.repo_name,
 
            cs=parent, user=TEST_USER_ADMIN_LOGIN,
 
            author=TEST_USER_ADMIN_LOGIN,
 
            message=message,
 
            content=content,
 
            f_path=filename
 
        )
 
    return cs
 

	
 

	
 
def _commit_div(sha, msg):
 
    return """<div id="C-%s" class="message" style="white-space:normal; height:1.1em; padding:0">%s</div>""" % (sha, msg)
 
    return """<div id="C-%s" class="message">%s</div>""" % (sha, msg)
 

	
 

	
 
class TestCompareController(TestController):
 

	
 
    def setUp(self):
 
        self.r1_id = None
 
        self.r2_id = None
 

	
 
    def tearDown(self):
 
        if self.r2_id:
 
            RepoModel().delete(self.r2_id)
 
        if self.r1_id:
 
            RepoModel().delete(self.r1_id)
 
        Session().commit()
 
        Session.remove()
 

	
 
    def test_compare_forks_on_branch_extra_commits_hg(self):
 
        self.log_user()
 
        repo1 = fixture.create_repo('one', repo_type='hg',
 
                                    repo_description='diff-test',
 
                                    cur_user=TEST_USER_ADMIN_LOGIN)
 
        self.r1_id = repo1.repo_id
 
        #commit something !
 
        cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
 
                             message='commit1', vcs_type='hg', parent=None, newfile=True)
 

	
 
        #fork this repo
 
        repo2 = fixture.create_fork('one', 'one-fork')
 
        self.r2_id = repo2.repo_id
 

	
 
        #add two extra commit into fork
 
        cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n',
 
                             message='commit2', vcs_type='hg', parent=cs0)
 

	
 
        cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
 
                             message='commit3', vcs_type='hg', parent=cs1)
 

	
 
        rev1 = 'default'
 
        rev2 = 'default'
 

	
 
        response = self.app.get(url('compare_url',
 
                                    repo_name=repo1.repo_name,
 
                                    org_ref_type="branch",
 
                                    org_ref_name=rev2,
 
                                    other_repo=repo2.repo_name,
 
                                    other_ref_type="branch",
 
                                    other_ref_name=rev1,
 
                                    merge='1',))
0 comments (0 inline, 0 general)