[MTE-105] Fix dx problems with image block Created: 10/Aug/17  Updated: 18/Oct/17  Resolved: 17/Aug/17

Status: Closed
Project: Magnolia Templating Essentials
Component/s: None
Affects Version/s: None
Fix Version/s: 1.1.4, 1.2

Type: Story Priority: Major
Reporter: Christopher Zimmermann Assignee: Maxime Michel
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Documentation update required:
Yes
Epic Link: Content Editor fine-tuning
Sprint: Basel 109
Story Points: 3

 Description   

The standard blocks will be available in the stock stories app and should be as developer friendly as possible. The image block has two problems.

The simple problem is that the css class of the image is "lead-image" which does not make sense. It should probably simply be blank.

The main problem is that the basic HTML structure changes depending on whether the image block (or the asset it exposes) has a caption or credit supplied (A wrapping div is either present or not). This makes any CSS or JS much harder to develop and test - and a developer might not even realize that the HTML structure changes - ie they are developing a project and no one has supplied any caption or credit - they launch the project, then an author adds a caption to an image and breaks the website.

This problem exists in the mtk image macro, which is used by the image block.

https://git.magnolia-cms.com/projects/MODULES/repos/templating-essentials/browse/magnolia-templating-kit/src/main/resources/mtk/templates/macros/image.ftl

New structure
The most important thing is that div structure stays the same - a question is, should the image, caption, credit always be wrapped, or not wrapped. In the context of an image block for the content editor, they should definitely always be wrapped. Each block should have one top level element.

Possible approaches:
Do not use the mtk image macro.

Modify the mtk image macro to accept a new parameter (or a new template definition parameter) to change the wrapping behaviour.
But we cannot change the mtk image block default behaviour in a minor version as it would break existing projects.



 Comments   
Comment by Christopher Zimmermann [ 10/Aug/17 ]

Maybe defintiion parameter alwaysWrap=true?

Generated at Mon Feb 12 07:41:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.