Changeset - 82aaf4e71817
[Not reviewed]
beta
0 13 0
Marcin Kuzminski - 15 years ago 2011-01-01 19:22:09
marcin@python-works.com
reimplemented tooltip, refactored tooltip_title into title for proper html,
and changed display strategy to right to temporary fix display problem with large tooltips
13 files changed with 35 insertions and 57 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -93,99 +93,77 @@ class _ToolTip(object):
 

	
 
    def __call__(self, tooltip_title, trim_at=50):
 
        """
 
        Special function just to wrap our text into nice formatted autowrapped
 
        text
 
        :param tooltip_title:
 
        """
 

	
 
        return wrap_paragraphs(escape(tooltip_title), trim_at)\
 
                       .replace('\n', '<br/>')
 

	
 
    def activate(self):
 
        """
 
        Adds tooltip mechanism to the given Html all tooltips have to have 
 
        set class tooltip and set attribute tooltip_title.
 
        Then a tooltip will be generated based on that
 
        All with yui js tooltip
 
        """Adds tooltip mechanism to the given Html all tooltips have to have 
 
        set class `tooltip` and set attribute `tooltip_title`.
 
        Then a tooltip will be generated based on that. All with yui js tooltip
 
        """
 

	
 
        js = '''
 
        YAHOO.util.Event.onDOMReady(function(){
 
            function toolTipsId(){
 
                var ids = [];
 
                var tts = YAHOO.util.Dom.getElementsByClassName('tooltip');
 
                
 
                for (var i = 0; i < tts.length; i++) {
 
                    //if element doesn't not have and id autgenerate one for tooltip
 
                    //if element doesn't not have and id autogenerate one for tooltip
 
                    
 
                    if (!tts[i].id){
 
                        tts[i].id='tt'+i*100;
 
                    }
 
                    ids.push(tts[i].id);
 
                }
 
                return ids        
 
            };
 
            var myToolTips = new YAHOO.widget.Tooltip("tooltip", { 
 
                context: toolTipsId(),
 
                monitorresize:false,
 
                xyoffset :[0,0],
 
                autodismissdelay:300000,
 
                hidedelay:5,
 
                showdelay:20,
 
            });
 
            
 
            //Mouse Over event disabled for new repositories since they don't
 
            //have last commit message
 
            myToolTips.contextMouseOverEvent.subscribe(
 
                function(type, args) {
 
                    var context = args[0];
 
                    var txt = context.getAttribute('tooltip_title');
 
                    if(txt){                                       
 
                        return true;
 
                    }
 
                    else{
 
                        return false;
 
                    }
 
                });
 
            
 
                            
 
            // Set the text for the tooltip just before we display it. Lazy method
 
            myToolTips.contextTriggerEvent.subscribe( 
 
                 function(type, args) { 
 

	
 
                 
 
                        var context = args[0]; 
 
                        
 
                        var txt = context.getAttribute('tooltip_title');
 
                        this.cfg.setProperty("text", txt);
 
                        
 
                        
 
                        // positioning of tooltip
 
                        var tt_w = this.element.clientWidth;
 
                        var tt_h = this.element.clientHeight;
 
                        //positioning of tooltip
 
                        var tt_w = this.element.clientWidth;//tooltip width
 
                        var tt_h = this.element.clientHeight;//tooltip height
 
                        
 
                        var context_w = context.offsetWidth;
 
                        var context_h = context.offsetHeight;
 
                        
 
                        var pos_x = YAHOO.util.Dom.getX(context);
 
                        var pos_y = YAHOO.util.Dom.getY(context);
 

	
 
                        var display_strategy = 'top';
 
                        var display_strategy = 'right';
 
                        var xy_pos = [0,0];
 
                        switch (display_strategy){
 
                        
 
                            case 'top':
 
                                var cur_x = (pos_x+context_w/2)-(tt_w/2);
 
                                var cur_y = pos_y-tt_h-4;
 
                                var cur_y = (pos_y-tt_h-4);
 
                                xy_pos = [cur_x,cur_y];                                
 
                                break;
 
                            case 'bottom':
 
                                var cur_x = (pos_x+context_w/2)-(tt_w/2);
 
                                var cur_y = pos_y+context_h+4;
 
                                xy_pos = [cur_x,cur_y];                                
 
                                break;
 
                            case 'left':
 
                                var cur_x = (pos_x-tt_w-4);
 
                                var cur_y = pos_y-((tt_h/2)-context_h/2);
 
                                xy_pos = [cur_x,cur_y];                                
 
                                break;
 
@@ -294,25 +272,25 @@ def pygmentize_annotation(filenode, **kw
 

	
 
        tooltip_html = tooltip_html % (changeset.author,
 
                                               changeset.date,
 
                                               tooltip(changeset.message))
 
        lnk_format = '%5s:%s' % ('r%s' % changeset.revision,
 
                                 short_id(changeset.raw_id))
 
        uri = link_to(
 
                lnk_format,
 
                url('changeset_home', repo_name=changeset.repository.name,
 
                    revision=changeset.raw_id),
 
                style=get_color_string(changeset.raw_id),
 
                class_='tooltip',
 
                tooltip_title=tooltip_html
 
                title=tooltip_html
 
              )
 

	
 
        uri += '\n'
 
        return uri
 
    return literal(annotate_highlight(filenode, url_func, **kwargs))
 

	
 
def repo_name_slug(value):
 
    """Return slug of name of repository
 
    This function is called on each creation/modification
 
    of repository to prevent bad names in repo
 
    """
 

	
 
@@ -419,40 +397,40 @@ def action_parser(user_log):
 
            revs_limit = 5 #display this amount always
 
            revs_top_limit = 50 #show upto this amount of changesets hidden
 
            revs = action_params.split(',')
 
            repo_name = user_log.repository.repo_name
 
            from rhodecode.model.scm import ScmModel
 

	
 
            message = lambda rev: get_changeset_safe(ScmModel().get(repo_name),
 
                                                     rev).message
 

	
 
            cs_links = " " + ', '.join ([link_to(rev,
 
                    url('changeset_home',
 
                    repo_name=repo_name,
 
                    revision=rev), tooltip_title=message(rev),
 
                    revision=rev), title=message(rev),
 
                    class_='tooltip') for rev in revs[:revs_limit] ])
 
            if len(revs) > revs_limit:
 
                uniq_id = revs[0]
 
                html_tmpl = ('<span> %s '
 
                '<a class="show_more" id="_%s" href="#">%s</a> '
 
                '%s</span>')
 
                cs_links += html_tmpl % (_('and'), uniq_id, _('%s more') \
 
                                            % (len(revs) - revs_limit),
 
                                            _('revisions'))
 

	
 
                html_tmpl = '<span id="%s" style="display:none"> %s </span>'
 
                cs_links += html_tmpl % (uniq_id, ', '.join([link_to(rev,
 
                    url('changeset_home',
 
                    repo_name=repo_name, revision=rev),
 
                    tooltip_title=message(rev), class_='tooltip')
 
                    title=message(rev), class_='tooltip')
 
                    for rev in revs[revs_limit:revs_top_limit]]))
 

	
 
            return cs_links
 
        return ''
 

	
 
    def get_fork_name():
 
        if action == 'user_forked_repo':
 
            from rhodecode.model.scm import ScmModel
 
            repo_name = action_params
 
            repo = ScmModel().get(repo_name)
 
            if repo is None:
 
                return repo_name
rhodecode/templates/admin/permissions/permissions.html
Show inline comments
 
@@ -37,25 +37,25 @@
 
                </div>
 
            </div>        
 
			<div class="field">
 
				<div class="label label-select">
 
					<label for="default_perm">${_('Repository permission')}:</label>
 
				</div>
 
				<div class="select">
 
					${h.select('default_perm','',c.perms_choices)}
 
				
 
		                ${h.checkbox('overwrite_default','true')}
 
		                <label for="overwrite_default">
 
		                <span class="tooltip" 
 
		                tooltip_title="${h.tooltip(_('All default permissions on each repository will be reset to choosen permission, note that all custom default permission on repositories will be lost'))}">
 
		                title="${h.tooltip(_('All default permissions on each repository will be reset to choosen permission, note that all custom default permission on repositories will be lost'))}">
 
		                ${_('overwrite existing settings')}</span> </label>
 
				</div>		                
 
			</div>   
 
			<div class="field">
 
		        <div class="label">
 
		            <label for="default_register">${_('Registration')}:</label>
 
		        </div>
 
				<div class="select">
 
					${h.select('default_register','',c.register_choices)}
 
				</div>
 
			</div> 		
 
             <div class="field">
rhodecode/templates/admin/repos/repos.html
Show inline comments
 
@@ -59,25 +59,25 @@
 
	            	<img class="icon" alt="${_('public')}"
 
	            	title="${_('Fork of')} ${repo['repo'].dbrepo.fork.repo_name}" 
 
	            	src="/images/icons/arrow_divide.png"/></a>
 
	            %endif                
 
                </td>
 
				<td title="${repo['description']}">${h.truncate(repo['description'],60)}</td>
 
	            <td>${h.age(repo['last_change'])}</td>
 
	            <td>
 
	            	%if repo['rev']>=0:
 
	            	${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
 
	                h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
 
	                class_="tooltip",
 
	                tooltip_title=h.tooltip(repo['last_msg']))}
 
	                title=h.tooltip(repo['last_msg']))}
 
	            	%else:
 
	            		${_('No changesets yet')}
 
	            	%endif    
 
	            </td>
 
	            <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
 
                <td>
 
                  ${h.form(url('repo', repo_name=repo['name']),method='delete')}
 
                    ${h.submit('remove_%s' % repo['name'],'delete',class_="delete_icon action_button",onclick="return confirm('Confirm to delete this repository');")}
 
                  ${h.end_form()}
 
                </td>
 
            </tr>
 
            %endfor
rhodecode/templates/admin/settings/settings.html
Show inline comments
 
@@ -26,25 +26,25 @@
 
    <div class="form">
 
        <!-- fields -->
 
        
 
        <div class="fields">
 
			<div class="field">
 
		        <div class="label label-checkbox">
 
		            <label for="destroy">${_('rescan option')}:</label>
 
		        </div>
 
		        <div class="checkboxes">
 
		            <div class="checkbox">
 
		                ${h.checkbox('destroy',True)}
 
		                <label for="checkbox-1">
 
		                <span class="tooltip" tooltip_title="${h.tooltip(_('In case a repository was deleted from filesystem and there are leftovers in the database check this option to scan obsolete data in database and remove it.'))}">
 
		                <span class="tooltip" title="${h.tooltip(_('In case a repository was deleted from filesystem and there are leftovers in the database check this option to scan obsolete data in database and remove it.'))}">
 
		                ${_('destroy old data')}</span> </label>
 
		            </div>
 
		        </div>
 
			</div>
 
                            
 
            <div class="buttons">
 
            ${h.submit('rescan','Rescan repositories',class_="ui-button")}
 
            </div>                                                          
 
        </div>
 
    </div>  
 
    ${h.end_form()}
 
    
 
@@ -156,25 +156,25 @@
 
                        <label for="hooks_preoutgoing_pull_logger">${_('Log user pull commands')}</label>
 
                    </div>                    										
 
				</div>
 
             </div>	
 
							                          
 
            <div class="field">
 
                <div class="label">
 
                    <label for="paths_root_path">${_('Repositories location')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('paths_root_path',size=30,readonly="readonly")}			                    
 
					<span id="path_unlock" class="tooltip" 
 
						tooltip_title="${h.tooltip(_('This a crucial application setting. If You really sure you need to change this, you must restart application in order to make this settings take effect. Click this label to unlock.'))}">
 
						title="${h.tooltip(_('This a crucial application setting. If You really sure you need to change this, you must restart application in order to make this settings take effect. Click this label to unlock.'))}">
 
		                ${_('unlock')}</span>
 
                </div>
 
            </div>
 
                                     
 
            <div class="buttons">
 
                ${h.submit('save','Save settings',class_="ui-button")}
 
                ${h.reset('reset','Reset',class_="ui-button")}
 
           </div>                                                          
 
        </div>
 
    </div>      
 
    ${h.end_form()}
 
    
rhodecode/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -131,25 +131,25 @@
 
		             %else:
 
		                <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
 
		             %endif
 
		                                             
 
		            ${h.link_to(repo['repo'].name, h.url('summary_home',repo_name=repo['repo'].name),class_="repo_name")}
 
		            %if repo['repo'].dbrepo.fork:
 
		            	<a href="${h.url('summary_home',repo_name=repo['repo'].dbrepo.fork.repo_name)}">
 
		            	<img class="icon" alt="${_('public')}"
 
		            	title="${_('Fork of')} ${repo['repo'].dbrepo.fork.repo_name}" 
 
		            	src="/images/icons/arrow_divide.png"/></a>
 
		            %endif		            
 
		            </td> 
 
		            <td><span class="tooltip" tooltip_title="${repo['repo'].last_change}">${("r%s:%s") % (h.get_changeset_safe(repo['repo'],'tip').revision,h.short_id(h.get_changeset_safe(repo['repo'],'tip').raw_id))}</span></td>
 
		            <td><span class="tooltip" title="${repo['repo'].last_change}">${("r%s:%s") % (h.get_changeset_safe(repo['repo'],'tip').revision,h.short_id(h.get_changeset_safe(repo['repo'],'tip').raw_id))}</span></td>
 
		            <td><a href="${h.url('repo_settings_home',repo_name=repo['repo'].name)}" title="${_('edit')}"><img class="icon" alt="${_('private')}" src="/images/icons/application_form_edit.png"/></a></td>
 
		            <td>
 
	                  ${h.form(url('repo_settings_delete', repo_name=repo['repo'].name),method='delete')}
 
	                    ${h.submit('remove_%s' % repo['repo'].name,'',class_="delete_icon action_button",onclick="return confirm('Confirm to delete this repository');")}
 
	                  ${h.end_form()}	            
 
		            </td>
 
		        </tr>
 
		     %endfor
 
	     %else:
 
	     	${_('No repositories yet')} 
 
	     	%if h.HasPermissionAny('hg.admin','hg.create.repository')():
 
	     		${h.link_to(_('create one now'),h.url('admin_settings_create_repository'))}
rhodecode/templates/branches/branches_data.html
Show inline comments
 
% if c.repo_branches:
 
    <table class="table_disp">
 
        <tr>
 
            <th class="left">${_('date')}</th>
 
            <th class="left">${_('name')}</th>
 
            <th class="left">${_('author')}</th>
 
            <th class="left">${_('revision')}</th>
 
            <th class="left">${_('links')}</th>
 
        </tr>
 
		%for cnt,branch in enumerate(c.repo_branches.items()):
 
		<tr class="parity${cnt%2}">
 
            <td><span class="tooltip" tooltip_title="${h.age(branch[1].date)}">
 
            <td><span class="tooltip" title="${h.age(branch[1].date)}">
 
                      ${branch[1].date}</span>
 
            </td>
 
            <td>
 
                <span class="logtags">
 
                    <span class="branchtag">${h.link_to(branch[0],
 
                    h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
 
                </span>         
 
            </td>		
 
            <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
 
            <td>r${branch[1].revision}:${h.short_id(branch[1].raw_id)}</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
rhodecode/templates/changelog/changelog.html
Show inline comments
 
@@ -62,27 +62,27 @@ ${c.repo_name} ${_('Changelog')} - ${c.r
 
									   <%
 
									       def changed_tooltip(cs):
 
                                               if cs:
 
                                                   pref = ': '
 
                                                   suf = '' 
 
                                                   if len(cs) > 30:
 
                                                      suf='<br/>'+_(' and %s more') % (len(cs) - 30)
 
                                                   return pref+'<br/> '.join([x.path for x in cs[:30]]) + suf
 
                                               else:
 
                                                   return ': '+_('No Files')
 
                                       %>
 
									
 
										<span class="removed tooltip" tooltip_title="${_('removed')}${h.literal(changed_tooltip(cs.removed))}">${len(cs.removed)}</span>
 
										<span class="changed tooltip" tooltip_title="${_('changed')}${h.literal(changed_tooltip(cs.changed))}">${len(cs.changed)}</span>
 
										<span class="added tooltip" tooltip_title="${_('added')}${h.literal(changed_tooltip(cs.added))}">${len(cs.added)}</span>
 
										<span class="removed tooltip" title="${_('removed')}${h.literal(changed_tooltip(cs.removed))}">${len(cs.removed)}</span>
 
										<span class="changed tooltip" title="${_('changed')}${h.literal(changed_tooltip(cs.changed))}">${len(cs.changed)}</span>
 
										<span class="added tooltip" title="${_('added')}${h.literal(changed_tooltip(cs.added))}">${len(cs.added)}</span>
 
									</div>					
 
										%if len(cs.parents)>1:
 
										<div class="merge">
 
											${_('merge')}<img alt="merge" src="/images/icons/arrow_join.png"/>
 
										</div>
 
										%endif
 
								   %if cs.parents:							
 
									%for p_cs in reversed(cs.parents):
 
										<div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(h.short_id(p_cs.raw_id),
 
											h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
 
										</div>
 
									%endfor
rhodecode/templates/files/files_browser.html
Show inline comments
 
@@ -69,31 +69,31 @@
 
		             <td>
 
		             %if node.is_file():
 
		             	${h.format_byte_size(node.size,binary=True)}
 
		             %endif	
 
		             </td>
 
		             <td>
 
		              %if node.is_file():
 
		                  ${node.mimetype}
 
		              %endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		<span class="tooltip" tooltip_title="${node.last_changeset.raw_id}">
 
		             		<span class="tooltip" title="${node.last_changeset.raw_id}">
 
		             		${node.last_changeset.revision}</span>
 
		             	%endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		<span class="tooltip" tooltip_title="${node.last_changeset.date}">
 
		             		<span class="tooltip" title="${node.last_changeset.date}">
 
                            ${h.age(node.last_changeset.date)}</span>
 
		             	%endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		${node.last_changeset.author}
 
		             	%endif                    
 
		             </td>
 
				</tr>
 
			%endfor
 
		</table>
 
	</div>
rhodecode/templates/index.html
Show inline comments
 
@@ -78,38 +78,38 @@
 
		            ##NAME   
 
		            ${h.link_to(repo['name'],
 
		                h.url('summary_home',repo_name=repo['name']),class_="repo_name")}
 
		            %if repo['repo'].dbrepo.fork:
 
		            	<a href="${h.url('summary_home',repo_name=repo['repo'].dbrepo.fork.repo_name)}">
 
		            	<img class="icon" alt="${_('fork')}"
 
		            	title="${_('Fork of')} ${repo['repo'].dbrepo.fork.repo_name}" 
 
		            	src="/images/icons/arrow_divide.png"/></a>
 
		            %endif
 
		            </div>
 
		            </td>
 
		            ##DESCRIPTION
 
		            <td><span class="tooltip" tooltip_title="${repo['description']}">
 
		            <td><span class="tooltip" title="${repo['description']}">
 
		               ${h.truncate(repo['description'],60)}</span>
 
		            </td>
 
		            ##LAST CHANGE
 
		            <td>
 
		              <span class="tooltip" tooltip_title="${repo['last_change']}">
 
		              <span class="tooltip" title="${repo['last_change']}">
 
		              ${h.age(repo['last_change'])}</span>
 
		            </td>
 
		            <td>
 
		            	%if repo['rev']>=0:
 
		            	${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
 
		                h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
 
		                class_="tooltip",
 
		                tooltip_title=h.tooltip(repo['last_msg']))}
 
		                title=h.tooltip(repo['last_msg']))}
 
		            	%else:
 
		            		${_('No changesets yet')}
 
		            	%endif    
 
		            </td>
 
		            <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
 
		            <td>
 
		                <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon"  href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
 
		            </td>        
 
		            <td>
 
		                <a title="${_('Subscribe to %s atom feed')%repo['name']}"  class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'])}"></a>
 
		            </td>
 
		        </tr>
rhodecode/templates/shortlog/shortlog_data.html
Show inline comments
 
@@ -9,25 +9,25 @@
 
		<th class="left">${_('branch')}</th>
 
		<th class="left">${_('tags')}</th>
 
		<th class="left">${_('links')}</th>
 
		
 
	</tr>
 
%for cnt,cs in enumerate(c.repo_changesets):
 
	<tr class="parity${cnt%2}">
 
        <td>
 
            ${h.link_to(h.truncate(cs.message,50),
 
            h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id),
 
            title=cs.message)}
 
        </td>
 
        <td><span class="tooltip" tooltip_title="${cs.date}">
 
        <td><span class="tooltip" title="${cs.date}">
 
                      ${h.age(cs.date)}</span>
 
        </td>        	
 
		<td title="${cs.author}">${h.person(cs.author)}</td>
 
		<td>r${cs.revision}:${h.short_id(cs.raw_id)}</td>
 
		<td>
 
			<span class="logtags">
 
				<span class="branchtag">${cs.branch}</span>
 
			</span>
 
		</td>
 
		<td>
 
			<span class="logtags">
 
				%for tag in cs.tags:
rhodecode/templates/tags/tags_data.html
Show inline comments
 
%if c.repo_tags:    
 
    <table>
 
    	<tr>
 
	        <th class="left">${_('date')}</th>
 
	        <th class="left">${_('name')}</th>
 
	        <th class="left">${_('author')}</th>
 
	        <th class="left">${_('revision')}</th>
 
			<th class="left">${_('links')}</th>
 
    	</tr>
 
		%for cnt,tag in enumerate(c.repo_tags.items()):
 
		<tr class="parity${cnt%2}">		
 
	        <td><span class="tooltip" tooltip_title="${h.age(tag[1].date)}">
 
	        <td><span class="tooltip" title="${h.age(tag[1].date)}">
 
                      ${tag[1].date}</span>
 
            </td>
 
            <td>
 
                <span class="logtags">
 
                    <span class="tagtag">${h.link_to(tag[0],
 
                    h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}</span>
 
                </span>
 
            </td>	        
 
	        <td title="${tag[1].author}">${h.person(tag[1].author)}</td>
 
	        <td>r${tag[1].revision}:${h.short_id(tag[1].raw_id)}</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
rhodecode/tests/functional/test_changelog.py
Show inline comments
 
from rhodecode.tests import *
 

	
 
class TestChangelogController(TestController):
 

	
 
    def test_index_hg(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO))
 

	
 
        assert """<div id="chg_20" class="container">""" in response.body, 'wrong info about number of changes'
 
        assert """<div class="date">commit 154: 5e204e7583b9@2010-08-10 01:18:46</div>""" in response.body , 'no info on this commit'
 
        assert """Small update at simplevcs app""" in response.body, 'missing info about commit message'
 
        assert """<span class="removed tooltip" tooltip_title="removed: No Files">0</span>""" in response.body, 'wrong info about removed nodes'
 
        assert """<span class="changed tooltip" tooltip_title="changed: vcs/backends/hg.py<br/> vcs/web/simplevcs/models.py">2</span>""" in response.body, 'wrong info about changed nodes'
 
        assert """<span class="added tooltip" tooltip_title="added: vcs/web/simplevcs/managers.py">1</span>""" in response.body, 'wrong info about added nodes'
 
        assert """<span class="removed tooltip" title="removed: No Files">0</span>""" in response.body, 'wrong info about removed nodes'
 
        assert """<span class="changed tooltip" title="changed: vcs/backends/hg.py<br/> vcs/web/simplevcs/models.py">2</span>""" in response.body, 'wrong info about changed nodes'
 
        assert """<span class="added tooltip" title="added: vcs/web/simplevcs/managers.py">1</span>""" in response.body, 'wrong info about added nodes'
 

	
 
        #pagination
 

	
 
        response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':1})
 
        response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':2})
 
        response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':3})
 
        response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':4})
 
        response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':5})
 
        response = self.app.get(url(controller='changelog', action='index', repo_name=HG_REPO), {'page':6})
 

	
 
        # Test response after pagination...
 
        assert """<div class="date">commit 64: 46ad32a4f974@2010-04-20 00:33:21</div>"""in response.body, 'wrong info about commit 64'
 
        assert """<span class="removed tooltip" tooltip_title="removed: docs/api.rst">1</span>"""in response.body, 'wrong info about number of removed'
 
        assert """<span class="changed tooltip" tooltip_title="changed: .hgignore<br/> README.rst<br/> docs/conf.py<br/> docs/index.rst<br/> setup.py<br/> tests/test_hg.py<br/> tests/test_nodes.py<br/> vcs/__init__.py<br/> vcs/backends/__init__.py<br/> vcs/backends/base.py<br/> vcs/backends/hg.py<br/> vcs/nodes.py<br/> vcs/utils/__init__.py">13</span>"""in response.body, 'wrong info about number of changes'
 
        assert """<span class="added tooltip" tooltip_title="added: docs/api/backends/hg.rst<br/> docs/api/backends/index.rst<br/> docs/api/index.rst<br/> docs/api/nodes.rst<br/> docs/api/web/index.rst<br/> docs/api/web/simplevcs.rst<br/> docs/installation.rst<br/> docs/quickstart.rst<br/> setup.cfg<br/> vcs/utils/baseui_config.py<br/> vcs/utils/web.py<br/> vcs/web/__init__.py<br/> vcs/web/exceptions.py<br/> vcs/web/simplevcs/__init__.py<br/> vcs/web/simplevcs/exceptions.py<br/> vcs/web/simplevcs/middleware.py<br/> vcs/web/simplevcs/models.py<br/> vcs/web/simplevcs/settings.py<br/> vcs/web/simplevcs/utils.py<br/> vcs/web/simplevcs/views.py">20</span>"""in response.body, 'wrong info about number of added'
 
        assert """<span class="removed tooltip" title="removed: docs/api.rst">1</span>"""in response.body, 'wrong info about number of removed'
 
        assert """<span class="changed tooltip" title="changed: .hgignore<br/> README.rst<br/> docs/conf.py<br/> docs/index.rst<br/> setup.py<br/> tests/test_hg.py<br/> tests/test_nodes.py<br/> vcs/__init__.py<br/> vcs/backends/__init__.py<br/> vcs/backends/base.py<br/> vcs/backends/hg.py<br/> vcs/nodes.py<br/> vcs/utils/__init__.py">13</span>"""in response.body, 'wrong info about number of changes'
 
        assert """<span class="added tooltip" title="added: docs/api/backends/hg.rst<br/> docs/api/backends/index.rst<br/> docs/api/index.rst<br/> docs/api/nodes.rst<br/> docs/api/web/index.rst<br/> docs/api/web/simplevcs.rst<br/> docs/installation.rst<br/> docs/quickstart.rst<br/> setup.cfg<br/> vcs/utils/baseui_config.py<br/> vcs/utils/web.py<br/> vcs/web/__init__.py<br/> vcs/web/exceptions.py<br/> vcs/web/simplevcs/__init__.py<br/> vcs/web/simplevcs/exceptions.py<br/> vcs/web/simplevcs/middleware.py<br/> vcs/web/simplevcs/models.py<br/> vcs/web/simplevcs/settings.py<br/> vcs/web/simplevcs/utils.py<br/> vcs/web/simplevcs/views.py">20</span>"""in response.body, 'wrong info about number of added'
 
        assert """<div class="message"><a href="/%s/changeset/46ad32a4f974e45472a898c6b0acb600320579b1">Merge with 2e6a2bf9356ca56df08807f4ad86d480da72a8f4</a></div>""" % HG_REPO in response.body, 'wrong info about commit 64 is a merge'
 

	
 

	
 

	
 
    #def test_index_git(self):
 
    #    self.log_user()
 
    #    response = self.app.get(url(controller='changelog', action='index', repo_name=GIT_REPO))
rhodecode/tests/functional/test_home.py
Show inline comments
 
@@ -3,13 +3,13 @@ from rhodecode.tests import *
 
class TestHomeController(TestController):
 

	
 
    def test_index(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='home', action='index'))
 
        #if global permission is set
 
        assert 'ADD NEW REPOSITORY' in response.body, 'No Button for add new repository'
 
        assert 'href="/%s/summary"' % HG_REPO in response.body, ' mising repository in list'
 
        # Test response...
 

	
 
        assert """<img class="icon" title="Mercurial repository" alt="Mercurial repository" src="/images/icons/hgicon.png"/>""" in response.body, 'wrong info about type of repositry'
 
        assert """<img class="icon" title="public repository" alt="public repository" src="/images/icons/lock_open.png"/>""" in response.body, 'wrong info about repository availabilty'
 
        assert """<a class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232dffcd24178a07ffeb5dfc" tooltip_title="merge">r173:27cd5cce30c9</a>""" in response.body, 'no info about tooltip'
 
        assert """<a class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232dffcd24178a07ffeb5dfc" title="merge">r173:27cd5cce30c9</a>""" in response.body, 'no info about tooltip'
0 comments (0 inline, 0 general)