diff options
| -rw-r--r-- | src/templates/macros/hms.ftl | 13 | ||||
| -rw-r--r-- | src/templates/templates/training.ftl | 3 | 
2 files changed, 15 insertions, 1 deletions
| diff --git a/src/templates/macros/hms.ftl b/src/templates/macros/hms.ftl new file mode 100644 index 0000000..f9662af --- /dev/null +++ b/src/templates/macros/hms.ftl @@ -0,0 +1,13 @@ +<#macro hms seconds> +    <#assign h = (seconds / 3600)?int /> +    <#assign m = (seconds % 3600 / 60)?int /> +    <#assign s = (seconds % 3600 % 60)?int /> + +    <#if (seconds >= 3600)> +        ${h}:${m}:${s} +    <#elseif (seconds >= 60)> +        ${m}:${s} +    <#else> +        ${s} seconds +    </#if> +</#macro> diff --git a/src/templates/templates/training.ftl b/src/templates/templates/training.ftl index 0490a9a..a6d30ea 100644 --- a/src/templates/templates/training.ftl +++ b/src/templates/templates/training.ftl @@ -1,5 +1,6 @@  <#include "/macros/common.ftl">  <#include "/macros/common-page.ftl"> +<#include "/macros/hms.ftl">  <@commonpage>      <@noticebox> @@ -37,7 +38,7 @@          <#list videos as video>              <article>                  <div class="image <#if video.completed>completed</#if>" id="${video.id}"><a href="#" onclick="playVideo('${video.id}'); return false"><img src="${video.image!staticRoot+"/images/videoimage.jpg"}" alt="${video.title}" /></a></div> -                <h2>${video.title}</h2> <span class="duration">${video.length}</span>  +                <h2>${video.title}</h2> <span class="duration"><@hms seconds=video.length /></span>               </article>          </#list>          </div> | 
