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
 
@@ -102,11 +102,9 @@ class _ToolTip(object):
 
                       .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 = '''
 
@@ -116,7 +114,7 @@ class _ToolTip(object):
 
                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;
 
@@ -134,35 +132,15 @@ class _ToolTip(object):
 
                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;
 
@@ -170,13 +148,13 @@ class _ToolTip(object):
 
                        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':
 
@@ -303,7 +281,7 @@ def pygmentize_annotation(filenode, **kw
 
                    revision=changeset.raw_id),
 
                style=get_color_string(changeset.raw_id),
 
                class_='tooltip',
 
                tooltip_title=tooltip_html
 
                title=tooltip_html
 
              )
 

	
 
        uri += '\n'
 
@@ -428,7 +406,7 @@ def action_parser(user_log):
 
            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]
 
@@ -443,7 +421,7 @@ def action_parser(user_log):
 
                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
rhodecode/templates/admin/permissions/permissions.html
Show inline comments
 
@@ -46,7 +46,7 @@
 
		                ${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>   
rhodecode/templates/admin/repos/repos.html
Show inline comments
 
@@ -68,7 +68,7 @@
 
	            	${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    
rhodecode/templates/admin/settings/settings.html
Show inline comments
 
@@ -35,7 +35,7 @@
 
		            <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>
 
@@ -165,7 +165,7 @@
 
                <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>
rhodecode/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -140,7 +140,7 @@
 
		            	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')}
rhodecode/templates/branches/branches_data.html
Show inline comments
 
@@ -9,7 +9,7 @@
 
        </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>
rhodecode/templates/changelog/changelog.html
Show inline comments
 
@@ -71,9 +71,9 @@ ${c.repo_name} ${_('Changelog')} - ${c.r
 
                                                   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">
rhodecode/templates/files/files_browser.html
Show inline comments
 
@@ -78,13 +78,13 @@
 
		             </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>
rhodecode/templates/index.html
Show inline comments
 
@@ -87,12 +87,12 @@
 
		            </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>
 
@@ -100,7 +100,7 @@
 
		            	${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    
rhodecode/templates/shortlog/shortlog_data.html
Show inline comments
 
@@ -18,7 +18,7 @@
 
            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>
rhodecode/templates/tags/tags_data.html
Show inline comments
 
@@ -9,7 +9,7 @@
 
    	</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>
rhodecode/tests/functional/test_changelog.py
Show inline comments
 
@@ -9,9 +9,9 @@ class TestChangelogController(TestContro
 
        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
 

	
 
@@ -24,9 +24,9 @@ class TestChangelogController(TestContro
 

	
 
        # 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'
 

	
 

	
rhodecode/tests/functional/test_home.py
Show inline comments
 
@@ -12,4 +12,4 @@ class TestHomeController(TestController)
 

	
 
        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)