Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
        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)
Пример #5
0
 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)
Пример #6
0
        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)
Пример #7
0
 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)
Пример #8
0
 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)
Пример #9
0
    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} )))
Пример #10
0
    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} )))
Пример #11
0
 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)
Пример #12
0
 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} )))
Пример #13
0
 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
             })))
Пример #14
0
 def _column_format(column_number, i, record):
     label = get_value(record, attribute, default or "Missing")
     return HTML.td(label)
Пример #15
0
 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))
Пример #16
0
 def render_td(self, renderer, **data):
     mytemplate = mylookup.get_template(renderer + ".mako")
     return HTML.td(HTML.literal(mytemplate.render(**data)))
Пример #17
0
 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))
Пример #18
0
 def _column_format(column_number, i, record):
     label = get_value(record, attribute, default or "Missing")
     return HTML.td(label)
Пример #19
0
 def render_td(self, renderer, **data):
     mytemplate = self.lookup.get_template(renderer)
     return HTML.td(HTML.literal(mytemplate.render(**data)))
Пример #20
0
 def checkbox_column_format(self, column_number, i, record):
     return HTML.td(
         checkbox(name="children",
                  value=record.get('identifier'),
                  title="Select item"))
Пример #21
0
 def checkbox_column_format(self, column_number, i, record):
     return HTML.td(checkbox(name="children", value=record.get('identifier'), title="Select item"))