changeset 2162:04d3fae0e4c0 beta

imported patch 2260
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 24 Mar 2012 13:11:54 +0200
parents e8c016815ab9
children e77fbd3b069c
files docs/changelog.rst rhodecode/lib/helpers.py rhodecode/templates/changelog/changelog.html
diffstat 3 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/docs/changelog.rst	Fri Mar 23 23:52:12 2012 +0200
+++ b/docs/changelog.rst	Sat Mar 24 13:11:54 2012 +0200
@@ -45,6 +45,7 @@
 - fixed #396 fixed problems with revoking users in nested groups
 - fixed mysql unicode issues + specified InnoDB as default engine with 
   utf8 charset
+- #406 trim long branch/tag names in changelog to not break UI
   
 1.3.3 (**2012-03-02**)
 ----------------------
--- a/rhodecode/lib/helpers.py	Fri Mar 23 23:52:12 2012 +0200
+++ b/rhodecode/lib/helpers.py	Sat Mar 24 13:11:54 2012 +0200
@@ -46,6 +46,13 @@
 log = logging.getLogger(__name__)
 
 
+def shorter(text, size=20):
+    postfix = '...'
+    if len(text) > size:
+        return text[:size - len(postfix)] + postfix
+    return text
+
+
 def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
     """
     Reset button
@@ -87,6 +94,7 @@
             session.save()
     return session[token_key]
 
+
 class _GetError(object):
     """Get error from form_errors, and represent it as span wrapped error
     message
@@ -102,6 +110,7 @@
 
 get_error = _GetError()
 
+
 class _ToolTip(object):
 
     def __call__(self, tooltip_title, trim_at=50):
@@ -113,6 +122,7 @@
         return escape(tooltip_title)
 tooltip = _ToolTip()
 
+
 class _FilesBreadCrumbs(object):
 
     def __call__(self, repo_name, rev, paths):
@@ -137,8 +147,10 @@
 
 files_breadcrumbs = _FilesBreadCrumbs()
 
+
 class CodeHtmlFormatter(HtmlFormatter):
-    """My code Html Formatter for source codes
+    """
+    My code Html Formatter for source codes
     """
 
     def wrap(self, source, outfile):
--- a/rhodecode/templates/changelog/changelog.html	Fri Mar 23 23:52:12 2012 +0200
+++ b/rhodecode/templates/changelog/changelog.html	Sat Mar 24 13:11:54 2012 +0200
@@ -93,11 +93,11 @@
 									%endif
 									%if h.is_hg(c.rhodecode_repo) and cs.branch:
 									<span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
-									   ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
+									   ${h.link_to(h.shorter(cs.branch),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
 									%endif
 									%for tag in cs.tags:
 										<span class="tagtag"  title="${'%s %s' % (_('tag'),tag)}">
-										${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
+										${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
 									%endfor
 								</span>
 						</div>