Skip to content

Commit

Permalink
Ensure navigation to submit and about route in Explore
Browse files Browse the repository at this point in the history
  • Loading branch information
aileen committed Oct 20, 2022
1 parent 0f085ab commit da0cb0b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 0 additions & 2 deletions ghost/admin/app/controllers/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export default class ExploreController extends Controller {
// to the submit page and fetch the required site data
setTimeout(() => {
this.explore.toggleExploreWindow(true);
this.explore.sendRouteUpdate({path: '/explore'});
this.router.transitionTo('explore');
}, 500);
} else {
// Ghost Explore URL to submit a new site
Expand Down
23 changes: 18 additions & 5 deletions ghost/admin/app/routes/explore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class ExploreRoute extends AuthenticatedRoute {
}

@action
willTransition(transition) {
async willTransition(transition) {
let isExploreTransition = false;

if (transition) {
Expand All @@ -43,10 +43,23 @@ export default class ExploreRoute extends AuthenticatedRoute {

if (destinationUrl?.includes('/explore')) {
isExploreTransition = true;
let path = destinationUrl.replace(/explore\//, '');
path = path === '/' ? '/explore' : path;
// Send the updated route to the iframe
this.explore.sendRouteUpdate({path});
this.explore.isIframeTransition = isExploreTransition;

if (destinationUrl?.includes('/explore/submit')) {
// Ensure the model is loaded before sending the controller action
const model = await this.model;
this.controllerFor('explore').submitExploreSite(model);
} else {
let path = destinationUrl.replace(/explore\//, '');
path = path === '/' ? '/explore/' : path;

if (destinationUrl?.includes('/explore/about')) {
window.open(`${this.explore.exploreUrl}about/`, '_blank').focus();
path = '/explore/';
}
// Send the updated route to the iframe
this.explore.sendRouteUpdate({path});
}
}
}

Expand Down

0 comments on commit da0cb0b

Please sign in to comment.