Add new "v3" grids, refactor all views to use them

or at least that's the idea..hopefully we caught them all
This commit is contained in:
Lance Edgar 2017-07-07 09:13:53 -05:00
parent f244c2934b
commit 5b1ae27a10
71 changed files with 2679 additions and 2030 deletions

View file

@ -150,6 +150,7 @@
${h.stylesheet_link(request.static_url('tailbone:static/css/filters.css'))}
${h.stylesheet_link(request.static_url('tailbone:static/css/forms.css'))}
${h.stylesheet_link(request.static_url('tailbone:static/css/newgrids.css'))}
${h.stylesheet_link(request.static_url('tailbone:static/css/grids3.css'))}
</%def>
<%def name="jquery_smoothness_theme()">

View file

@ -1,8 +1,8 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/index.mako" />
## -*- coding: utf-8; -*-
<%inherit file="/master2/index.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<%def name="extra_javascript()">
${parent.extra_javascript()}
<script type="text/javascript">
$(function() {

View file

@ -0,0 +1,21 @@
## -*- coding: utf-8; -*-
<div class="newgrid grid3 full">
<table>
${grid.make_webhelpers_grid()}
</table>
% if grid.pageable and grid.pager:
<div class="pager">
<p class="showing">
${"showing {} thru {} of {:,d}".format(grid.pager.first_item, grid.pager.last_item, grid.pager.item_count)}
% if grid.pager.page_count > 1:
${"(page {} of {:,d})".format(grid.pager.page, grid.pager.page_count)}
% endif
</p>
<p class="page-links">
${h.select('pagesize', grid.pager.items_per_page, grid.get_pagesize_options())}
per page&nbsp;
${grid.pager.pager('$link_first $link_previous ~1~ $link_next $link_last', symbol_next='next', symbol_previous='prev')|n}
</p>
</div>
% endif
</div>

View file

@ -0,0 +1,55 @@
## -*- coding: utf-8; -*-
## ##############################################################################
##
## Default master 'index' template. Features a prominent data table and
## exposes a way to filter and sort the data, etc. Some index pages also
## include a "tools" section, just above the grid on the right.
##
## ##############################################################################
<%inherit file="/master/index.mako" />
<%def name="title()">${model_title_plural}</%def>
<%def name="context_menu_items()">
% if master.creatable and request.has_perm('{}.create'.format(permission_prefix)):
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
% endif
</%def>
## ${grid.render_complete(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n}
<div class="newgrid-wrapper">
<table class="grid-header">
<tbody>
<tr>
<td class="filters" rowspan="2">
% if grid.filterable:
## TODO: should this be variable sometimes?
${grid.render_filters(allow_save_defaults=True)|n}
% endif
</td>
<td class="menu">
<ul id="context-menu">
${self.context_menu_items()}
</ul>
</td>
</tr>
<tr>
<td class="tools">
<div class="grid-tools">
${self.grid_tools()}
</div><!-- grid-tools -->
</td>
</tr>
</tbody>
</table><!-- grid-header -->
${grid.render_grid()|n}
</div><!-- newgrid-wrapper -->

View file

@ -1,10 +1,10 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8; -*-
<%inherit file="/messages/index.mako" />
<%def name="title()">Message Archive</%def>
<%def name="head_tags()">
${parent.head_tags()}
<%def name="extra_javascript()">
${parent.extra_javascript()}
<script type="text/javascript">
destination = "Inbox";
</script>

View file

@ -3,8 +3,8 @@
<%def name="title()">Message Inbox</%def>
<%def name="head_tags()">
${parent.head_tags()}
<%def name="extra_javascript()">
${parent.extra_javascript()}
<script type="text/javascript">
destination = "Archive";
</script>

View file

@ -1,14 +1,14 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/index.mako" />
## -*- coding: utf-8; -*-
<%inherit file="/master2/index.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<%def name="extra_javascript()">
${parent.extra_javascript()}
<script type="text/javascript">
var destination = null;
function update_move_button() {
var count = $('.newgrid tbody td.checkbox input:checked').length;
var count = $('.newgrid tr:not(.header) td.checkbox input:checked').length;
$('form[name="move-selected"] button')
.button('option', 'label', "Move " + count + " selected to " + destination)
.button('option', 'disabled', count < 1);
@ -18,17 +18,17 @@
update_move_button();
$('.newgrid-wrapper').on('click', 'thead th.checkbox input', function() {
$('.newgrid-wrapper').on('change', 'tr.header td.checkbox input', function() {
update_move_button();
});
$('.newgrid-wrapper').on('click', 'tbody td.checkbox input', function() {
$('.newgrid-wrapper').on('click', 'tr:not(.header) td.checkbox input', function() {
update_move_button();
});
$('form[name="move-selected"]').submit(function() {
var uuids = [];
$('.newgrid tbody td.checkbox input:checked').each(function() {
$('.newgrid tr:not(.header) td.checkbox input:checked').each(function() {
uuids.push($(this).parents('tr:first').data('uuid'));
});
if (! uuids.length) {

View file

@ -1,8 +1,30 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/view.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<%def name="extra_javascript()">
${parent.extra_javascript()}
<script type="text/javascript">
$(function() {
$('.field-wrapper.recipients .more').click(function() {
$(this).hide();
$(this).siblings('.everyone').css('display', 'inline-block');
return false;
});
$('.field-wrapper.recipients .everyone').click(function() {
$(this).hide();
$(this).siblings('.more').show();
});
});
</script>
</%def>
<%def name="extra_styles()">
${parent.extra_styles()}
<style type="text/css">
.field-wrapper.recipients .everyone {
cursor: pointer;
@ -22,24 +44,6 @@
margin-bottom: 15px;
}
</style>
<script type="text/javascript">
$(function() {
$('.field-wrapper.recipients .more').click(function() {
$(this).hide();
$(this).siblings('.everyone').css('display', 'inline-block');
return false;
});
$('.field-wrapper.recipients .everyone').click(function() {
$(this).hide();
$(this).siblings('.more').show();
});
});
</script>
</%def>
<%def name="context_menu_items()">

View file

@ -0,0 +1,7 @@
## -*- coding: utf-8; -*-
% if grid.filterable:
${grid.render_filters()|n}
% endif
${grid.render_grid()|n}

View file

@ -1,13 +1,7 @@
## -*- coding: utf-8; -*-
% if grid.filterable:
${grid.render_filters()|n}
% endif
<ul data-role="listview">
% for obj in grid.iter_rows():
<li>${grid.listitem.render_readonly()}</li>
% endfor
${grid.make_webhelpers_grid()}
</ul>
## <table data-role="table" class="ui-responsive table-stroke">

View file

@ -1,3 +1,4 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/index.mako" />
## -*- coding: utf-8; -*-
<%inherit file="/master2/index.mako" />
${parent.body()}

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/index.mako" />
## -*- coding: utf-8; -*-
<%inherit file="/master2/index.mako" />
<%def name="context_menu_items()">
${parent.context_menu_items()}

View file

@ -1,8 +1,8 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/index.mako" />
<%inherit file="/master2/index.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<%def name="extra_styles()">
${parent.extra_styles()}
<style type="text/css">
table.label-printing th {
@ -32,6 +32,10 @@
}
</style>
</%def>
<%def name="extra_javascript()">
${parent.extra_javascript()}
% if label_profiles and request.has_perm('products.print_labels'):
<script type="text/javascript">