From 860585e6b4fe8d80297c5f1a566746ddbb046a1b Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sun, 1 Sep 2013 08:58:59 -0700 Subject: Added hours, minutes, seconds calculation to training page --- src/templates/macros/hms.ftl | 13 +++++++++++++ src/templates/templates/training.ftl | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/templates/macros/hms.ftl (limited to 'src') 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 + + 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>
${video.title}
-

${video.title}

${video.length} +

${video.title}

<@hms seconds=video.length />
-- cgit v1.2.3