Commit 5eeef210 authored by Jorge Sá Pereira's avatar Jorge Sá Pereira
Browse files

[ENH] Improvements in Git details and SVN Up Info modules

- Display the date of the update (not the commit date)
- Display commit hash in short format
- Merge the modules layout to be similar to eachother
parent bcf9da17
Pipeline #578609188 passed with stages
in 8 minutes and 49 seconds
......@@ -255,6 +255,7 @@ class GitLib extends TikiLib
$info['parent'][] = $line[ 1 ];
}
}
$info['mdate'] = filemtime('.git/FETCH_HEAD');
return $info;
}
......
......@@ -9,5 +9,5 @@
function smarty_function_svn_lastup()
{
$svn = svn_last_update();
return isset($svn['lastup']) ? $svn['lastup'] : null;
return $svn['wcdb_mtime'] ?? null;
}
......@@ -14,8 +14,8 @@
function module_git_detail_info()
{
return [
'name' => tra('GIT detail'),
'description' => tra('GIT commit and last update information.'),
'name' => tra('Git detail'),
'description' => tra('Git commit and last update information.'),
'params' => [],
];
}
......@@ -29,7 +29,9 @@ function module_git_detail_info()
*/
function module_git_detail($mod_reference, $module_params)
{
/** @var Smarty_Tiki $smarty */
$smarty = TikiLib::lib('smarty');
/** @var GitLib $gitlib */
$gitlib = TikiLib::lib('git');
$error = '';
$content = [];
......
{tikimodule
decorations="{$module_params.decorations}"
error="{$error}"
flip="{$module_params.flip}"
nobox="{$module_params.nobox}"
nonums="{$module_params.nonums}"
notitle="{$module_params.notitle}"
overflow="{$module_params.overflow}"
title="{$module_params.title}"
style="{$module_params.style}"
}
decorations="{$module_params.decorations}"
error="{$error}"
flip="{$module_params.flip}"
nobox="{$module_params.nobox}"
nonums="{$module_params.nonums}"
notitle="{$module_params.notitle}"
overflow="{$module_params.overflow}"
title=$tpl_module_title
style="{$module_params.style}"
}
{if empty($error)}
<div class="mod-git_detail">
<p>
<span class="label">{tr}Last updated{/tr}</span>
<span class="branch">(GIT {$content.branch}:{$content.commit.hash|substring:0:5}):</span>
<span class="date">{$content.author.date|tiki_long_datetime}</span>
</p>
</div>
<div class="mod-git_detail cvsup">
<span class="label">{tr}Last updated{/tr}</span>&nbsp;
<span class="branch">(Git {$content.branch}:{$content.commit.hash|substring:0:8}):</span>&nbsp;
<span class="date">{$content.mdate|tiki_long_datetime}</span>
</div>
{else}
{tr}No Git checkout or unable to determine last update{/tr}
{/if}
{/tikimodule}
{* $Id$ *}
{strip}
{tikimodule error=$module_params.error title=$tpl_module_title name=$tpl_module_name flip=$module_params.flip decorations=$module_params.decorations nobox=$module_params.nobox notitle=$module_params.notitle}
{tikimodule error=$module_params.error title=$tpl_module_title name=$tpl_module_name flip=$module_params.flip decorations=$module_params.decorations nobox=$module_params.nobox notitle=$module_params.notitle}
{capture assign="lastup"}{svn_lastup}{/capture}
{capture assign="svnrev"}{svn_rev}{/capture}
{if !empty($lastup)}
<div class="cvsup">{tr}Last update from SVN{/tr} ({$tiki_version}): {$lastup|tiki_long_datetime}
{if !empty($svnrev)}
- REV {$svnrev}
{/if}
<div class="mod-svnup cvsup">
<span class="label">{tr}Last updated{/tr}</span>&nbsp;
<span class="branch">(SVN {$tiki_version}{if !empty($svnrev)}:{$svnrev}{/if}):</span>&nbsp;
<span class="date">{$lastup|tiki_long_datetime}</span>
</div>
{else}
{tr}No Subversion checkout or unable to determine last update{/tr}
{/if}
{/tikimodule}
{/tikimodule}
{/strip}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment