def render_timestamp_td(self, timestamp): import datetime if timestamp is None: return HTML.td('') if type(timestamp) is not datetime.datetime: from dateutil import parser as datetime_parser timestamp = datetime_parser.parse(str(timestamp)) span_class = 'due-date badge' span = HTML.tag( "span", c=HTML.literal(timestamp.strftime('%Y-%m-%d %H:%M:%S')), class_=span_class, ) return HTML.td(span)
def _column_format(column_number, i, record): from webhelpers2.number import format_byte_size size_in_bytes = get_value(record, attribute) size = '' if size_in_bytes is not None: size = format_byte_size(size_in_bytes) return HTML.td(size)
def _column_format(column_number, i, record): from webhelpers2.number import format_byte_size size_in_bytes = get_value(record, attribute) size = '' if size_in_bytes is not None: size = format_byte_size(size_in_bytes) return HTML.td(size)
def _column_format(column_number, i, record): import datetime timestamp = get_value(record, attribute) if timestamp is None: return HTML.td('') if type(timestamp) is not datetime.datetime: from dateutil import parser as datetime_parser timestamp = datetime_parser.parse(str(timestamp)) span_class = 'due-date badge' span = HTML.tag( "span", c=HTML.literal(timestamp.strftime('%Y-%m-%d %H:%M:%S')), class_=span_class, ) return HTML.td(span)
def _column_format(column_number, i, record): # TODO: avoid database access ... maybe store additional info at job userid = get_value(record, attribute) label = 'Unknown' if userid: user = self.request.db.users.find_one(dict(identifier=userid)) if user: label = user.get('login_id') return HTML.td(label)
def _column_format(column_number, i, record): import datetime timestamp = get_value(record, attribute) if timestamp is None: return HTML.td('') if type(timestamp) is not datetime.datetime: from dateutil import parser as datetime_parser timestamp = datetime_parser.parse(str(timestamp)) span_class = 'due-date badge' span = HTML.tag( "span", c=HTML.literal(timestamp.strftime('%Y-%m-%d %H:%M:%S')), class_=span_class, ) return HTML.td(span)
def _column_format(column_number, i, record): # TODO: avoid database access ... maybe store additional info at job userid = get_value(record, attribute) label = 'Unknown' if userid: user = self.request.db.users.find_one(dict(identifier=userid)) if user: label = user.get('login_id') return HTML.td(label)
def group_td(self, col_num, i, item): from webhelpers2.html.builder import HTML group = item.get('group') label = "???" if group == Admin: label = "Admin" elif group == User: label = "User" elif group == Guest: label = "Guest" return HTML.td(label)
def selected_td(self, col_num, i, item): from string import Template from webhelpers2.html.builder import HTML icon_class = "glyphicon glyphicon-thumbs-down" if item['selected'] == True: icon_class = "glyphicon glyphicon-thumbs-up" div = Template("""\ <button class="btn btn-mini select" data-value="${identifier}"><i class="${icon_class}"></i></button> """) return HTML.td(HTML.literal(div.substitute({'identifier': item['identifier'], 'icon_class': icon_class} )))
def selected_td(self, col_num, i, item): from string import Template from webhelpers2.html.builder import HTML icon_class = "glyphicon glyphicon-thumbs-down" if item.get('selected') == True: icon_class = "glyphicon glyphicon-thumbs-up" div = Template("""\ <a class="select" data-value="${recordid}" href="#"><i class="${icon_class}"></i></a> """) return HTML.td(HTML.literal(div.substitute({'recordid': item['identifier'], 'icon_class': icon_class} )))
def group_td(self, col_num, i, item): from webhelpers2.html.builder import HTML group = item.get('group') label = "???" if group == Admin: label = "Admin" elif group == Developer: label = "Developer" elif group == User: label = "User" elif group == Guest: label = "Guest" return HTML.td(label)
def render_format_td(self, format, source): span_class = 'label' if format is None: format = 'unknown' if 'wps' in format.lower(): span_class += ' label-warning' elif 'wms' in format.lower(): span_class += ' label-info' elif 'netcdf' in format.lower(): span_class += ' label-success' else: span_class += ' label-default' anchor = string.Template("""\ <a class="${span_class}" href="${source}" data-format="${format}">${format}</a> """) return HTML.td(HTML.literal(anchor.substitute( {'source': source, 'span_class': span_class, 'format': format} )))
def render_format_td(self, format, source): span_class = 'label' if format is None: format = 'unknown' if 'wps' in format.lower(): span_class += ' label-warning' elif 'wms' in format.lower(): span_class += ' label-info' elif 'netcdf' in format.lower(): span_class += ' label-success' else: span_class += ' label-default' anchor = string.Template("""\ <a class="${span_class}" href="${source}" data-format="${format}">${format}</a> """) return HTML.td( HTML.literal( anchor.substitute({ 'source': source, 'span_class': span_class, 'format': format })))
def _column_format(column_number, i, record): label = get_value(record, attribute, default or "Missing") return HTML.td(label)
def _column_format(column_number, i, record): from phoenix.utils import time_ago_in_words timestamp = get_value(record, attribute) return HTML.td(time_ago_in_words(timestamp))
def render_td(self, renderer, **data): mytemplate = mylookup.get_template(renderer + ".mako") return HTML.td(HTML.literal(mytemplate.render(**data)))
def _column_format(column_number, i, record): from phoenix.utils import time_ago_in_words timestamp = get_value(record, attribute) return HTML.td(time_ago_in_words(timestamp))
def _column_format(column_number, i, record): label = get_value(record, attribute, default or "Missing") return HTML.td(label)
def render_td(self, renderer, **data): mytemplate = self.lookup.get_template(renderer) return HTML.td(HTML.literal(mytemplate.render(**data)))
def checkbox_column_format(self, column_number, i, record): return HTML.td( checkbox(name="children", value=record.get('identifier'), title="Select item"))
def checkbox_column_format(self, column_number, i, record): return HTML.td(checkbox(name="children", value=record.get('identifier'), title="Select item"))