Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1142 add cms data extension #1328

Merged
merged 12 commits into from Jun 27, 2018

Conversation

Projects
None yet
5 participants
@anqaka
Copy link
Collaborator

commented Jun 21, 2018

No description provided.

@szafran89

This comment has been minimized.

Copy link

commented on src/extensions/cms/README.md in dbeb13b Jun 19, 2018

typo
Should be - make sure that in vue-storefront-api repo the cms-data extension is installed

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

👍 corrected

@szafran89

This comment has been minimized.

can you use htmlDecode filter instead of v-html

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

does not parse html with this filter... I leave it for now with v-html

@szafran89

This comment has been minimized.

Copy link

commented on src/extensions/cms/store.js in dbeb13b Jun 19, 2018

shorthand

return state.cmsBlock.find(item => item.id.toString() === id)

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

corrected

@szafran89

This comment has been minimized.

Copy link

commented on src/extensions/cms/store.js in dbeb13b Jun 19, 2018

shorthand

return state.cmsPages.find(item => item.id.toString() === id)

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

corrected

@szafran89

This comment has been minimized.

maybe would it be better change type to Number?

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

changed

@szafran89

This comment has been minimized.

Copy link

commented on src/themes/default/pages/Home.vue in dbeb13b Jun 19, 2018

if you set Number in prop definition you have to change it to <cms-block :id="5"/>

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

👍 fixed

@szafran89

This comment has been minimized.

Copy link

commented on src/extensions/cms/pages/CmsPage.vue in dbeb13b Jun 19, 2018

Do you need above line?

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

refactor

@szafran89

This comment has been minimized.

Copy link

commented on src/themes/default/pages/Home.vue in dbeb13b Jun 19, 2018

you can remove .vue

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

👍 removed

@szafran89

This comment has been minimized.

Copy link

commented on src/extensions/cms/store.js in dbeb13b Jun 19, 2018

I think we can use es6 syntax

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

👍 changed

@szafran89

This comment has been minimized.

Copy link

commented on src/extensions/cms/store.js in dbeb13b Jun 19, 2018

I think we can use es6 syntax

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

👍 changed

@szafran89

This comment has been minimized.

This comment has been minimized.

Copy link
Owner Author

replied Jun 21, 2018

refactor cms page as a component

@anqaka anqaka self-assigned this Jun 21, 2018

@anqaka anqaka requested a review from szafran89 Jun 21, 2018

@anqaka anqaka referenced this pull request Jun 21, 2018

Merged

1142 ad cms data api #58

@filrak

This comment has been minimized.

Copy link
Collaborator

commented Jun 21, 2018

@anqaka please just fix the conflicts and remove the page/block option from component as we discussed so it will be easier to adapt into abstract format I'm working on (#1325) and we are ready to merge it in ;)

loadCms (context, {id, type}) {
let url = (config.cms.endpoint)
.replace('{{type}}', type)
.replace(`{{cmsId}}`, id)

This comment has been minimized.

Copy link
@szafran89

szafran89 Jun 22, 2018

Collaborator

IMO there is no need to use template strings. You can just use single quotes '{{cmsId}}'

This comment has been minimized.

Copy link
@anqaka

anqaka Jun 22, 2018

Author Collaborator

corrected

@anqaka anqaka requested a review from filrak Jun 22, 2018

@anqaka

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 22, 2018

@filrak I made one component to display page and block, we have different endpoints but I use type prop to deal with it. Conflicts fixed. We need Magento module as a composer package to get the parsed content from Magento API, it will be released probably on Monday.

@filrak

This comment has been minimized.

Copy link
Collaborator

commented Jun 22, 2018

I'll wait with merge until we can test with our demo instance with Magento module ;)

@anqaka

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 25, 2018

@filrak the Magento modul is available as a composer package here: https://github.com/SnowdogApps/magento2-cms-api please check if everything works.

@pkarw

This comment has been minimized.

Copy link
Collaborator

commented Jun 25, 2018

Module installed on the demo-magento2.vuestorefront.io; @filrak please test this extension - it should work now

@pkarw
Copy link
Collaborator

left a comment

We're pretty close! :)


const getters = {
getBlock: (state) => (id) => {
return state.cmsBlock.find(item => item.id === id)

This comment has been minimized.

Copy link
@pkarw

pkarw Jun 25, 2018

Collaborator

Could You add the in-browser cache for the static content to improve the performance? we can use kind of localForage sync like we have in the shopping cart

if (actionName === types.CART_ADD_ITEM || actionName === types.CART_DEL_ITEM || actionName === types.CART_UPD_ITEM || actionName === types.CART_UPD_ITEM_PROPS) { // check if this mutation is cart related

Or, explicitly call setItem and getItem on some newly created localForage collection (please add the localForage collection in here:

Vue.prototype.$db = {

This comment has been minimized.

Copy link
@anqaka

anqaka Jun 26, 2018

Author Collaborator

added

@@ -8,5 +8,6 @@ export default [
require('@vue-storefront/extension-payment-backend-methods/index.js'),
require('@vue-storefront/extension-payment-cash-on-delivery/index.js'),
require('@vue-storefront/extension-template/index.js'),
require('vsf-payment-stripe/index.js')
require('vsf-payment-stripe/index.js'),
require('src/extensions/cms/index.js')

This comment has been minimized.

Copy link
@pkarw

pkarw Jun 25, 2018

Collaborator

@anqaka if we like to register this extension by default then we should have the config.cms section added to default.json

This comment has been minimized.

Copy link
@pkarw

pkarw Jun 25, 2018

Collaborator

If we add it to the default.json, then we should modify the installer script to populate this endpoint config as well:

config.cart.applycoupon_endpoint = `${backendPath}/api/cart/apply-coupon?token={{token}}&cartId={{cartId}}`

This comment has been minimized.

Copy link
@anqaka

anqaka Jun 26, 2018

Author Collaborator

moved to default.json and add to installer

@@ -26,6 +26,13 @@
<tile-links />
</section>
<Onboard/>

<cms-data :id="5" :type="'Block'" />

This comment has been minimized.

Copy link
@pkarw

pkarw Jun 25, 2018

Collaborator

Can we add the second way to reference blocks + pages - by url_key?

@pkarw

This comment has been minimized.

Copy link
Collaborator

commented Jun 26, 2018

OK, last thing! Could You please add some .catch() for fetching the content and add console.error('You need to install a custom Magento module from Snow.dog to make the CMS magick happen. Please go to https://github.com/SnowdogApps/magento2-cms-api and follow the instructions') OK? :)

@anqaka

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 27, 2018

@pkarw catch and error message added, I moved cms data to custom page and link to custom cms page to the footer. I've added minimal styles too.

@pkarw

pkarw approved these changes Jun 27, 2018

@pkarw pkarw merged commit 0509010 into DivanteLtd:develop Jun 27, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@danrcoull

This comment has been minimized.

Copy link

commented Nov 15, 2018

OK, last thing! Could You please add some .catch() for fetching the content and add console.error('You need to install a custom Magento module from Snow.dog to make the CMS magick happen. Please go to https://github.com/SnowdogApps/magento2-cms-api and follow the instructions') OK? :)

A issue with the cms extension as getters are triggering before the data is returned and have no access to the state, so just throws exceptions.

" Error in render: "TypeError: state.cmsPage is undefined"" but also the data returns yet the catch stated above is always triggered even when that module is isntalled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.