UNPKG

landmark-serve

Version:

Web Application Framework and Admin GUI / Content Management System built on Express.js and Mongoose

58 lines (52 loc) 2.02 kB
mixin column(list, col, item) if col.type == 'relationship' - var refData = item.get(col.path) if col.field.many if Array.isArray(refData) && refData.length div.col-value - var values = [] - _.first(refData, 3).forEach(function(i) { values.push(col.subField ? col.subField.format(i) : i[col.refPath]) }) = values.join(', ') if refData.length > 3 | ... (#{refData.length - 3} more) else if refData if (col.subField && col.subField.type == 'boolean' && !col.many) +column_boolean(refData[col.refPath]) else - var value = col.subField ? col.subField.format(refData) : refData[col.refPath] if col.refList && refData && refData.id +column_link(value, '/landmark/' + col.refList.path + '/' + refData.id) else +column_basic(value) else if col.type == 'markdown' +column_html(utils.textToHTML(utils.cropString(item.get(col.field.paths.md), 200, '...', true))) else if col.type == 'html' +column_html(utils.cropHTMLString(item.get(col.field.path), 200, '...', true)) else - var value = col.field ? col.field.format(item) : item.get(col.path) if col.isName +column_link(value || '(no name)', '/landmark/' + list.path + '/' + item.id) else if col.type == 'email' if value && col.field.options.displayGravatar +column_gravatar(col.field.gravatarUrl(item,35)) +column_link(value, 'mailto:' + value) else if col.type == 'boolean' +column_boolean(value) else if col.type == 'url' +column_link(value, value, true) else +column_basic(value) mixin column_link(value, href, newWindow) if value a(href=href, target=newWindow ? '_blank' : undefined)= value mixin column_gravatar(src) img(src=src).img-thumbnail mixin column_boolean(value) if (value) img(src='/landmark/images/icons/16/checkbox-checked.png', width=16, height=16) else img(src='/landmark/images/icons/16/checkbox-unchecked.png', width=16, height=16) mixin column_html(value) div.col-value!= value mixin column_basic(value) div.col-value= value