wellcomecollection.org
wellcomecollection.org copied to clipboard
Amend slices that use labels, so they work with slice machine
Relates to #10789
Background
We currently make use of slice labels to allow content editors to label a particular slice. We then use this label to choose how the slice should be displayed. For example, a quote slice can be displayed as a 'pull' quote or a 'review' quote.
Labels are not supported by slice machine (it uses the concept of variations, which will allow the editors to see what each variation looks like when making a choice).
It is likely we will eventually move to using variations (issue to come), but in the interim we need to make things work with the current model.
Task
When we convert our legacy slices to slice machine slices within our custom types all the data should map across (to be verified with our prismic dev environment). However, label data will have nowhere to go.
- [x] Establish which of our slices currently use labels
- [x] Create a select field on those slices with the same API id and choices as the current label field
This is where I could find labels, keeping in mind that not selecting any (think it shows as ...
on the UI) is also a valid option;
-
Article-body
- editorialImage: Featured, Supporting, Standalone
- gifVideo: Supporting
- iframe: Supporting, Standalone
- editorialImageGallery: Standalone, Frames
- quoteV2: Pull, Review (as we know, these two seem to be doing the same thing)
-
Body
- editorialImage: Supporting, Standalone
-
quote: Pull, Review (same as
quoteV2
)
Ran a sliceAnalysis
to find all of these that are using a label (so not set to undefined
or default
):
- editorialImage found 1215 times in 410 articles and pages
- quote found 102 times in 79 exhibitions, books, pages and event-series
- quoteV2 found 452 times in 387 articles
- gifVideo found 5 times in 3 articles
- iframe 4 times in 3 articles
- editorialImageGallery 449 times in 449 articles and webcomics
So iframe
and gifVideo
are probably good ones to test with.
Interesting that the editorialImage
in article offered more labels than in the other types, but that's why we're excited about Shared slices!
Looking at the code, I don't think iframe
nor gifVideo
uses it at all though, if we want to test removing it fully, here's where they are used:
gifVideo
[
{
id: 'XzVOJxEAACEAzZ8b',
type: 'articles',
format: 'article',
title: 'When contemporary dance meets dyspraxia',
label: [ 'supporting' ],
url: 'http://wellcomecollection.org/articles/XzVOJxEAACEAzZ8b'
},
{
id: 'WilSbykAANoWFUhP',
type: 'articles',
format: undefined,
title: 'Getting sexy with cinnamon',
label: [ 'supporting' ],
url: 'http://wellcomecollection.org/articles/WilSbykAANoWFUhP'
},
{
id: 'WmYSMCQAACQAn-Ke',
type: 'articles',
format: undefined,
title: 'Yoga gets physical',
label: [ 'supporting', 'supporting', 'supporting' ],
url: 'http://wellcomecollection.org/articles/WmYSMCQAACQAn-Ke'
}
]
iframe
[
{
id: 'WcvPmSsAAG5B5-ox',
type: 'articles',
format: undefined,
title: 'The Key to Memory: Follow your nose',
label: [ 'standalone', 'standalone' ],
url: 'http://wellcomecollection.org/articles/WcvPmSsAAG5B5-ox'
},
{
id: 'WcvK4CsAANQR59Up',
type: 'articles',
format: undefined,
title: 'The Key to Memory: Write it down',
label: [ 'standalone' ],
url: 'http://wellcomecollection.org/articles/WcvK4CsAANQR59Up'
},
{
id: 'WvQF4SIAAFNX_7Uf',
type: 'articles',
format: undefined,
title: 'The art of scientific glassblowing',
label: [ 'standalone' ],
url: 'http://wellcomecollection.org/articles/WvQF4SIAAFNX_7Uf'
}
]
Otherwise I think this is all about editorialImage
, editorialImageGallery
as well as quote[V2]
, really. @davidpmccormick and I remember conversations we'd've had with @gestchild about editorialImage
maybe needing a different tweak though. To quote David's reason, it's:
Because they don’t always work as expected on account of how we limit our image heights based on vh