Loading...
<% var filtered_cols = args['_c'] && args['_c'].length != options.columns.length ? options.columns.filter(function(col) { return args['_c'].indexOf('-' + col.name) < 0 }) : options.columns var cols = options.columns.length ? filtered_cols : meta.columns; cols = cols.filter(function(col) { return col.hide !== true}) var form_id = idcount %> <% if(options.rowTemplate) { %> <% _.each(data, function(row) { %> <%= typeof options.rowTemplate == 'function' ? options.rowTemplate(row, data) : options.rowTemplate %> <% }) %> <% } else {%> <% _.each(cols, function(colinfo) { col_defaults(colinfo, data) var menu_item = false var col_id = idcount++ %> <% }) %> <% _.each(data, function(row) { %> <% _.each(cols, function(colinfo) { %> <% var fmt = typeof(colinfo.format), val = row[colinfo.name], disp = fmt == "function" ? colinfo.format(row, data) : fmt === "string" && colinfo.type === "number" ? numeral(val).format(colinfo.format) : fmt === "string" && colinfo.type === "date" ? moment(val).format(colinfo.format): val, col_link %> <% if('link' in colinfo) col_link = typeof colinfo.link == 'function' ? colinfo.link(row) : _.template(colinfo.link)(row) %> <% if(colinfo.template) { %> <%= typeof colinfo.template == 'function' ? colinfo.template(val, disp, col_link, data) : colinfo.template %> <% } else if (col_link) { %> <% } else { %> <% } %> <% }) %> <% }) %>
<%= disp %> <%= disp %>
<% } %> <% var page = 1 + Math.floor(meta.offset / meta.limit), last_page = 'count' in meta ? Math.floor((meta.count + meta.limit - 1) / meta.limit) : meta.rows < meta.limit ? page : null, lo = Math.max(page - 2, 1), hi = last_page !== null ? Math.min(last_page, page + 2) : page + 2 %>
<% if (meta.limit) { %>
<% } %> <% if ('count' in meta) { %> <%- meta.count %> rows <% } %>
<% var qparts = parse('?') %> <% _.each(args['_c'], function(col_name) { %> <% qparts.update({_c: col_name}, 'add') %> <% var hide_col = col_name[0] == '-' %> <% var display_name = hide_col ? col_name.slice(1) : col_name %> <%- display_name %> <% }) %> <% _.each(args, function(list_values, key) { %> <% if (key.charAt(0) !== '_' && key !== 'c') { %> <% _.each(args[key], function(col_name) { %> <% var update = {}; update[key] = col_name; qparts.update(update) %> <%- key %> = <%- col_name %> <% }) %> <% } %> <% }) %> <% qparts = qparts.toString() %> <% if (qparts && qparts != '?') { %> × <% } %>
<% var filtered_cols = args['_c'] && args['_c'].length != options.columns.length ? options.columns.filter(function(col) { return args['_c'].indexOf('-' + col.name) < 0 }) : options.columns var cols = options.columns.length ? filtered_cols : meta.columns var form_id = idcount var img = (options.icon) ? options.icon : 'http://icons.iconarchive.com/icons/mazenl77/NX11/256/Folder-Default-icon.png' %> <% if(options.rowTemplate) { %> <% _.each(data, function(row) { %> <%= typeof options.rowTemplate == 'function' ? options.rowTemplate(row, data) : options.rowTemplate %> <% }) %> <% } else {%>
<% _.each(data, function(row) { %>
<% if (img.indexOf('fa ') >= 0) { %> <% } else { %> <% } %>
<% _.each(cols, function(colinfo) { %> <% var fmt = typeof(colinfo.format), val = row[colinfo.name], disp = fmt == "function" ? colinfo.format(row, data) : fmt === "string" && colinfo.type === "number" ? numeral(val).format(colinfo.format) : fmt === "string" && colinfo.type === "date" ? moment(val).format(colinfo.format): val %>
<%= colinfo.name %>: <% if ('link' in colinfo) { var col_link = typeof colinfo.link == 'function' ? colinfo.link(val) : _.template(colinfo.link)(row) %> <%= disp %> <% } else { %> <%= disp %> <% } %>
<% }) %>
<% }) %>
<% } %>