episerver / musicfestival-vue-template

The Vue.js version of the MusicFestival template site
https://world.episerver.com/documentation/developer-guides/CMS/editing/on-page-editing-with-client-side-rendering/
Apache License 2.0
41 stars 19 forks source link

Customize the model handling #8

Closed mattvl closed 5 years ago

mattvl commented 5 years ago

I see the model is handled in epiDataModel.js which relies on the Epi API. Would it be possible to add extra data to it? (maybe from the controller for example). I'm thinking about translations from the dictionary or custom properties not from Episerver. It would be nice to be able to use the model as a view model.

Regards, Matteo

valdisiljuconoks commented 5 years ago

where you will be storing localized resources?

mattvl commented 5 years ago

Hi @valdisiljuconoks, Usually I use the DbLocalizationProvider for translations, so they will be stored in the database.

In a standard solution I can include them in the viewmodel when a separation between frontend and back end is needed. What would you suggest in this case?

Thanks

seriema commented 5 years ago

@mattvl The returned model is modified in the ExtendedContentModelMapper.cs, where we add info about existing languages. You can probably add more properties there if you want. You can also follow this guide for more modifications to the Content Delivery API results: https://world.episerver.com/documentation/developer-guides/content-delivery-api/how-to-customize-data-returned-to-clients/

mattvl commented 5 years ago

Thanks a lot @seriema for the clarification. That's exactly what I was searching for!