@ribajs/shopify
Advanced tools
Comparing version 1.4.0 to 1.5.0
{ | ||
"name": "@ribajs/shopify", | ||
"description": "Shopify extension for Riba.js", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"author": "Pascal Garber <pascal@artandcode.studio>", | ||
@@ -62,5 +62,5 @@ "contributors": [], | ||
"dependencies": { | ||
"@ribajs/core": "^1.4.0", | ||
"@ribajs/i18n": "^1.4.0" | ||
"@ribajs/core": "^1.5.0", | ||
"@ribajs/i18n": "^1.5.0" | ||
} | ||
} | ||
} |
@@ -14,3 +14,3 @@ # Shopify Module | ||
```ts | ||
import { Riba, JQuery } from '@ribajs/core'; | ||
import { Riba, Utils } from '@ribajs/core'; | ||
import shopifyModule from '@ribajs/shopify'; | ||
@@ -20,5 +20,5 @@ const riba = new Riba(); | ||
riba.module.regist(shopifyModule); | ||
JQuery(($: JQueryStatic) => { | ||
Utils.domIsReady(() => { | ||
riba.bind(document.body, model); | ||
}); | ||
``` |
@@ -119,3 +119,3 @@ import { Component, Debug, EventDispatcher } from '@ribajs/core'; | ||
this.debug('collapseAll'); | ||
if (this.scope.linklist) { | ||
if (this.scope.linklist && this.scope.linklist.links) { | ||
this.collapseAllByLinks(this.scope.linklist.links); | ||
@@ -129,3 +129,3 @@ } | ||
public showByChildUrl(url: string) { | ||
if (this.scope.linklist) { | ||
if (this.scope.linklist && this.scope.linklist.links) { | ||
for (const link of this.scope.linklist.links) { | ||
@@ -163,3 +163,2 @@ for (const sublink of link.links) { | ||
if (name === 'linklist') { | ||
console.error('linklist newValue', newValue); | ||
if (typeof(newValue) === 'object') { | ||
@@ -169,3 +168,2 @@ // if object is in form of "main-menu": {...} | ||
newValue = newValue[Object.keys(newValue)[0]]; | ||
console.error('newValue', newValue); | ||
} | ||
@@ -179,3 +177,3 @@ } | ||
protected collapseAllByLinks(links: LinklistLink[]) { | ||
if (this.scope.linklist) { | ||
if (this.scope.linklist && this.scope.linklist.links) { | ||
for (const link of links) { | ||
@@ -193,3 +191,3 @@ if (link.collapseable) { | ||
protected showAllByLinks(links: LinklistLink[]) { | ||
if (this.scope.linklist) { | ||
if (this.scope.linklist && this.scope.linklist.links) { | ||
for (const link of links) { | ||
@@ -206,5 +204,5 @@ if (link.collapseable) { | ||
protected onNewPageReady(viewId: string, currentStatus: IState, prevStatus: IState, $container: JQuery<HTMLElement>, newPageRawHTML: string, dataset: any, isFirstPageLoad: boolean) { | ||
const url = new URL(currentStatus.url); | ||
this.debug('onNewPageReady', url.pathname); | ||
protected onNewPageReady(viewId: string, currentStatus: IState, prevStatus: IState, container: HTMLElement, newPageRawHTML: string, dataset: any, isFirstPageLoad: boolean) { | ||
const url = currentStatus.url; | ||
this.debug('[ShopifyLinklistComponent] onNewPageReady', url); | ||
if (this.scope.collapseOnNewPage) { | ||
@@ -214,3 +212,3 @@ this.collapseAll(); | ||
if (this.scope.showOnActiveChild) { | ||
this.showByChildUrl(url.pathname); | ||
this.showByChildUrl(url); | ||
} | ||
@@ -217,0 +215,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Debug, Component, JQuery } from '@ribajs/core'; | ||
import { Debug, Component } from '@ribajs/core'; | ||
@@ -9,4 +9,2 @@ export abstract class ShopifySectionComponent extends Component { | ||
protected $el: JQuery<HTMLElement>; | ||
protected abstract scope: any; | ||
@@ -16,11 +14,13 @@ | ||
super(element); | ||
this.$el = JQuery(this.el); | ||
this.initEventListeners(); | ||
} | ||
this.$el.on('shopify:section:load', this.onSectionLoad); | ||
this.$el.on('shopify:section:unload', this.onSectionUnload); | ||
this.$el.on('shopify:section:select', this.onSectionSelect); | ||
this.$el.on('shopify:section:deselect', this.onSectionDeselect); | ||
this.$el.on('shopify:section:reorder', this.onSectionReorder); | ||
this.$el.on('shopify:block:select', this.onBlockSelect); | ||
this.$el.on('shopify:block:deselect', this.onBlockDeselect); | ||
protected initEventListeners() { | ||
this.el.addEventListener('shopify:section:load', this.onSectionLoad); | ||
this.el.addEventListener('shopify:section:unload', this.onSectionUnload); | ||
this.el.addEventListener('shopify:section:select', this.onSectionSelect); | ||
this.el.addEventListener('shopify:section:deselect', this.onSectionDeselect); | ||
this.el.addEventListener('shopify:section:reorder', this.onSectionReorder); | ||
this.el.addEventListener('shopify:block:select', this.onBlockSelect); | ||
this.el.addEventListener('shopify:block:deselect', this.onBlockDeselect); | ||
} | ||
@@ -34,30 +34,30 @@ | ||
*/ | ||
protected onSectionLoad(event: JQuery.Event, data: any) { | ||
this.debug('onSectionLoad', data); | ||
protected onSectionLoad(event: Event) { | ||
this.debug('onSectionLoad', event); | ||
} | ||
protected onSectionUnload(event: JQuery.Event, data: any) { | ||
this.debug('onSectionUnload', data); | ||
protected onSectionUnload(event: Event) { | ||
this.debug('onSectionUnload', event); | ||
} | ||
protected onSectionSelect(event: JQuery.Event, data: any) { | ||
this.debug('onSectionSelect', data); | ||
protected onSectionSelect(event: Event) { | ||
this.debug('onSectionSelect', event); | ||
} | ||
protected onSectionDeselect(event: JQuery.Event, data: any) { | ||
this.debug('onSectionDeselect', data); | ||
protected onSectionDeselect(event: Event) { | ||
this.debug('onSectionDeselect', event); | ||
} | ||
protected onSectionReorder(event: JQuery.Event, data: any) { | ||
this.debug('onSectionReorder', data); | ||
protected onSectionReorder(event: Event) { | ||
this.debug('onSectionReorder', event); | ||
} | ||
protected onBlockSelect(event: JQuery.Event, data: any) { | ||
this.debug('onBlockSelect', data); | ||
protected onBlockSelect(event: Event) { | ||
this.debug('onBlockSelect', event); | ||
} | ||
protected onBlockDeselect(event: JQuery.Event, data: any) { | ||
this.debug('onBlockDeselect', data); | ||
protected onBlockDeselect(event: Event) { | ||
this.debug('onBlockDeselect', event); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74423
1939
Updated@ribajs/core@^1.5.0
Updated@ribajs/i18n@^1.5.0