silverstripe / silverstripe-elemental

Create pages in Silverstripe CMS using content blocks
http://dna.co.nz
BSD 3-Clause "New" or "Revised" License
110 stars 115 forks source link

Blocks that no longer exist on the latest draft shouldn't show a "View Block" link in history #508

Open ScopeyNZ opened 5 years ago

ScopeyNZ commented 5 years ago

Affected Version

3.x, 4.x

Description

Currently when viewing the history of a page with an elemental area you can see blocks that were deleted in the past. At the moment these blocks still show a "View Block >" link even though they shouldn't be edited. This should just be removed

Steps to reproduce

cc @sachajudd

robbieaverill commented 5 years ago

I think the intention of that link is to view the contents of that block at that version in the archive, not to edit it

thats4shaw commented 5 years ago

A side effect I'm experiencing on 3.x is that when clicking on the 'View Block' link for a deleted block it throws an [Emergency] Uncaught BadMethodCallException: Object->__call(): the method 'forTemplate' does not exist on 'SilverStripe\View\ArrayData' error.

robbieaverill commented 5 years ago

@ScopeyNZ I'm not sure I agree with you on this one. The history view only shows one level deep of blocks - if you remove this link then you'll have no way of viewing nested data for that record at that time. The expectation should be that it opens in a readonly view mode when you click on "View block" - I'm not sure what it does at the moment. If it's opening an edit form then that's probably incorrect behaviour.

ScopeyNZ commented 5 years ago

The original designs called for it to open a different history viewer specific to that block. Currently it just takes you to the edit form of the block.

I'd love the original design but it hasn't been implemented yet 🙁

brynwhyman commented 5 years ago

Side note, I'm getting a 405 Method Not Allowed on my local when I click the 'View block' link (.../admin/pages/edit/EditForm/27). Also, I wouldn't assume to edit a block after clicking "View block"

brynwhyman commented 5 years ago

We're expecting this to be redundant after #233