コード例 #1
0
ファイル: datatables.py プロジェクト: 9ae/djv
    def tree(self):
        z = []
        z += h.table(id=self.id,
                     class_='display',
                     cellspacing='0',
                     width='100%')
        if self.use_index_column:
            js_headers = json.dumps([{
                'title': item
            } for item in ([''] + self.headers)],
                                    ensure_ascii=False,
                                    encoding='utf8')
            js_data = json.dumps([([''] + row) for row in self.data],
                                 ensure_ascii=False,
                                 encoding='utf8')
        else:
            js_headers = json.dumps([{
                'title': item
            } for item in self.headers],
                                    ensure_ascii=False,
                                    encoding='utf8')
            js_data = json.dumps(self.data,
                                 ensure_ascii=False,
                                 encoding='utf8')
        js = '''\
$(document).ready(function() {
    var data = %(js_data)s;
    var headers = %(js_headers)s;
    var t = $('#%(id)s').DataTable({
        "data": data,
        "columns": headers,
        "columnDefs": [ {
            "searchable": false,
            "orderable": false,
            "targets": 0,
        } ],
        "order": [[ 1, 'asc' ]],
        "dom": 'lfTC<"clear">rtip',
        "tableTools": {
            "sSwfPath": "/static/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf"
        },
        "lengthMenu": [[-1, 25], ["All", 25]],
        "autoWidth": false,
    });
    //new $.fn.dataTable.FixedHeader( t , {
    //    "offsetTop": 50
    //    });
    t.on( 'order.dt search.dt', function () {
        t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
            cell.innerHTML = i+1;
        } );
    } ).draw();
} );
''' % {
            'js_data': js_data,
            'js_headers': js_headers,
            'id': self.id,
        }
        z += h.script(js, type='text/javascript')
        return z
コード例 #2
0
def gen_html():
    if "id" in form:
        body = single_message()
    else:
        body = list_messages()

    return html.html(
        html.head(html.title("a858 auto-analysis"),
                  html.script(language='javascript', src='functions.js')),
        body)
コード例 #3
0
 def getCsvButton(self):
     '''Return a 'Download CSV' button that can be used on the page
        Uses a hidden field called 'csv'
        Uses javascript to reset the value of that field.
     '''
     from html import input, script
     reset_js = 'function(){document.form1.csv.value=0}'
     return script('setInterval(%s,''500)') % reset_js + \
            input(name='csv', type='hidden', value='0') + \
            input(name='csv_button', value='Download CSV', type='button',
                  class_='btn btn-info btn-xs',
                  onClick='document.form1.csv.value=1; submit();')
コード例 #4
0
ファイル: htmlpage.py プロジェクト: dlink/vweb
 def getCsvButton(self, additional_classes=''):
     '''Return a 'Download CSV' button that can be used on the page
        Uses a hidden field called 'csv'
        Uses javascript to reset the value of that field.
     '''
     from html import input, script
     reset_js = 'function(){document.form1.csv.value=0}'
     return script('setInterval(%s,''500)') % reset_js + \
            input(name='csv', type='hidden', value='0') + \
            input(name='csv_button', value='Download CSV', type='button',
                  class_='btn btn-info btn-xs' + ' ' + additional_classes,
                  onClick='document.form1.csv.value=1; submit();')
コード例 #5
0
ファイル: index.py プロジェクト: SinSiXX/A858nalyze
def gen_html():
	if "id" in form:
		body = single_message()
	else:
		body = list_messages()

	return html.html(
		html.head(
			html.title("a858 auto-analysis"),
			html.script(language='javascript', src='functions.js')
		),
		body
	)
コード例 #6
0
ファイル: main.py プロジェクト: banthar/code-review
def html_page(title, *content, **arguments):
    head = html.head(
        html.link(rel="shortcut icon", href=config["favicon"]),
        html.title("{} - {}".format(title, config["title"])),
        html.style(style),
    )
    nav = html.nav(
        html.ul(
            html.li(html.a("⚗", href=html.absolute())),
            html.li(html.a("Reviews", href=html.absolute("reviews"))),
            html.li(html.a("Commits", href=html.absolute("commits", repo.head.ref.name))),
            html.li(html.a("Tree", href=html.absolute("tree", repo.head.ref.name))),
            html.li(html.a("Refs", href=html.absolute("refs"))),
        )
    )
    return http.Html(html.html(head, html.body(*((nav,) + content + (html.script(script),)), **arguments)))
コード例 #7
0
ファイル: datatables.py プロジェクト: algobunny/djv
    def tree(self):
        z = []
        z += h.table(id=self.id, class_='display', cellspacing='0', width='100%')
        if self.use_index_column:
            js_headers = json.dumps([{'title': item} for item in ([''] + self.headers)],
                    ensure_ascii=False, encoding='utf8')
            js_data = json.dumps([([''] + row) for row in self.data], ensure_ascii=False, encoding='utf8')
        else:
            js_headers = json.dumps([{'title': item} for item in self.headers],
                    ensure_ascii=False, encoding='utf8')
            js_data = json.dumps(self.data, ensure_ascii=False, encoding='utf8')
        js = '''\
$(document).ready(function() {
    var data = %(js_data)s;
    var headers = %(js_headers)s;
    var t = $('#%(id)s').DataTable({
        "data": data,
        "columns": headers,
        "columnDefs": [ {
            "searchable": false,
            "orderable": false,
            "targets": 0,
        } ],
        "order": [[ 1, 'asc' ]],
        "dom": 'lfTC<"clear">rtip',
        "tableTools": {
            "sSwfPath": "/static/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf"
        },
        "lengthMenu": [[-1, 25], ["All", 25]],
        "autoWidth": false,
    });
    //new $.fn.dataTable.FixedHeader( t , {
    //    "offsetTop": 50
    //    });
    t.on( 'order.dt search.dt', function () {
        t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
            cell.innerHTML = i+1;
        } );
    } ).draw();
} );
''' % {
    'js_data': js_data,
    'js_headers': js_headers,
    'id': self.id,
}
        z += h.script(js, type='text/javascript')
        return z
コード例 #8
0
ファイル: app.py プロジェクト: kitsu/PyQt4_CLJS
 def get_scripts(self):
     """Create the main script tag."""
     scripts = list()
     scripts.append(html.script(url=get_resource_path('main.js')))
     return "".join(scripts)
コード例 #9
0
ファイル: external.py プロジェクト: 9ae/djv
 def tree(self):
     z = []
     for script in scripts:
         z += h.script(src=script)
     return z
コード例 #10
0
ファイル: external.py プロジェクト: algobunny/djv
 def tree(self):
     z = []
     for script in scripts:
         z += h.script(src=script)
     return z