The new post list rows match the edit or analytics button

refs https://github.com/TryGhost/Team/issues/1965
This commit is contained in:
James Morris 2022-09-26 18:09:52 +01:00
parent ad2cb3ae11
commit 8bef3b9e34
2 changed files with 27 additions and 11 deletions

View File

@ -45,7 +45,7 @@
{{/unless}}
</a>
{{else}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-title">
<LinkTo @route={{this.routeForLink}} @models={{this.modelsForLink}} class="permalink gh-list-data gh-post-list-title">
<h3 class="gh-content-entry-title">
{{@post.title}}
{{#if @post.lexical}}
@ -118,7 +118,7 @@
{{/if}}
{{!-- Opens column --}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-opens">
<LinkTo @route={{this.routeForLink}} @models={{this.modelsForLink}} class="permalink gh-list-data gh-post-list-opens">
{{#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"))}}
<div class="flex flex-column" {{on "mouseover" (fn (mut this.isOpenStatHovered) true)}} {{on "mouseleave" (fn (mut this.isOpenStatHovered) false)}}>
<span class="gh-content-email-stats-value">
@ -136,7 +136,7 @@
</LinkTo>
{{!-- Clicks column --}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="permalink gh-list-data gh-post-list-clicks">
<LinkTo @route={{this.routeForLink}} @models={{this.modelsForLink}} class="permalink gh-list-data gh-post-list-clicks">
{{#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)}}
<div class="flex flex-column" {{on "mouseover" (fn (mut this.isClickStatHovered) true)}} {{on "mouseleave" (fn (mut this.isClickStatHovered) false)}}>
<span class="gh-content-email-stats-value">
@ -154,18 +154,16 @@
</LinkTo>
{{!-- 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"}}">
<LinkTo @route={{this.routeForLink}} @models={{this.modelsForLink}} 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="gh-list-data-inner">
{{#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="">
<LinkTo @route={{this.routeForLink}} @models={{this.modelsForLink}} class="gh-post-list-cta stats {{if this.isHovered "is-hovered"}}" title="">
{{#if this.isAnalytics}}
{{svg-jar "stats" title=""}}<span>Stats</span>
</LinkTo>
{{else}}
<LinkTo @route="editor.edit" @models={{array @post.displayName @post.id}} class="gh-post-list-cta edit {{if this.isHovered "is-hovered"}}" title="">
{{else}}
{{svg-jar "pen" title=""}}<span>Edit</span>
</LinkTo>
{{/if}}
{{/if}}
</LinkTo>
</div>
{{else}}
<p class="gh-content-entry-status">

View File

@ -24,6 +24,24 @@ export default class PostsListItemClicks extends Component {
return text.join(' ');
}
get isAnalytics() {
return ((!this.session.user.isContributor) && (this.args.post.isSent || this.args.post.isPublished) && (this.settings.get('emailTrackClicks') || this.feature.get('memberAttribution')));
}
get routeForLink() {
if (this.isAnalytics) {
return 'posts.analytics';
}
return 'editor.edit';
}
get modelsForLink() {
if (this.isAnalytics) {
return [this.args.post];
}
return [this.args.post.displayName, this.args.post.id];
}
@action
mouseOver() {
this.isHovered = true;