Ghost/ghost/admin/app/components/posts-list/list-item.hbs

226 lines
12 KiB
Handlebars

{{!-- template-lint-disable no-invalid-interactive --}}
<li class="gh-list-row gh-posts-list-item {{if this.feature.memberAttribution "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>
<span class="gh-content-entry-meta">
By <span class="midgrey-l2 fw5">{{post-author-names @post}}</span>
{{#if @post.primaryTag}}
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
{{/if}}
• <span data-tooltip="{{gh-format-post-time @post.updatedAtUTC "D MMM YYYY"}}">{{gh-format-post-time @post.updatedAtUTC draft=true}}</span>
</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}}
</h3>
{{#unless @hideAuthor }}
<p>
<span class="gh-content-entry-meta">
By <span class="midgrey-l2 fw5">{{post-author-names @post}}</span>
{{#if @post.primaryTag}}
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
{{/if}}
• <span data-tooltip="{{gh-format-post-time @post.updatedAtUTC "D MMM YYYY"}}">{{gh-format-post-time @post.updatedAtUTC draft=true}}</span>
</span>
</p>
{{/unless}}
</LinkTo>
{{/if}}
{{!-- Statuses for when the feature flag for Member Attribution is on only --}}
{{#if this.feature.memberAttribution}}
{{#unless @hideStatusColumn }}
{{#if (and this.session.user.isContributor @post.isPublished)}}
<a href={{@post.url}} class="permalink gh-list-data gh-post-list-status" target="_blank" rel="noopener noreferrer">
<div class="flex items-center">
<span class="gh-content-status-published nowrap">
{{svg-jar "check" class="gh-post-status-icon"}}
Published
{{#if @post.hasEmail}}
&amp; Sent
{{/if}}
</span>
</div>
</a>
{{else}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-status">
<div class="flex items-center">
{{#if @post.isScheduled}}
<span class="gh-content-status-scheduled gh-badge nowrap" title="Scheduled" data-tooltip="To be published {{if @post.newsletter "& sent at "}}{{capitalize this.scheduledText}} to {{@post.emailSegment}} members">
{{svg-jar "clock" class="gh-post-status-icon"}}
Scheduled
</span>
{{/if}}
{{#if @post.isDraft}}
<span class="gh-content-status-draft gh-badge gh-badge-pink nowrap">
{{svg-jar "pen" class="gh-post-status-icon"}}
Draft
</span>
{{/if}}
{{#if @post.isPublished}}
<span class="gh-content-status-published nowrap">
{{svg-jar "check" class="gh-post-status-icon"}}
Published
{{#if @post.hasEmail}}
&amp; Sent
{{/if}}
</span>
{{/if}}
{{#if @post.isSent}}
<span class="gh-content-status-emailed nowrap">
{{svg-jar "email-stroke" class="gh-post-status-icon"}}
Sent
</span>
{{/if}}
</div>
</LinkTo>
{{/if}}
{{/unless}}
{{/if}}
{{#if (and this.feature.memberAttribution (not this.session.user.isContributor)) }}
{{#if @post.count.signups}}
<LinkTo @route="members" @query={{hash filterParam=(concat "signup:[" @post.id "]") }} class="permalink gh-list-data gh-post-list-signups active">
<span class="midlightgrey {{if (not (eq @post.count.signups 0)) 'darkgrey'}} fw5 gh-content-attribution-stats">{{@post.count.signups}}</span>
<span class="midgrey-l2 fw4 gh-content-attribution-stats-mobile">{{gh-pluralize @post.count.signups "signup"}}</span>
</LinkTo>
{{else}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-signups">
<span class="midlightgrey {{if (not (eq @post.count.signups 0)) 'darkgrey'}} fw5 gh-content-attribution-stats">{{@post.count.signups}}</span>
<span class="midgrey-l2 fw4 gh-content-attribution-stats-mobile">{{gh-pluralize @post.count.signups "signup"}}</span>
</LinkTo>
{{/if}}
{{/if}}
{{#if (and this.feature.memberAttribution (not this.session.user.isContributor)) }}
{{#if @post.count.conversions}}
<LinkTo @route="members" @query={{hash filterParam=(concat "conversion:[" @post.id "]") }} class="permalink gh-list-data gh-post-list-conversions active">
<span class="midlightgrey {{if (not (eq @post.count.conversions 0)) 'darkgrey'}} fw5 gh-content-attribution-stats">{{@post.count.conversions}}</span>
<span class="midgrey-l2 fw4 gh-content-attribution-stats-mobile">{{gh-pluralize @post.count.conversions "conversion"}}</span>
</LinkTo>
{{else}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-conversions">
<span class="midlightgrey {{if (not (eq @post.count.conversions 0)) 'darkgrey'}} fw5 gh-content-attribution-stats">{{@post.count.conversions}}</span>
<span class="midgrey-l2 fw4 gh-content-attribution-stats-mobile">{{gh-pluralize @post.count.conversions "conversion"}}</span>
</LinkTo>
{{/if}}
{{/if}}
{{!-- Sends/Opens columns --}}
{{#if (and (not-eq this.settings.membersSignupAccess "none") (not-eq this.settings.editorDefaultEmailRecipients "disabled") (not this.session.user.isContributor))}}
{{#if (and this.feature.emailAnalytics (eq @post.displayName "post"))}}
{{!-- Sends column --}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-recipients">
<div class="flex fw4">
{{#if (eq @post.email.status "submitted")}}
<span class="flex" data-tooltip={{humanize-recipient-filter @post.email.recipientFilter}}>
<span class="darkgrey fw5 gh-content-email-stats">{{format-number @post.email.emailCount}}</span>
<span class="midgrey-l2 fw4 gh-content-email-stats-mobile">{{gh-pluralize @post.email.emailCount "send"}}</span>
</span>
{{else}}
<span class="gh-list-nodata">&mdash;</span>
{{/if}}
</div>
</LinkTo>
{{!-- Opens column --}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-opens">
{{#if (and @post.email.trackOpens (eq @post.email.status "submitted"))}}
<div class="flex">
{{#if this.feature.memberAttribution}}
<span class="gh-list-rate-bar">
<span class="gh-list-rate-number" data-tooltip="Opens: {{format-number @post.email.openedCount}}">{{@post.email.openRate}}%&nbsp;</span>
<span class="gh-list-rate-amount"><span style={{html-safe (concat "width: " @post.email.openRate "%;")}}/></span>
</span>
{{else}}
<span class="darkgrey fw5 gh-content-email-stats">
{{#if this.isHovered}}
{{format-number @post.email.openedCount}}
{{else}}
{{@post.email.openRate}}%&nbsp;
{{/if}}
</span>
{{/if}}
<span class="midgrey-l2 fw4 gh-content-email-stats-mobile">{{@post.email.openRate}}% opens</span>
</div>
{{else}}
<span class="gh-list-nodata">&mdash;</span>
{{/if}}
</LinkTo>
{{/if}}
{{/if}}
{{!-- Statuses for without the Member Attribution feature flag --}}
{{#unless this.feature.memberAttribution}}
{{#unless @hideStatusColumn }}
{{#if (and this.session.user.isContributor @post.isPublished)}}
<a href={{@post.url}} class="permalink gh-list-data gh-post-list-status" target="_blank" rel="noopener noreferrer">
<div class="flex items-center">
<span class="gh-content-status-published nowrap">
Published
{{#if @post.hasEmail}}
{{svg-jar "email-stroke" class="gh-post-status-email"}}
{{/if}}
</span>
</div>
</a>
{{else}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-status">
<div class="flex items-center">
{{#if @post.isScheduled}}
<span class="gh-content-status-scheduled gh-badge nowrap" title="Scheduled" data-tooltip="To be published {{if @post.newsletter "& sent at "}}{{capitalize this.scheduledText}} to {{@post.emailSegment}} members">
Scheduled
</span>
{{/if}}
{{#if @post.isDraft}}
<span class="gh-content-status-draft gh-badge gh-badge-pink nowrap">
Draft
</span>
{{/if}}
{{#if @post.isPublished}}
<span class="gh-content-status-published nowrap">
Published
{{#if @post.hasEmail}}
{{svg-jar "email-stroke" class="gh-post-status-email"}}
{{/if}}
</span>
{{/if}}
{{#if @post.isSent}}
<span class="gh-content-status-emailed nowrap">
{{svg-jar "email-stroke" class="gh-post-status-icon"}}
</span>
{{/if}}
</div>
</LinkTo>
{{/if}}
{{/unless}}
{{/unless}}
</li>