Document using lightbox and checkOff


Sun Aug 23 2020 17:17:20 GMT+0000 (Coordinated Universal Time)

Saved by @oakfernsara

export function documentation(event, type, lesson, sticky) {
	let $item = $
	let data = {
		type: type,
		id: event.context.itemId,
		lesson: lesson,
		sticky: sticky

	console.log('[todo-helper.js documentation] data is', data)

	if ( === true) {
		console.log('[todo-helper.js documentation] is true')
		wixWindow.openLightbox('Submit Activities', data)
		.then(result => {
			console.log('[todo-helper.js documentation] returning from lightbox', result)
			if (result.checkOriginal === true) {
				checkOff(event, type)
				.then(() => {'/current-quests')
	} else {
		checkOff(event, type)

Takes event, type (db name), data from this item, and optional sticky. If is true, opens Submit Activities lightbox that returns data. If data.checkOriginal is true, the referring item will also be checked off and the user will be redirected to the Current Quests page. If is not true, checkOff is run to mark the item as not done.