imacnu
8/17/2019 - 12:52 PM

Create Cells Page

Create a basic cells page scaffold

	"Add page in configuration": {
    "scope": "javascript, json",
		"prefix": "cells: add_page",
		"body": [
			"'use strict';",
			"",
			"module.exports = CONFIG => {",
			"  const utils = require('./common/_utils');",
			"  const pages = require('./common/_pages')(CONFIG)('${1}');",
			"  const COUNTRY = utils.getCountry(CONFIG);",
			"  const SPINNER = utils.SPINNER(CONFIG);",
			"  const isNativeIos = CONFIG.nativeIos || false;",
			"",
			"  const base = {",
			"    hash: '${1}',",
			"    currentPage: {",
			"      url: '/${2}',",
			"      params: []",
			"    },",
			"    pages: pages,",
			"    template: {",
			"      tag: 'cells-template-coronita',",
			"      properties: {",
			"        drawerWidth: '100%',",
			"        disableScrollLock: true,",
			"        hasFooter: true,",
			"        footerHeight: 100,",
			"        disableEdgeSwipe: true,",
			"        headerFixed: true,",
			"        extraHeaderClass: 'dark-blue-bg',",
			"        className: isNativeIos ? 'ios-top-padding' : ''",
			"      },",
			"      analytics: {",
			"        action: 'page-view',",
			"        digitalData: {",
			"          'page.pageInfo.pageSegment': '${1}',",
			"          'page.pageInfo.url': '/${2}',",
			"          'page.pageInfo.sysEnv': 'web-movil',",
			"          'page.pageInfo.language': 'ES',",
			"          'page.pageInfo.pageIntent': 'Informacion',",
			"          'page.pageInfo.channel': 'online',",
			"          'user.userState': 'no logado',",
			"          'user.country': COUNTRY",
			"        }",
			"      }",
			"    },",
			"",
			"    components: [",
			"      {",
			"        zone: 'app__main',",
			"        tag: 'cells-handle-life-cycle',",
			"        type: 'UI',",
			"        properties: {",
			"          pageName: '${1}',",
			"          customInitEvents: {",
			"            'swipe-menu-enabled': false",
			"          },",
			"          cellsConnections: {",
			"            in: {",
			"              __bridge_app: {",
			"                bind: 'navigation'",
			"              },",
			"              __bridge_page_${1}: {",
			"                bind: 'init'",
			"              }",
			"            },",
			"            out: {",
			"              ${3}_reset_page: {",
			"                bind: 'reset'",
			"              },",
			"              ${3}_init_page: {",
			"                bind: 'init-page'",
			"              },",
			"              global_enable_menu_swipe: {",
			"                bind: 'swipe-menu-enabled',",
			"                'forward-to-native': true",
			"              }",
			"            }",
			"          }",
			"        }",
			"      },",
			"      {",
			"        zone: 'app__header',",
			"        type: 'UI',",
			"        tag: 'cells-molecule-header',",
			"        properties: {",
			"          className: 'header--dark',",
			"          leftIcon: 'coronita:return-12',",
			"          titleName: 'glomo-${4}-header-title',",
			"          cellsConnections: {",
			"            in: {},",
			"            out: {",
			"              navigation_${5}_to_page: {",
			"                bind: 'click-left-button'",
			"              }",
			"            },",
			"          }",
			"        }",
			"      },",
			"      {",
			"        zone: 'app__header',",
			"        type: 'UI',",
			"        tag: 'glomo-navigation-handler',",
			"        properties: {",
			"          backAction: 'header-left-button',",
			"          continue: 'dashboard',",
			"          cellsConnections: {",
			"            in: {",
			"              navigation_${5}_to_continue: {",
			"                bind: 'navigate'",
			"              },",
			"              navigation_${5}_to_page: {",
			"                bind: 'navigate'",
			"              }",
			"            },",
			"            out: {",
			"              navigation_${5}_to_dashboard: {",
			"                bind: 'navigation-to-dashboard-logged',",
			"                link: {",
			"                  page: 'dashboard'",
			"                }",
			"              },",
			"              navigation_${5}_to_login: {",
			"                bind: 'navigation-to-dashboard',",
			"                link: {",
			"                  page: 'login'",
			"                }",
			"              }",
			"            },",
			"          }",
			"        }",
			"      },",
			"",
			"    ]",
			"  };",
			"",
			"  base.components.push({",
			"    zone: 'app__main',",
			"    tag: 'COMPONENT',",
			"    type: 'DM',",
			"    properties: {",
			"      cellsConnections: {",
			"        in: {",
			"          'CHANNEL_NAME_IN': {",
			"            bind: 'FUNCTION_NAME'",
			"          }",
			"        },",
			"        out: {",
			"          'CHANNEL_NAME_OUT': {",
			"            bind: 'EVENT_NAME'",
			"          }",
			"        }",
			"      }",
			"    }",
			"  });",
			"",
			"  return base;",
			"};",
			""
		],
		"description": "Add generic Cells page"
	}