From ef7fe29fab05ad4523d5eb29bbf82fe1e47e2aef Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 9 Mar 2018 19:53:21 +0100 Subject: [PATCH] Improved edit log --- pages/editlog/editlog.pixy | 25 +++++++++++++++++++------ pages/editlog/editlog.scarlet | 33 +++++++++++++++++++++++++++++++++ tests.go | 1 + 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 pages/editlog/editlog.scarlet diff --git a/pages/editlog/editlog.pixy b/pages/editlog/editlog.pixy index 2b772f53..11f1ef30 100644 --- a/pages/editlog/editlog.pixy +++ b/pages/editlog/editlog.pixy @@ -1,23 +1,36 @@ component EditLog(entries []*arn.EditLogEntry, user *arn.User) h1 Editor log - table + table.edit-log thead tr.mountable - th ID + th.text-center Icon th User th Object + th Key th Old th New th Date tbody each entry in entries tr.mountable - td= entry.ID td - a(href=entry.User().Link(), target="_blank", rel="noopener")= entry.User().Nick + .edit-log-icon + if entry.OldValue == "" && entry.NewValue != "" + .edit-log-add + RawIcon("plus") + else if entry.OldValue != "" && entry.NewValue == "" + .edit-log-remove + RawIcon("minus") + else + .edit-log-change + RawIcon("pencil") td - a(href="/" + strings.ToLower(entry.ObjectType) + "/" + entry.ObjectID, target="_blank")= entry.ObjectType + " " + entry.ObjectID + .edit-log-user + Avatar(entry.User()) + td.edit-log-object + a(href="/" + strings.ToLower(entry.ObjectType) + "/" + entry.ObjectID, target="_blank")= arn.GetObjectTitle(entry.ObjectType, entry.ObjectID) + td.edit-log-key= entry.Key td= entry.OldValue td= entry.NewValue - td.utc-date(data-date=entry.Created) \ No newline at end of file + td.edit-log-date.utc-date(data-date=entry.Created) \ No newline at end of file diff --git a/pages/editlog/editlog.scarlet b/pages/editlog/editlog.scarlet new file mode 100644 index 00000000..b9d3101b --- /dev/null +++ b/pages/editlog/editlog.scarlet @@ -0,0 +1,33 @@ +.edit-log + max-width 1500px + + td + padding 0.25rem 0.5rem + +.edit-log-object, +.edit-log-key, +.edit-log-date + white-space nowrap + +.edit-log-user + .user-image + width calc(avatar-size / 2) + height calc(avatar-size / 2) + margin-right 0.5rem + +.edit-log-icon + display flex + justify-content center + align-items center + +.edit-log-add + color green + +.edit-log-remove + color red + +.edit-log-change + color main-color + +.edit-log-date + opacity 0.5 \ No newline at end of file diff --git a/tests.go b/tests.go index f856af25..3b1e4dde 100644 --- a/tests.go +++ b/tests.go @@ -297,6 +297,7 @@ var routeTests = map[string][]string{ "/shop/history": nil, "/support": nil, "/charge": nil, + "/log": nil, "/inventory": nil, "/extension/embed": nil, }