Mercurial > kallithea
changeset 2427:f467c75544af beta
Added h.tooltip to all places that tooltip_title is used.
- improved escaping of < and > inside tooltips
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/lib/helpers.py Fri Jun 08 21:54:50 2012 +0200 @@ -108,7 +108,7 @@ def __call__(self, field_name, form_errors): tmpl = """<span class="error_msg">%s</span>""" - if form_errors and form_errors.has_key(field_name): + if form_errors and field_name in form_errors: return literal(tmpl % form_errors.get(field_name)) get_error = _GetError() @@ -117,12 +117,15 @@ class _ToolTip(object): def __call__(self, tooltip_title, trim_at=50): - """Special function just to wrap our text into nice formatted + """ + Special function just to wrap our text into nice formatted autowrapped text :param tooltip_title: """ - return escape(tooltip_title) + tooltip_title = escape(tooltip_title) + tooltip_title = tooltip_title.replace('<', '<').replace('>', '>') + return tooltip_title tooltip = _ToolTip() @@ -349,7 +352,7 @@ if date: return (date.strftime(_(u"%a, %d %b %Y %H:%M:%S").encode('utf8')) .decode('utf8')) - + return ""
--- a/rhodecode/templates/admin/repos/repos.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/admin/repos/repos.html Fri Jun 08 21:54:50 2012 +0200 @@ -56,7 +56,7 @@ </td> ##LAST CHANGE <td> - <span class="tooltip" title="${repo['last_change']}">${h.age(repo['last_change'])}</span> + <span class="tooltip" title="${h.tooltip(repo['last_change'])}">${h.age(repo['last_change'])}</span> </td> ##LAST REVISION <td>
--- a/rhodecode/templates/admin/users_groups/users_groups.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/admin/users_groups/users_groups.html Fri Jun 08 21:54:50 2012 +0200 @@ -37,7 +37,7 @@ %for cnt,u_group in enumerate(c.users_groups_list): <tr class="parity${cnt%2}"> <td>${h.link_to(u_group.users_group_name,h.url('edit_users_group', id=u_group.users_group_id))}</td> - <td><span class="tooltip" title="${', '.join(map(h.safe_unicode,[x.user.username for x in u_group.members[:50]]))}">${len(u_group.members)}</span></td> + <td><span class="tooltip" title="${h.tooltip(', '.join(map(h.safe_unicode,[x.user.username for x in u_group.members[:50]])))}">${len(u_group.members)}</span></td> <td>${h.bool2icon(u_group.users_group_active)}</td> <td> ${h.form(url('users_group', id=u_group.users_group_id),method='delete')}
--- a/rhodecode/templates/bookmarks/bookmarks_data.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/bookmarks/bookmarks_data.html Fri Jun 08 21:54:50 2012 +0200 @@ -17,7 +17,7 @@ h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id))}</span> </span> </td> - <td><span class="tooltip" title="${h.age(book[1].date)}">${h.fmt_date(book[1].date)}</span></td> + <td><span class="tooltip" title="${h.tooltip(h.age(book[1].date))}">${h.fmt_date(book[1].date)}</span></td> <td title="${book[1].author}">${h.person(book[1].author)}</td> <td> <div>
--- a/rhodecode/templates/branches/branches_data.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/branches/branches_data.html Fri Jun 08 21:54:50 2012 +0200 @@ -17,7 +17,7 @@ h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span> </span> </td> - <td><span class="tooltip" title="${h.age(branch[1].date)}">${h.fmt_date(branch[1].date)}</span></td> + <td><span class="tooltip" title="${h.tooltip(h.age(branch[1].date))}">${h.fmt_date(branch[1].date)}</span></td> <td title="${branch[1].author}">${h.person(branch[1].author)}</td> <td> <div> @@ -35,7 +35,7 @@ h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span> </span> </td> - <td><span class="tooltip" title="${h.age(branch[1].date)}">${h.fmt_date(branch[1].date)}</span></td> + <td><span class="tooltip" title="${h.tooltip(h.age(branch[1].date))}">${h.fmt_date(branch[1].date)}</span></td> <td title="${branch[1].author}">${h.person(branch[1].author)}</td> <td> <div>
--- a/rhodecode/templates/changelog/changelog.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/changelog/changelog.html Fri Jun 08 21:54:50 2012 +0200 @@ -49,7 +49,7 @@ <div class="left"> <div> ${h.checkbox(cs.short_id,class_="changeset_range")} - <span class="tooltip" title="${h.age(cs.date)}"><a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}"><span class="changeset_id">${cs.revision}:<span class="changeset_hash">${h.short_id(cs.raw_id)}</span></span></a></span> + <span class="tooltip" title="${h.tooltip(h.age(cs.date))}"><a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}"><span class="changeset_id">${cs.revision}:<span class="changeset_hash">${h.short_id(cs.raw_id)}</span></span></a></span> </div> <div class="author"> <div class="gravatar"> @@ -65,7 +65,7 @@ </div> <div class="right"> <div class="changes"> - <div id="${cs.raw_id}" style="float:right;" class="changed_total tooltip" title="${_('Affected number of files, click to show more details')}">${len(cs.affected_files)}</div> + <div id="${cs.raw_id}" style="float:right;" class="changed_total tooltip" title="${h.tooltip(_('Affected number of files, click to show more details'))}">${len(cs.affected_files)}</div> <div class="comments-container"> %if len(c.comments.get(cs.raw_id,[])) > 0: <div class="comments-cnt" title="${('comments')}">
--- a/rhodecode/templates/changelog/changelog_details.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/changelog/changelog_details.html Fri Jun 08 21:54:50 2012 +0200 @@ -1,9 +1,9 @@ % if len(c.cs.affected_files) <= c.affected_files_cut_off: -<span class="removed tooltip" title="<b>${_('removed')}</b>${h.changed_tooltip(c.cs.removed)}">${len(c.cs.removed)}</span> -<span class="changed tooltip" title="<b>${_('changed')}</b>${h.changed_tooltip(c.cs.changed)}">${len(c.cs.changed)}</span> -<span class="added tooltip" title="<b>${_('added')}</b>${h.changed_tooltip(c.cs.added)}">${len(c.cs.added)}</span> +<span class="removed tooltip" title="<b>${h.tooltip(_('removed'))}</b>${h.changed_tooltip(c.cs.removed)}">${len(c.cs.removed)}</span> +<span class="changed tooltip" title="<b>${h.tooltip(_('changed'))}</b>${h.changed_tooltip(c.cs.changed)}">${len(c.cs.changed)}</span> +<span class="added tooltip" title="<b>${h.tooltip(_('added'))}</b>${h.changed_tooltip(c.cs.added)}">${len(c.cs.added)}</span> % else: - <span class="removed tooltip" title="${_('affected %s files') % len(c.cs.affected_files)}">!</span> - <span class="changed tooltip" title="${_('affected %s files') % len(c.cs.affected_files)}">!</span> - <span class="added tooltip" title="${_('affected %s files') % len(c.cs.affected_files)}">!</span> + <span class="removed tooltip" title="${h.tooltip(_('affected %s files') % len(c.cs.affected_files))}">!</span> + <span class="changed tooltip" title="${h.tooltip(_('affected %s files') % len(c.cs.affected_files))}">!</span> + <span class="added tooltip" title="${h.tooltip(_('affected %s files') % len(c.cs.affected_files))}">!</span> % endif
--- a/rhodecode/templates/changeset/changeset.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/changeset/changeset.html Fri Jun 08 21:54:50 2012 +0200 @@ -34,8 +34,8 @@ ${h.fmt_date(c.changeset.date)} </div> <div class="diff-actions"> - <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show')}" title="${_('raw diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white.png')}"/></a> - <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download')}" title="${_('download diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white_get.png')}"/></a> + <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show')}" class="tooltip" title="${h.tooltip(_('raw diff'))}"><img class="icon" src="${h.url('/images/icons/page_white.png')}"/></a> + <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download')}" class="tooltip" title="${h.tooltip(_('download diff'))}"><img class="icon" src="${h.url('/images/icons/page_white_get.png')}"/></a> ${c.ignorews_url(request.GET)} ${c.context_url(request.GET)} </div>
--- a/rhodecode/templates/changeset/changeset_file_comment.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/changeset/changeset_file_comment.html Fri Jun 08 21:54:50 2012 +0200 @@ -36,9 +36,12 @@ ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=changeset.raw_id),class_='inline-form')} <div class="clearfix"> <div class="comment-help">${_('Commenting on line {1}.')} - ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')), - '<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % - _('Use @username inside this text to send notification to this RhodeCode user')))|n} + ${(_('Comments parsed using %s syntax with %s support.') % ( + ('<a href="%s">RST</a>' % h.url('rst_help')), + ('<span style="color:#003367" class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')) + ) + )|n + } </div> <div class="mentions-container" id="mentions_container_{1}"></div> <textarea id="text_{1}" name="text" class="yui-ac-input"></textarea>
--- a/rhodecode/templates/changeset/changeset_range.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/changeset/changeset_range.html Fri Jun 08 21:54:50 2012 +0200 @@ -40,7 +40,7 @@ <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),14)}"/></div></td> <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td> <td><div class="author">${h.person(cs.author)}</div></td> - <td><span class="tooltip" title="${h.age(cs.date)}">${h.fmt_date(cs.date)}</span></td> + <td><span class="tooltip" title="${h.tooltip(h.age(cs.date))}">${h.fmt_date(cs.date)}</span></td> <td><div class="message">${h.urlify_commit(cs.message, c.repo_name)}</div></td> </tr> %endfor
--- a/rhodecode/templates/changeset/diff_block.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/changeset/diff_block.html Fri Jun 08 21:54:50 2012 +0200 @@ -16,9 +16,9 @@ revision=filenode.changeset.raw_id,f_path=h.safe_unicode(filenode.path)))} </div> <div class="diff-actions"> - <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff',fulldiff=1)}" title="${_('diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white_go.png')}"/></a> - <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw')}" title="${_('raw diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white.png')}"/></a> - <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download')}" title="${_('download diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white_get.png')}"/></a> + <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff',fulldiff=1)}" class="tooltip" title="${h.tooltip(_('diff'))}"><img class="icon" src="${h.url('/images/icons/page_white_go.png')}"/></a> + <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw')}" class="tooltip" title="${h.tooltip(_('raw diff'))}"><img class="icon" src="${h.url('/images/icons/page_white.png')}"/></a> + <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download')}" class="tooltip" title="${h.tooltip(_('download diff'))}"><img class="icon" src="${h.url('/images/icons/page_white_get.png')}"/></a> ${c.ignorews_url(request.GET, h.FID(filenode.changeset.raw_id,filenode.path))} ${c.context_url(request.GET, h.FID(filenode.changeset.raw_id,filenode.path))} </div>
--- a/rhodecode/templates/files/files_browser.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/files/files_browser.html Fri Jun 08 21:54:50 2012 +0200 @@ -88,14 +88,14 @@ </td> <td> %if node.is_file(): - <div class="tooltip" title="${node.last_changeset.message}"> + <div class="tooltip" title="${h.tooltip(node.last_changeset.message)}"> <pre>${'r%s:%s' % (node.last_changeset.revision,node.last_changeset.short_id)}</pre> </div> %endif </td> <td> %if node.is_file(): - <span class="tooltip" title="${h.fmt_date(node.last_changeset.date)}"> + <span class="tooltip" title="${h.tooltip(h.fmt_date(node.last_changeset.date))}"> ${h.age(node.last_changeset.date)}</span> %endif </td>
--- a/rhodecode/templates/files/files_source.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/files/files_source.html Fri Jun 08 21:54:50 2012 +0200 @@ -16,7 +16,7 @@ <div class="code-header"> <div class="stats"> <div class="left img"><img src="${h.url('/images/icons/file.png')}"/></div> - <div class="left item"><pre class="tooltip" title="${h.fmt_date(c.file.changeset.date)}">${h.link_to("r%s:%s" % (c.file.changeset.revision,h.short_id(c.file.changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id))}</pre></div> + <div class="left item"><pre class="tooltip" title="${h.tooltip(h.fmt_date(c.file.changeset.date))}">${h.link_to("r%s:%s" % (c.file.changeset.revision,h.short_id(c.file.changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id))}</pre></div> <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div> <div class="left item last"><pre>${c.file.mimetype}</pre></div> <div class="buttons">
--- a/rhodecode/templates/followers/followers_data.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/followers/followers_data.html Fri Jun 08 21:54:50 2012 +0200 @@ -10,7 +10,7 @@ </div> <div style="clear:both;padding-top: 10px"></div> <div class="follower_date">${_('Started following -')} - <span class="tooltip" title="${f.follows_from}"> ${h.age(f.follows_from)}</span></div> + <span class="tooltip" title="${h.tooltip(f.follows_from)}"> ${h.age(f.follows_from)}</span></div> <div style="border-bottom: 1px solid #DDD;margin:10px 0px 10px 0px"></div> </div> % endfor
--- a/rhodecode/templates/forks/forks_data.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/forks/forks_data.html Fri Jun 08 21:54:50 2012 +0200 @@ -15,7 +15,7 @@ </div> <div style="clear:both;padding-top: 10px"></div> <div class="follower_date">${_('forked')} - - <span class="tooltip" title="${f.created_on}"> ${h.age(f.created_on)}</span></div> + <span class="tooltip" title="${h.tooltip(h.fmt_date(f.created_on))}"> ${h.age(f.created_on)}</span></div> <div style="border-bottom: 1px solid #DDD;margin:10px 0px 10px 0px"></div> </div> % endfor
--- a/rhodecode/templates/index_base.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/index_base.html Fri Jun 08 21:54:50 2012 +0200 @@ -89,7 +89,7 @@ </td> ##LAST CHANGE DATE <td> - <span class="tooltip" title="${h.fmt_date(repo['last_change'])}">${h.age(repo['last_change'])}</span> + <span class="tooltip" title="${h.tooltip(h.fmt_date(repo['last_change']))}">${h.age(repo['last_change'])}</span> </td> ##LAST REVISION <td>
--- a/rhodecode/templates/journal/journal_data.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/journal/journal_data.html Fri Jun 08 21:54:50 2012 +0200 @@ -24,7 +24,7 @@ </span> </div> <div class="journal_action_params">${h.literal(h.action_parser(entry)[1]())}</div> - <div class="date"><span class="tooltip" title="${h.fmt_date(entry.action_date)}">${h.age(entry.action_date)}</span></div> + <div class="date"><span class="tooltip" title="${h.tooltip(h.fmt_date(entry.action_date))}">${h.age(entry.action_date)}</span></div> %endfor </div> </div>
--- a/rhodecode/templates/shortlog/shortlog_data.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/shortlog/shortlog_data.html Fri Jun 08 21:54:50 2012 +0200 @@ -19,7 +19,7 @@ h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id), title=cs.message)} </td> - <td><span class="tooltip" title="${h.fmt_date(cs.date)}"> + <td><span class="tooltip" title="${h.tooltip(h.fmt_date(cs.date))}"> ${h.age(cs.date)}</span> </td> <td title="${cs.author}">${h.person(cs.author)}</td>
--- a/rhodecode/templates/summary/summary.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/summary/summary.html Fri Jun 08 21:54:50 2012 +0200 @@ -166,7 +166,7 @@ <span id="${'zip_link'}">${h.link_to(_('Download as zip'), h.url('files_archive_home',repo_name=c.dbrepo.repo_name,fname='tip.zip'),class_="archive_icon ui-btn")}</span> <span style="vertical-align: bottom"> <input id="archive_subrepos" type="checkbox" name="subrepos" /> - <label for="archive_subrepos" class="tooltip" title="${_('Check this to download archive with subrepos')}" >${_('with subrepos')}</label> + <label for="archive_subrepos" class="tooltip" title="${h.tooltip(_('Check this to download archive with subrepos'))}" >${_('with subrepos')}</label> </span> %endif </div>
--- a/rhodecode/templates/tags/tags_data.html Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/templates/tags/tags_data.html Fri Jun 08 21:54:50 2012 +0200 @@ -18,7 +18,7 @@ </span> </span> </td> - <td><span class="tooltip" title="${h.age(tag[1].date)}">${h.fmt_date(tag[1].date)}</span></td> + <td><span class="tooltip" title="${h.tooltip(h.age(tag[1].date))}">${h.fmt_date(tag[1].date)}</span></td> <td title="${tag[1].author}">${h.person(tag[1].author)}</td> <td> <div>
--- a/rhodecode/tests/functional/test_home.py Fri Jun 08 02:50:47 2012 +0200 +++ b/rhodecode/tests/functional/test_home.py Fri Jun 08 21:54:50 2012 +0200 @@ -18,5 +18,7 @@ """open.png"/>""") response.mustcontain( -"""<a title="Marcin Kuzminski <marcin@python-works.com>:\n -merge" class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232dffcd24178a07ffeb5dfc">r173:27cd5cce30c9</a>""") +"""<a title="Marcin Kuzminski &lt;marcin@python-works.com&gt;:\n +merge" class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232""" +"""dffcd24178a07ffeb5dfc">r173:27cd5cce30c9</a>""" +)