コード例 #1
0
ファイル: wpsprocess.py プロジェクト: KatiRG/pyramid-phoenix
    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} )))
コード例 #2
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} )))
コード例 #3
0
ファイル: __init__.py プロジェクト: KatiRG/pyramid-phoenix
 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)
コード例 #4
0
ファイル: __init__.py プロジェクト: KatiRG/pyramid-phoenix
 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} )))
コード例 #5
0
ファイル: grid.py プロジェクト: TeriForey/fawkes
        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)
コード例 #6
0
ファイル: grid.py プロジェクト: bird-house/pyramid-phoenix
        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
ファイル: grid.py プロジェクト: TeriForey/fawkes
 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
             })))
コード例 #8
0
ファイル: grid.py プロジェクト: TeriForey/fawkes
 def render_td(self, renderer, **data):
     mytemplate = self.lookup.get_template(renderer)
     return HTML.td(HTML.literal(mytemplate.render(**data)))
コード例 #9
0
ファイル: __init__.py プロジェクト: KatiRG/pyramid-phoenix
 def render_td(self, renderer, **data):
     mytemplate = mylookup.get_template(renderer + ".mako")
     return HTML.td(HTML.literal(mytemplate.render(**data)))