mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 06:25:51 +03:00
874c696893
refs https://github.com/TryGhost/Toolbox/issues/356 - if an actor has been deleted, their icon would just be blank - we want to show the default user icon - to accommodate this, and to improve some code along the way, I've also added `include=actor` to the API request so we get the actor inline in the response instead of sending off another request - I should really switch to using models + the store at some point to cleanup parsing all the API responses manually
64 lines
3.1 KiB
Handlebars
64 lines
3.1 KiB
Handlebars
<table class="gh-list gh-audit-log-table">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{#each @events as |event|}}
|
|
{{#let (parse-audit-log-event event) as |ev|}}
|
|
<tr>
|
|
<div class="gh-list-data">
|
|
<div class="gh-audit-log-object flex items-center ma3">
|
|
<span class="user-list-item-figure" style={{background-image-style ev.actorIcon}}>
|
|
{{#if ev.actor.name}}
|
|
<span class="hidden">Photo of {{ev.actor.name}}</span>
|
|
{{/if}}
|
|
<div class="gh-audit-log-icon">{{svg-jar ev.actionIcon}}</div>
|
|
</span>
|
|
{{!-- --}}
|
|
<div>
|
|
<div class="gh-audit-log-description">
|
|
<span>
|
|
{{capitalize-first-letter ev.action}}:
|
|
</span>
|
|
{{#if ev.contextResource}}
|
|
<span>
|
|
<span>{{capitalize-first-letter ev.contextResource.first}}</span>
|
|
{{#if (not (eq ev.contextResource.first ev.contextResource.second))}}
|
|
<code>({{ev.contextResource.second}})</code>
|
|
{{/if}}
|
|
</span>
|
|
{{else if (or ev.original.resource.title ev.original.resource.name ev.original.context.primary_name)}}
|
|
{{#if ev.linkTarget}}
|
|
<LinkTo @route={{ev.linkTarget.route}} @models={{ev.linkTarget.models}} class="permalink fw6">
|
|
{{or ev.original.resource.title ev.original.resource.name}}
|
|
</LinkTo>
|
|
{{else}}
|
|
<span>{{or ev.original.resource.title ev.original.resource.name ev.original.context.primary_name}}</span>
|
|
{{/if}}
|
|
{{else}}
|
|
<span class="midlightgrey">(unknown)</span>
|
|
{{/if}}
|
|
|
|
<span class="gh-audit-log-name">
|
|
<span class="midgrey">– by </span>
|
|
{{#if ev.actorLinkTarget}}
|
|
<LinkTo @route={{ev.actorLinkTarget.route}} @models={{ev.actorLinkTarget.models}}>
|
|
{{ev.actor.name}}
|
|
</LinkTo>
|
|
{{else}}
|
|
(deleted user)
|
|
{{/if}}
|
|
</span>
|
|
</div>
|
|
<div class="gh-audit-log-datetime">{{moment-format ev.original.created_at "DD MMM YYYY HH:mm:ss"}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</tr>
|
|
{{/let}}
|
|
{{/each}}
|
|
</tbody>
|
|
</table>
|