Refactor contentful logic out of TuxModal
baering opened this issue · comments
Bæring Gunnar Steinþórsson commented
TuxModal should not know that there's a .fields
parent object or a en-US
field structure.
- type should support 'fields.title' and ['fields', 'title'] like the inline editor. For now, let's make all contentful schemas refer to
fields.<fieldname>
instead of<fieldname>.
- In the contentful adapter, let's make
load
andsave
unwrap the locale object for now. Soadapter.load(model)
returns a full model that's structurally similar tomodel
, withfullModel.fields.title
instead offullModel.fields.title['en-US']
. Andadapter.save(fullModel)
adds these locale objects back before saving.- This may require a concept of "current locale" (e.g. Aranja's is 'en-US' while Kolibri's is 'en-GB'. See if we can get this from contentful somehow).
- Also, be careful not to "lose" other locale data when saving. (so store the actual full model and merge current locale changes into it).
Eiríkur Heiðar Nilsson commented
Fixed in #57