const app = require('../../app') const {editIcon, createIcon} = require('../../assets') const list = ({ typeName, typePlural, camelName, camelPlural, paramName, paramPlural, apiPrefix, appPrefix, columns }) => { const defaultHeader = column => html`${column.fieldName}` const defaultCell = column => html`{{${raw(camelName)}.${raw(column.camelName)}}}` app.component(`app${typePlural}Page`, { template: html`

${typePlural}

${columns.map(c => c.header || defaultHeader(c))} ${columns.map(c => c.cell || defaultCell(c))}
Actions
Edit
`, controllerAs: 'ctrl', controller: function(api) { const crud = api.crud(apiPrefix) this.selected = [] this.data = [] this.getRecords = () => { this.promise = crud.list().then(data => { this.data = data }) } this.getRecords() } }) } module.exports = list