Commits

Marcin Kuzminski committed 04d3fae

imported patch 2260

  • Participants
  • Parent commits e8c0168

Comments (0)

Files changed (3)

File docs/changelog.rst

 - 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**)
 ----------------------

File rhodecode/lib/helpers.py

 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
             session.save()
     return session[token_key]
 
+
 class _GetError(object):
     """Get error from form_errors, and represent it as span wrapped error
     message
 
 get_error = _GetError()
 
+
 class _ToolTip(object):
 
     def __call__(self, tooltip_title, trim_at=50):
         return escape(tooltip_title)
 tooltip = _ToolTip()
 
+
 class _FilesBreadCrumbs(object):
 
     def __call__(self, repo_name, rev, paths):
 
 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):

File rhodecode/templates/changelog/changelog.html

 									%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>