Improved editor log and anime page headers are linkable

This commit is contained in:
2018-04-09 18:17:21 +02:00
parent 719c04f3d5
commit f3fd2d9619
13 changed files with 187 additions and 87 deletions

View File

@ -14,7 +14,7 @@ import (
const (
entriesFirstLoad = 120
entriesPerScroll = 30
entriesPerScroll = 40
)
// Get edit log.

View File

@ -11,61 +11,74 @@ component EditLogPage(entries []*arn.EditLogEntry, nextIndex int, viewUser *arn.
LoadMore(nextIndex)
component EditLog(entries []*arn.EditLogEntry, user *arn.User)
table.edit-log
thead
tr.mountable
th.text-center Action
th User
th Object
th Key
th Old
th New
th Date
tbody#load-more-target
EditLogScrollable(entries, user)
#load-more-target.edit-log
.edit-log-header.mountable
.edit-log-icon Action
.edit-log-user User
.edit-log-object Object
.edit-log-key Key
.edit-log-value Old
.edit-log-value New
.edit-log-date Date
EditLogScrollable(entries, user)
component EditLogScrollable(entries []*arn.EditLogEntry, user *arn.User)
each entry in entries
tr.mountable
td
.edit-log-icon(title=entry.Action)
if entry.Action == "create"
.edit-log-create
RawIcon("plus")
else if entry.Action == "delete"
.edit-log-delete
RawIcon("minus")
else if entry.Action == "edit" || entry.Action == "arrayAppend" || entry.Action == "arrayRemove"
.edit-log-change
RawIcon("pencil")
if entry.Action == "arrayAppend"
.edit-log-entry.mountable
.edit-log-icon(title=entry.Action)
if entry.Action == "create"
.edit-log-create
RawIcon("plus")
else if entry.Action == "delete"
.edit-log-delete
RawIcon("minus")
else if entry.Action == "edit" || entry.Action == "arrayAppend" || entry.Action == "arrayRemove"
.edit-log-change
RawIcon("pencil")
if entry.Action == "arrayAppend"
.edit-log-sub-icon.edit-log-add
RawIcon("plus-square")
else if entry.Action == "arrayRemove"
.edit-log-sub-icon.edit-log-remove
RawIcon("minus-square")
else
if entry.OldValue == "" && entry.NewValue != ""
.edit-log-sub-icon.edit-log-add
RawIcon("plus-square")
else if entry.Action == "arrayRemove"
RawIcon("plus-circle")
else if entry.OldValue != "" && entry.NewValue == ""
.edit-log-sub-icon.edit-log-remove
RawIcon("minus-square")
else
if entry.OldValue == "" && entry.NewValue != ""
.edit-log-sub-icon.edit-log-add
RawIcon("plus-circle")
else if entry.OldValue != "" && entry.NewValue == ""
.edit-log-sub-icon.edit-log-remove
RawIcon("minus-circle")
RawIcon("minus-circle")
td
.edit-log-user
Avatar(entry.User())
td.edit-log-object
if strings.HasPrefix(arn.GetObjectTitle(entry.ObjectType, entry.ObjectID), "<not found:")
.edit-log-user
a.edit-log-user-link(href=entry.User().Link(), title=entry.User().Nick)
AvatarNoLink(entry.User())
.edit-log-object
if arn.GetObjectTitle(entry.ObjectType, entry.ObjectID) == ""
.edit-log-empty empty
else if strings.HasPrefix(arn.GetObjectTitle(entry.ObjectType, entry.ObjectID), "<not found:")
span= arn.GetObjectTitle(entry.ObjectType, entry.ObjectID)
else
a(href="/" + strings.ToLower(entry.ObjectType) + "/" + entry.ObjectID, target="_blank")= arn.GetObjectTitle(entry.ObjectType, entry.ObjectID)
td.edit-log-key
a(href=arn.GetObjectLink(entry.ObjectType, entry.ObjectID), target="_blank")= arn.GetObjectTitle(entry.ObjectType, entry.ObjectID)
.edit-log-key
span= entry.ObjectType
if entry.Key != ""
span= "." + entry.Key
td.edit-log-value(title=entry.OldValue)= entry.OldValue
td.edit-log-value(title=entry.NewValue)= entry.NewValue
td.edit-log-date.utc-date(data-date=entry.Created)
.edit-log-value(title=entry.OldValue)
if entry.OldValue == ""
.edit-log-empty empty
else
span= entry.OldValue
.edit-log-value(title=entry.NewValue)
if entry.NewValue == ""
.edit-log-empty empty
else
span= entry.NewValue
.edit-log-date.utc-date(data-date=entry.Created)

View File

@ -1,8 +1,18 @@
.edit-log
max-width 1500px
display grid
grid-template-columns 100%
td
padding 0.25rem 0.5rem
.edit-log-entry
table-row
horizontal
.edit-log-header
horizontal
font-weight bold
.edit-log-entry,
.edit-log-header
padding 0.25rem 0
.edit-log-object,
.edit-log-key,
@ -10,23 +20,32 @@
white-space nowrap
.edit-log-user
horizontal
align-items center
flex-basis calc(avatar-size / 1.5 + 1rem)
.user-image
width calc(avatar-size / 2)
height calc(avatar-size / 2)
width calc(avatar-size / 1.5)
height calc(avatar-size / 1.5)
margin-right 0.5rem
.edit-log-object
max-width 150px
clip-long-text
.edit-log-user-link
horizontal
align-items center
.edit-log-object,
.edit-log-key,
.edit-log-value
max-width 150px
display flex
align-items center
flex 1 1 150px
clip-long-text
.edit-log-icon
display flex
justify-content center
align-items center
flex-basis 80px
.edit-log-sub-icon
//
@ -47,4 +66,21 @@
color hsl(214, 100%, 62%)
.edit-log-date
opacity 0.5
display flex
align-items center
opacity 0.5
flex-basis 120px
.edit-log-empty
opacity 0.25
pointer-events none
< 800px
.edit-log-header
display none
.edit-log-date
display none
.edit-log-user
flex 0 0 calc(avatar-size / 2)