bolt / core

🧿 Bolt 5 core
https://boltcms.io
MIT License
539 stars 158 forks source link

Content type link in dashboard uses /bolt instead of config option #3128

Closed andysh-uk closed 2 years ago

andysh-uk commented 2 years ago

On the Dashboard there is a link to the content type page within each individual entry’s preview - e.g.

Item title publish date Edit button
author name
content-type

This link seems to always going to /bolt/content/content-type and ignoring the “bolt.backend_url” parameter.

Details

Question Answer
Relevant Bolt Version 5.1.4
Install type Composer install
BC Break no
PHP version 8.0
Web server Nginx
For UX/UI issues Firefox on Mac, Safari on iPad OS

Reproduction

If you're filing a bug, please describe how to reproduce it. Include as much relevant information as possible, such as:

Bug summary

The dashboard always uses /bolt as the route prefix instead of the “bolt.backend_url” parameter.

Specifics

Occurs only on the dashboard against each entry’s content type label.

Steps to reproduce

Expected result

You would navigate to the content type listing page in the backend at /cms/content/content-type ( where /cms is the value of bolt.backend_url)

Actual result

You get a 404 from /bolt/content/content-type

Joossensei commented 2 years ago

Hi @andysh-uk! The bolt.backend_url gets cached which explains why this is happening to you. To quick fix this you need to run bin/console c:c. This will clear the cache and update the links.

andysh-uk commented 2 years ago

Hi @Joossensei,

This doesn't work for me.

I've dug into the source code and found that /bolt/ is hard-coded in assets/js/app/listing/Components/Table/Row/_Meta.vue:

<a :href="`/bolt/content/${record.contentType}`">{{ record.extras.singular_name }}</a>

I'm working on a PR to resolve this by passing through a "content type overview link" in the same way as "edit link" and "delete link" are generated and passed through, which uses routing to generate them on the back-end and pass them through to the VueJS front-end component.

Joossensei commented 2 years ago

Your right! I misunderstood your issue. I thought you were talking about the title link. (Which doesnt update before clearing the cache either but that's something else.)

You could try to add this :href="record.extras.editLink" instead of the hardcoded version. This comes from the main Title of the row: https://github.com/bolt/core/blob/adfab2e2cd70a264e139cbbe9bf3a2a742802511/assets/js/app/listing/Components/Table/Row/index.vue#L10

andysh-uk commented 2 years ago

No worries @Joossensei.

Wouldn't that suggestion just turn it into another "Edit" link, though? I think it's right that the link goes to the content type listing page for the item's content type - the only issue is that it's going to /bolt instead of /cms (in my case.)

It's this link here:

image

For the above example, it's currently hard-coded to go to: /bolt/content/blog-posts, instead of /cms/content/blog-posts.

Joossensei commented 2 years ago

🤦‍♂️Misunderstood again sorry... Not fully awake today. Guess I'll leave you to it then 😅.

andysh-uk commented 2 years ago

🤦‍♂️Misunderstood again sorry... Not fully awake today. Guess I'll leave you to it then 😅.

🤣 don't worry, after a houseful of COVID this weekend, I know that feeling!

Could you re-open this issue so I can submit the PR against it? Cheers!