aranja / tux

"Create React App" with SSR and a flexible addon system

Home Page:https://tux.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor contentful logic out of TuxModal

baering opened this issue · comments

TuxModal should not know that there's a .fields parent object or a en-US field structure.

  1. 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>.
  2. In the contentful adapter, let's make load and save unwrap the locale object for now. So adapter.load(model) returns a full model that's structurally similar to model, with fullModel.fields.title instead of fullModel.fields.title['en-US']. And adapter.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).