Skip to content

Commit

Permalink
fix(system-info): Revised display of custom version
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeier76 committed Sep 15, 2023
1 parent ea6ea00 commit aca9fc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 11 additions & 3 deletions Products/zms/zms.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def zms_version(self, custom=False):
file.close()
zms_custom_version = os.environ.get('ZMS_CUSTOM_VERSION', '')
if custom and zms_custom_version != '':
rtn += f'<samp>({zms_custom_version})</samp>'
rtn += f'&nbsp;(<samp id="zms_custom_version">{zms_custom_version}</samp>)'
# container built by unibe-cms/build.sh gathering commit hashes of git submodules
revisions1 = _fileutil.getOSPath('/app/zms-core/revisions.txt')
revisions2 = _fileutil.getOSPath('/opt/zope/src/zms/revisions.txt') # fallback for unibe-cms-deployments
Expand All @@ -388,13 +388,21 @@ def zms_version(self, custom=False):
</span>
<script>
$(function () {{
$('[data-toggle="popover"]').popover()
$('[data-toggle="popover"]').popover();
// CAVEAT: Slicing below relies on commit hashes at https://github.com/idasm-unibe-ch/unibe-cms/tree/...
const zms_custom_version = $('#zms_custom_version').text().replaceAll('(', '').replaceAll(')', '');
const github_link = zms_custom_version.substr(zms_custom_version.indexOf('https://github.com'), zms_custom_version.length);
const version_str = zms_custom_version.substr(0, zms_custom_version.indexOf('https://github.com')).trim();
if (github_link.indexOf('https://github.com') == 0) {{
$('#zms_custom_version').html('<a href="'+github_link+'" title="'+github_link.slice(0, 58)+'" target="_blank">'+version_str+'</a>');
}}
}})
</script>
<style>
.popover-body {{
white-space: break-spaces;
width: max-content;
width: auto;
font-size: smaller;
}}
</style>
"""
Expand Down
5 changes: 1 addition & 4 deletions Products/zms/zpt/ZMS/manage_customize.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,7 @@
<div class="form-group row">
<label class="col-sm-2 control-label">ZMS Version</label>
<div class="col-sm-10">
<a title="ZMS commits on github.com" target="_blank"
href="https://github.com/zms-publishing/ZMS/commits/main">
<samp tal:content="structure python:here.zms_version(custom=True)">zms_version</samp>
</a>
<samp tal:content="structure python:here.zms_version(custom=True)">zms_version</samp>
</div>
</div><!-- .form-group -->
<div class="form-group row">
Expand Down

0 comments on commit aca9fc0

Please sign in to comment.