# HG changeset patch # User Marcin Kuzminski # Date 2019-10-10 11:43:44 # Node ID fec9ef703d4b7b45f5abf28647da1f2edb91943e # Parent 9eaff08c7fa4fc4864870aad0f42fc1e96ee4287 artifacts: added changes for new grid to display artifacts. diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -150,10 +150,14 @@ def chop_at_smart(s, sub, inclusive=Fals return chopped -def shorter(text, size=20): +def shorter(text, size=20, prefix=False): postfix = '...' if len(text) > size: - return text[:size - len(postfix)] + postfix + if prefix: + # shorten in front + return postfix + text[-(size - len(postfix)):] + else: + return text[:size - len(postfix)] + postfix return text diff --git a/rhodecode/templates/data_table/_dt_elements.mako b/rhodecode/templates/data_table/_dt_elements.mako --- a/rhodecode/templates/data_table/_dt_elements.mako +++ b/rhodecode/templates/data_table/_dt_elements.mako @@ -381,9 +381,14 @@ ## ARTIFACT RENDERERS +<%def name="repo_artifact_name(repo_name, file_uid, artifact_display_name)"> + + ${artifact_display_name or 'EMPTY NAME'} + + <%def name="repo_artifact_uid(repo_name, file_uid)"> - ${file_uid} + ${h.shorter(file_uid, size=12, prefix=True)} <%def name="repo_artifact_uid_action(repo_name, file_uid)">