Omeka icon indicating copy to clipboard operation
Omeka copied to clipboard

Issue #926: Use record_url for path to public page on admin interface

Open timstallmann opened this issue 3 years ago • 10 comments

For themes/modules that override default URLs, this ensures that the "View Public Page" link on the admin interface goes to the correct URL for an item on that particular site, rather than forcing /items/show/<id>

timstallmann avatar Mar 15 '21 15:03 timstallmann

Have you checked this without having a plugin overriding the URL? I think the admin/public problem I mentioned in your initial issue would still happen here.

zerocrates avatar Mar 17 '21 21:03 zerocrates

Have not tested it yet, but I will!

timstallmann avatar Mar 24 '21 18:03 timstallmann

@zerocrates just tested finally, and on a default install this just links to items/show/item_id, as it should.

timstallmann avatar May 10 '21 19:05 timstallmann

And you're sure it's not linking to the admin items/show/<id> page? I'm pretty sure that's what your change does.

zerocrates avatar May 10 '21 23:05 zerocrates

Nope it was the regular /items/show page. I mean, please do test it yourself too to verify, I'd be happy to work on the code further if need be.

timstallmann avatar May 11 '21 00:05 timstallmann

I did test it. It makes the link go to the admin item show page.

zerocrates avatar May 11 '21 00:05 zerocrates

Huh strange -- let me see if I can replicate that on my end

timstallmann avatar May 11 '21 00:05 timstallmann

Apologies, I was checking the detail page, not the edit page; you're totally right. Do you have any suggestions about how to dynamically get the correct public item page URL here, in a way that would allow sites to use urls other than /items/show/ for the public item page? I'm not totally clear I understand the bit where the base URL for the front controller gets prepended to the result of record_url.

timstallmann avatar May 11 '21 01:05 timstallmann

I alluded to this problem in your original issue #926: links that go from one "side" to the other need special handling. For links created from strings, we have public_url and admin_url functions that force the URL to be created on the correct side.

I think the answer here involves creating new public_record_url and admin_record_url functions and using the public one here. If you look at public_url and admin_url you'll see that the process involved is pretty simple.

zerocrates avatar May 11 '21 19:05 zerocrates

Got it, thanks! Will submit a revised PR next time I can squeeze in some time..

timstallmann avatar May 14 '21 14:05 timstallmann