From a978f9f6b9b7c12bf0314754056b2f59cbd8d76a Mon Sep 17 00:00:00 2001
From: Fabien 'egg' O'Carroll
Date: Mon, 3 Apr 2023 13:35:56 +0700
Subject: [PATCH] Moved posts export to analytics settings page (#16539)
refs https://github.com/TryGhost/Team/issues/2869
---
.../app/components/settings/analytics.hbs | 4 +-
.../app/components/settings/analytics.js | 11 ++++++
ghost/admin/app/controllers/posts.js | 13 -------
ghost/admin/app/templates/posts.hbs | 37 -------------------
4 files changed, 14 insertions(+), 51 deletions(-)
diff --git a/ghost/admin/app/components/settings/analytics.hbs b/ghost/admin/app/components/settings/analytics.hbs
index 3aa6c7a761..9a7168da14 100644
--- a/ghost/admin/app/components/settings/analytics.hbs
+++ b/ghost/admin/app/components/settings/analytics.hbs
@@ -111,7 +111,9 @@
Download a single, glorious CSV file with all your post analytics
-
+
diff --git a/ghost/admin/app/components/settings/analytics.js b/ghost/admin/app/components/settings/analytics.js
index 4fc47accde..c7f40b0625 100644
--- a/ghost/admin/app/components/settings/analytics.js
+++ b/ghost/admin/app/components/settings/analytics.js
@@ -1,10 +1,12 @@
import Component from '@glimmer/component';
+import ghostPaths from 'ghost-admin/utils/ghost-paths';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
export default class Analytics extends Component {
@service settings;
@service feature;
+ @service utils;
@action
toggleEmailTrackOpens(event) {
@@ -14,6 +16,15 @@ export default class Analytics extends Component {
this.settings.emailTrackOpens = !this.settings.emailTrackOpens;
}
+ @action
+ exportData() {
+ let exportUrl = ghostPaths().url.api('posts/export');
+ let downloadParams = new URLSearchParams();
+ downloadParams.set('limit', 'all');
+
+ this.utils.downloadFile(`${exportUrl}?${downloadParams.toString()}`);
+ }
+
@action
toggleEmailTrackClicks(event) {
if (event) {
diff --git a/ghost/admin/app/controllers/posts.js b/ghost/admin/app/controllers/posts.js
index a5868a691d..b6e927645a 100644
--- a/ghost/admin/app/controllers/posts.js
+++ b/ghost/admin/app/controllers/posts.js
@@ -1,5 +1,4 @@
import Controller from '@ember/controller';
-import ghostPaths from 'ghost-admin/utils/ghost-paths';
import {DEFAULT_QUERY_PARAMS} from 'ghost-admin/helpers/reset-query-params';
import {action} from '@ember/object';
import {inject} from 'ghost-admin/decorators/inject';
@@ -53,7 +52,6 @@ export default class PostsController extends Controller {
@service router;
@service session;
@service store;
- @service utils;
@inject config;
@@ -142,17 +140,6 @@ export default class PostsController extends Controller {
return authors.findBy('slug', author) || {slug: '!unknown'};
}
- @action
- exportData() {
- let exportUrl = ghostPaths().url.api('posts/export');
- // the filter and order params are set from the route to the controller via the infinity model
- // we can retrieve these via the extraParams of the infinity model
- let downloadParams = new URLSearchParams(this.model.extraParams);
- downloadParams.set('limit', 'all');
-
- this.utils.downloadFile(`${exportUrl}?${downloadParams.toString()}`);
- }
-
@action
changeType(type) {
this.type = type.value;
diff --git a/ghost/admin/app/templates/posts.hbs b/ghost/admin/app/templates/posts.hbs
index 09173d8c4b..67c1fe7ad7 100644
--- a/ghost/admin/app/templates/posts.hbs
+++ b/ghost/admin/app/templates/posts.hbs
@@ -23,43 +23,6 @@
/>
- {{#if (feature 'makingItRain')}}
-
-
-
- {{svg-jar "settings"}}
- Actions
-
-
-
-
- {{#if this.totalPosts}}
-
- {{else}}
-
- {{/if}}
-
-
-
- {{/if}}
-
New post