From d0f06320f199720a4323eb3a0562b1253b7ef36f Mon Sep 17 00:00:00 2001 From: Dashie Date: Tue, 5 Feb 2019 13:11:09 +0100 Subject: [PATCH] Show edit time if edited, add expiry on nice columns --- TODO.org | 1 - conf/locale/locale_en-US.ini | 3 ++- conf/locale/locale_fr-FR.ini | 1 + routers/gitxt/gitxt.go | 2 ++ templates/gitxt/view.tmpl | 12 +++--------- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/TODO.org b/TODO.org index c5f9c18..7d088a2 100644 --- a/TODO.org +++ b/TODO.org @@ -6,7 +6,6 @@ ** TODO xorm update, breaking changes *** migrate to gorm ? -** TODO Add edit time on view gist ** TODO Add line-break option ** TODO Add more checks for fields wrongly used, like issue with non existant file ** TODO Add pictures from git with zz_.png; Edit web interface, and add file; wrong duplicate !! diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index 4898116..640908b 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -93,8 +93,9 @@ show_uploads_for = "Show uploads for %s" show_all_uploads = "Show all uploads" edit = "Edit" delete = "Delete" -expiry_on = "Expiry on:" +expiry_on = "Expires on:" created_on = "Created on:" +updated_on = "Updated on:" raw_file = "raw file" file_too_big = "File is too big and can't be displayed." over_page_size = "Page size limit exceeded and file won't me displayed." diff --git a/conf/locale/locale_fr-FR.ini b/conf/locale/locale_fr-FR.ini index c267ff0..ce1b0c3 100644 --- a/conf/locale/locale_fr-FR.ini +++ b/conf/locale/locale_fr-FR.ini @@ -95,6 +95,7 @@ edit = "Editer" delete = "Supprimer" expiry_on = "Expire le:" created_on = "Crée le:" +updated_on = "Mis-à-jour le:" raw_file = "fichier brut" file_too_big = "Le fichier trop gros et ne peut être affiché." over_page_size = "Limite de taille pour la page atteinte et le fichier ne sera pas affiché." diff --git a/routers/gitxt/gitxt.go b/routers/gitxt/gitxt.go index f9952ad..bcb3a56 100644 --- a/routers/gitxt/gitxt.go +++ b/routers/gitxt/gitxt.go @@ -260,6 +260,8 @@ func View(ctx *context.Context) { ctx.Data["expiry"] = ctx.Gitxt.Gitxt.ExpiryHours ctx.Data["expiryOn"] = ctx.Gitxt.Gitxt.Expiry ctx.Data["createdOn"] = ctx.Gitxt.Gitxt.Created + ctx.Data["updated"] = (ctx.Gitxt.Gitxt.UpdatedUnix > ctx.Gitxt.Gitxt.CreatedUnix) + ctx.Data["updatedOn"] = ctx.Gitxt.Gitxt.Updated // Get the files from git var repoSpec = "HEAD" diff --git a/templates/gitxt/view.tmpl b/templates/gitxt/view.tmpl index 6ee35c9..c1dc839 100644 --- a/templates/gitxt/view.tmpl +++ b/templates/gitxt/view.tmpl @@ -37,15 +37,9 @@
-
- {{.i18n.Tr "gitxt_view.created_on"}} - {{if .expiry}} - {{if eq .expiry 0}} - {{else}} -       {{.i18n.Tr "gitxt_view.expiry_on"}} - {{end}} - {{end}} -
+
{{.i18n.Tr "gitxt_view.created_on"}}
+
{{if .updated}}{{.i18n.Tr "gitxt_view.updated_on"}} {{end}}
+
{{if .expiry}}{{if eq .expiry 0}}{{else}}{{.i18n.Tr "gitxt_view.expiry_on"}} {{end}}{{end}}