PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/templates/external_services/generic_jquery_grid.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 59 lines | 55 code | 4 blank | 0 comment | 4 complexity | c862cc771efc500d52c32f48dd3cb4db MD5 | raw file
 1<%inherit file="/base.mako"/>
 2<%namespace file="json_common.mako" import="display_item" />
 3
 4<%def name="title()">${param_dict['service_instance'].name}: ${action.label}</%def>
 5
 6<%def name="display_json_grid_result( headers, rows )">
 7    %for row in rows:
 8        %for name in headers:
 9            <div class="form-row">
10                <label>${name}</label>
11                ${display_item( row.get( name ) )}
12                <div style="clear: both"></div>
13            </div>
14        %endfor
15    %endfor
16</%def>
17
18<%
19    #HACK!!!! need to use better method of displaying jqGrid here, needs to allow paging as optionally available.
20    if 'Rows' in result: #paged
21        records = result['Records']
22        total = result['Total']
23        rows = result['Rows']
24        page = result['Page']
25    else:
26        rows = result
27        records = None
28        total = None
29        page = None
30    headers = rows[0].keys()
31%>
32
33<div class="toolForm">
34    <div class="toolFormTitle">${action.label} of ${param_dict['service_instance'].name} (${param_dict['service'].name}) on ${param_dict['item'].name}</div>
35    <div class="toolFormBody">
36        %if records:
37            <div class="form-row">
38                <label>Records</label>
39                ${records}
40                <div style="clear: both"></div>
41            </div>
42        %endif
43        %if total:
44            <div class="form-row">
45                <label>Total</label>
46                ${total}
47                <div style="clear: both"></div>
48            </div>
49        %endif
50        %if page:
51            <div class="form-row">
52                <label>Page</label>
53                ${page}
54                <div style="clear: both"></div>
55            </div>
56        %endif
57        ${display_json_grid_result( headers, rows )}
58    </div>
59</div>