Ghost/ghost/admin/app/components/posts-list/list-item-clicks.hbs
James Morris 729935eca7 Tidied up the page a bit more with the source attribution included
- Has the source attribution chart and table with some basic styles
- Added in a edit button to the analytics page

refs https://github.com/TryGhost/Team/issues/1920
2022-09-22 17:20:15 +01:00

204 lines
10 KiB
Handlebars
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{!-- template-lint-disable no-invalid-interactive --}}
<li class="gh-list-row gh-posts-list-item gh-posts-list-item-labs gh-post-list-plain-status"
{{on "mouseover" this.mouseOver}}
{{on "mouseleave" this.mouseLeave}}
...attributes
>
{{!-- Title column --}}
{{#if (and this.session.user.isContributor @post.isPublished)}}
<a href={{@post.url}} class="permalink gh-list-data gh-post-list-title" target="_blank" rel="noopener noreferrer">
<h3 class="gh-content-entry-title">
{{@post.title}} {{svg-jar "external" class="gh-post-list-external"}}
</h3>
{{#unless @hideAuthor }}
<p class="gh-content-entry-meta">
<span class="gh-content-entry-author">
By {{post-author-names @post}}
{{#if @post.primaryTag}}
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
{{/if}}
-
</span>
<span class="gh-content-entry-date">
{{#if this.isHovered}}
{{gh-format-post-time @post.updatedAtUTC format="D MMM YYYY"}}
{{else}}
{{gh-format-post-time @post.updatedAtUTC draft=true}}
{{/if}}
</span>
</p>
<p class="gh-content-entry-status">
<span class="published">
Published
{{#if @post.hasEmail}}
{{#if this.isHovered}}
and sent to {{gh-pluralize @post.email.emailCount "member"}}
{{else}}
and sent
{{/if}}
{{/if}}
</span>
</p>
{{/unless}}
</a>
{{else}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-title">
<h3 class="gh-content-entry-title">
{{@post.title}}
{{#if @post.lexical}}
<span class="gh-lexical-indicator">L</span>
{{/if}}
</h3>
{{#unless @hideAuthor }}
<p class="gh-content-entry-meta">
<span class="gh-content-entry-author">
By {{post-author-names @post}}
{{#if @post.primaryTag}}
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
{{/if}}
-
</span>
<span class="gh-content-entry-date" {{on "mouseover" (fn (mut this.isDateHovered) true)}} {{on "mouseleave" (fn (mut this.isDateHovered) false)}}>
{{gh-format-post-time @post.updatedAtUTC draft=true}}
{{#if this.isDateHovered}}
<span {{css-transition "anim-fade-in-scale"}}>on {{gh-format-post-time @post.updatedAtUTC format="D MMM YYYY"}}</span>
{{/if}}
</span>
{{!-- {{#if @post.lexical}}
<span class="gh-content-entry-date"> Lexical</span>
{{/if}} --}}
</p>
{{#if (not-eq this.settings.membersSignupAccess "none")}}
<p class="gh-content-entry-status">
{{#if @post.isScheduled}}
<span class="scheduled" {{on "mouseover" (fn (mut this.isStateHovered) true)}} {{on "mouseleave" (fn (mut this.isStateHovered) false)}}>
<span class="status-dot"></span>
Scheduled
{{#if this.isStateHovered}}
<span class="schedule-details" {{css-transition "anim-fade-in-scale"}}>to be published {{if @post.newsletter "and sent "}}{{this.scheduledText}} to {{humanize-recipient-filter @post.emailSegment}}</span>
{{/if}}
</span>
{{/if}}
{{#if @post.isDraft}}
<span class="draft">
<span class="status-dot"></span>
Draft
</span>
{{/if}}
{{#if @post.isPublished}}
<span class="published" {{on "mouseover" (fn (mut this.isStateHovered) true)}} {{on "mouseleave" (fn (mut this.isStateHovered) false)}}>
Published
{{#if @post.hasEmail}}
and sent
{{#if this.isStateHovered}}
<span {{css-transition "anim-fade-in-scale"}}>to {{gh-pluralize @post.email.emailCount "member"}}</span>
{{/if}}
{{/if}}
</span>
{{/if}}
{{#if @post.isSent}}
<span class="sent" {{on "mouseover" (fn (mut this.isStateHovered) true)}} {{on "mouseleave" (fn (mut this.isStateHovered) false)}}>
Sent
{{#if this.isStateHovered}}
<span {{css-transition "anim-fade-in-scale"}}>to {{gh-pluralize @post.email.emailCount "member"}}</span>
{{/if}}
</span>
{{/if}}
</p>
{{/if}}
{{/unless}}
</LinkTo>
{{/if}}
{{!-- Opens and clicks columns --}}
{{#if (and @post.email (not-eq this.settings.membersSignupAccess "none") (not-eq this.settings.editorDefaultEmailRecipients "disabled") (not this.session.user.isContributor) (or @post.isSent @post.isPublished) this.settings.emailTrackOpens @post.email.trackOpens this.feature.emailAnalytics (eq @post.displayName "post"))}}
{{!-- Opens column --}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-opens">
<div class="flex flex-column items-end" {{on "mouseover" (fn (mut this.isOpenStatHovered) true)}} {{on "mouseleave" (fn (mut this.isOpenStatHovered) false)}}>
<span class="gh-content-email-stats">
{{#if this.isOpenStatHovered}}
<strong>{{format-number @post.email.openedCount}}</strong> opens
{{else}}
<strong>{{@post.email.openRate}}%</strong> opens
{{/if}}
</span>
</div>
</LinkTo>
{{else}}
<div class="gh-list-data"></div>
{{/if}}
{{#if (and @post.email (not-eq this.settings.membersSignupAccess "none") (not-eq this.settings.editorDefaultEmailRecipients "disabled") (not this.session.user.isContributor) (or @post.isSent @post.isPublished) this.settings.emailTrackClicks this.feature.emailAnalytics)}}
{{!-- Clicks column --}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-clicks">
<div class="flex flex-column items-end" {{on "mouseover" (fn (mut this.isClickStatHovered) true)}} {{on "mouseleave" (fn (mut this.isClickStatHovered) false)}}>
<span class="gh-content-email-stats">
{{#if this.isClickStatHovered}}
<strong>{{format-number @post.count.clicks}}</strong> clicks
{{else}}
<strong>{{@post.clickRate}}%</strong> clicks
{{/if}}
</span>
</div>
</LinkTo>
{{else}}
<div class="gh-list-data"></div>
{{/if}}
{{!-- Button column --}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data {{if (not-eq this.settings.membersSignupAccess "none") "gh-post-list-button"}}">
{{#if (not-eq this.settings.membersSignupAccess "none")}}
<div class="flex flex-column items-end">
{{#if (and (not this.session.user.isContributor) (or @post.isSent @post.isPublished) (or this.settings.emailTrackClicks (feature "memberAttribution")))}}
<LinkTo @route="posts.analytics" @model={{@post}} class="gh-post-list-cta stats {{if this.isHovered "is-hovered"}}" title="View post analytics">
{{svg-jar "stats" title="View post analytics"}}
</LinkTo>
{{else}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="gh-post-list-cta edit {{if this.isHovered "is-hovered"}}" title="Edit this post">
{{svg-jar "pen" title="Edit this post"}}
</LinkTo>
{{/if}}
</div>
{{else}}
<p class="gh-content-entry-status">
{{#if @post.isScheduled}}
<span class="scheduled" data-tooltip="Published {{this.scheduledText}}">
<span class="status-dot"></span>
Scheduled
</span>
{{/if}}
{{#if @post.isDraft}}
<span class="draft">
<span class="status-dot"></span>
Draft
</span>
{{/if}}
{{#if @post.isPublished}}
<span class="published">
Published
{{#if @post.hasEmail}}
and sent
{{/if}}
</span>
{{/if}}
{{#if @post.isSent}}
<span class="sent">
Sent
</span>
{{/if}}
</p>
{{/if}}
</LinkTo>
</li>