0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Added a logic to differentiate modal copy

This commit is contained in:
Sodbileg Gansukh 2024-08-07 15:43:44 +08:00
parent 8542d8bfcf
commit bad9254eb9
4 changed files with 19 additions and 4 deletions

View file

@ -12,7 +12,11 @@
{{#if this.post.emailOnly}}
Your email has been sent.
{{else}}
That's {{format-number this.postCount}} {{gh-pluralize this.postCount "post" without-count=true}} published.
{{#if this.showPostCount}}
That's {{format-number this.postCount}} {{gh-pluralize this.postCount "post" without-count=true}} published.
{{else}}
Opened from the analytics
{{/if}}
{{/if}}
</span>
{{else}}

View file

@ -17,6 +17,10 @@ export default class ModalPublishFlow extends ModalComponent {
return this.model.postCount;
}
get showPostCount() {
return this.model.showPostCount;
}
@action
handleTwitter() {
window.open(`https://twitter.com/intent/tweet?url=${encodeURI(this.post.url)}`, '_blank');

View file

@ -38,9 +38,11 @@
<button class="gh-post-list-cta edit" {{on "click" this.fetchPostTask.perform}}>
{{svg-jar "reload" title="Refresh post analytics"}}<span>Refresh</span>
</button>
<button class="gh-post-list-cta edit" {{on "click" this.togglePublishFlowModal}}>
{{svg-jar "share" title="Share post"}}<span>Share</span>
</button>
{{#unless this.post.emailOnly}}
<button class="gh-post-list-cta edit" {{on "click" this.togglePublishFlowModal}}>
{{svg-jar "share" title="Share post"}}<span>Share</span>
</button>
{{/unless}}
{{!-- <LinkTo @route="lexical-editor.edit" @models={{array this.post.displayName this.post.id}} class="gh-post-list-cta edit" title="">
{{svg-jar "pen" title="Edit post"}}<span>Edit post</span>
</LinkTo> --}}
@ -266,7 +268,9 @@
@model={{hash
post=this.post
postCount=this.postCount
showPostCount=this.showPostCount
}}
@haha="haha"
@close={{this.togglePublishFlowModal}}
@modifier="action wide" />
{{/if}}

View file

@ -35,6 +35,7 @@ export default class Analytics extends Component {
@tracked _post = null;
@tracked showPublishFlowModal = false;
@tracked postCount = null;
@tracked showPostCount = false;
displayOptions = DISPLAY_OPTIONS;
constructor() {
@ -45,6 +46,7 @@ export default class Analytics extends Component {
async checkPublishFlowModal() {
if (localStorage.getItem('ghost-last-published-post')) {
await this.fetchPostCountTask.perform();
this.showPostCount = true;
this.showPublishFlowModal = true;
localStorage.removeItem('ghost-last-published-post');
}
@ -165,6 +167,7 @@ export default class Analytics extends Component {
@action
togglePublishFlowModal() {
this.showPostCount = false;
this.showPublishFlowModal = !this.showPublishFlowModal;
}