Final grid refactor for all templates and CSS/JS (newgrid -> grid)

This commit is contained in:
Lance Edgar 2017-07-14 21:15:22 -05:00
parent c57e2e17cc
commit 292546e44b
26 changed files with 329 additions and 687 deletions

View file

@ -1,179 +1,278 @@
/********************************************************************************
* grids.css
*
* Style tweaks for the new grids.
********************************************************************************/
/******************************
* Grid Header
* header table
******************************/
table.grid-header {
padding-bottom: 5px;
.grid-wrapper .grid-header td.filters {
vertical-align: bottom;
width: 100%;
}
.grid-wrapper .grid-header td.menu {
padding: 0.5em;
vertical-align: top;
white-space: nowrap;
}
/******************************
* Form (Filters etc.)
******************************/
table.grid-header td.form {
.grid-wrapper .grid-header td.tools {
margin: 0;
padding: 0;
vertical-align: bottom;
white-space: nowrap;
}
.grid-wrapper .grid-header td.tools p {
line-height: 2em;
margin: 0;
padding: 0 0.5em 0 0;
}
.grid-wrapper .grid-header td.tools form {
display: inline-block;
}
/******************************
* Context Menu
* filters
******************************/
table.grid-header td.context-menu {
.grid-wrapper .newfilters {
margin: 0;
}
.grid-wrapper .newfilters fieldset {
margin: 0;
padding: 1px 5px 5px 5px;
width: 80%;
}
.grid-wrapper .newfilters .filter {
margin-bottom: 2px;
}
.grid-wrapper .newfilters .filter:last-child {
margin-bottom: 0;
}
.grid-wrapper .newfilters .filter .toggle {
margin: 0;
text-align: left;
width: 15em;
}
.grid-wrapper .newfilters .ui-button-text {
line-height: 1.4em;
}
.grid-wrapper .ui-button-text-icon-primary .ui-button-text {
padding: 0.2em 1em 0.2em 2.1em;
}
.grid-wrapper .ui-selectmenu-button .ui-selectmenu-text {
padding: 0.2em 2.1em 0.2em 1em;
}
.grid-wrapper .newfilters .filter label {
font-weight: bold;
padding: 0.4em 0.2em;
position: relative;
top: -14px;
}
.grid-wrapper .newfilters .filter .value {
display: inline-block;
vertical-align: top;
}
table.grid-header td.context-menu ul {
list-style-type: none;
margin: 0px;
text-align: right;
.grid-wrapper .newfilters .filter .value input {
height: 19px;
}
table.grid-header td.context-menu ul li {
line-height: 2em;
.grid-wrapper .newfilters .filter .inputs {
display: inline-block;
/* TODO: Would be nice not to hard-code a height here... */
height: 26px;
vertical-align: top;
}
/******************************
* Tools
******************************/
table.grid-header td.tools {
padding-bottom: 10px;
text-align: right;
vertical-align: bottom;
.grid-wrapper .newfilters .buttons {
margin: 0.5em 0 0 0;
padding: 0;
}
table.grid-header td.tools div.buttons button {
margin-left: 5px;
.grid-wrapper .newfilters #add-filter-button {
margin-right: 5px;
vertical-align: middle;
}
/******************************
* Grid
* table
******************************/
div.grid {
.grid {
clear: both;
margin-top: 1em;
}
div.grid table {
background-color: White;
border-top: 1px solid black;
border-left: 1px solid black;
.grid.no-border {
margin-top: 0;
}
.grid table {
background-color: white;
border: 1px solid black;
border-collapse: collapse;
font-size: 9pt;
font-size: 10pt;
line-height: normal;
white-space: nowrap;
}
div.grid.full table {
.grid.full table {
width: 100%;
}
div.grid.no-border table {
.grid.half table {
width: 50%;
}
.grid.no-border table {
border-left: none;
border-top: none;
}
div.grid table th,
div.grid table td {
/******************************
* thead
******************************/
.grid tr.header td {
border-right: 1px solid black;
border-bottom: 1px solid black;
font-weight: bold;
padding: 2px 3px;
text-align: center;
}
div.grid table th.sortable a {
/* .grid table thead th:last-child { */
/* border-right: none; */
/* } */
.grid tr.header a {
display: block;
padding-right: 18px;
}
div.grid table th.sorted {
.grid tr.header .asc,
.grid tr.header .dsc {
background-position: right center;
background-repeat: no-repeat;
}
div.grid table th.sorted.asc {
.grid tr.header .asc {
background-image: url(../img/sort_arrow_up.png);
}
div.grid table th.sorted.desc {
.grid tr.header .dsc {
background-image: url(../img/sort_arrow_down.png);
}
div.grid table tbody td {
text-align: left;
/******************************
* tbody
******************************/
.grid tbody td {
padding: 5px 6px;
}
div.grid table tbody td.center {
text-align: center;
.grid.selectable tbody td {
cursor: default;
}
div.grid table tbody td.right {
float: none;
text-align: right;
}
div.grid table tr.odd {
.grid tr.odd {
background-color: #e0e0e0;
}
div.grid table tbody tr.hovering {
.grid tr:not(.header).hovering {
background-color: #bbbbbb;
}
div.grid table tbody tr td.checkbox {
.grid tr:not(.header).warning.odd {
background-color: #fcc;
}
.grid tr:not(.header).warning.even {
background-color: #ebb;
}
.grid tr:not(.header).warning.hovering {
background-color: #daa;
}
.grid tr:not(.header).notice.odd {
background-color: #fe8;
}
.grid tr:not(.header).notice.even {
background-color: #fd6;
}
.grid tr:not(.header).notice.hovering {
background-color: #ec7;
}
.grid tr:not(.header) td.checkbox {
text-align: center;
}
div.grid table tbody tr td.view,
div.grid table tbody tr td.edit,
div.grid table tbody tr td.save,
div.grid table tbody tr td.delete {
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
min-width: 18px;
text-align: center;
width: 18px;
/******************************
* main actions
******************************/
.grid .actions {
width: 1px;
}
div.grid table tbody tr td.view {
background-image: url(../img/view.png);
.grid .actions a {
margin: 0 5px 0 0;
position: relative;
top: -2px;
}
div.grid table tbody tr td.edit {
background-image: url(../img/edit.png);
.grid .actions a:last-child {
margin: 0;
}
div.grid table tbody tr td.save {
background-image: url(../img/save.png);
.grid .actions .ui-icon {
display: inline-block;
position: relative;
top: 3px;
}
div.grid table tbody tr td.delete {
background-image: url(../img/delete.png);
/******************************
* more actions
******************************/
.grid .actions div.more {
background-color: white;
border: 1px solid black;
display: none;
padding: 3px 10px 3px 5px;
position: absolute;
z-index: 1;
}
div.pager {
margin-bottom: 20px;
margin-top: 5px;
}
div.pager p {
font-size: 10pt;
margin: 0px;
}
div.pager p.showing {
float: left;
}
div.pager #grid-page-count {
font-size: 8pt;
}
div.pager p.page-links {
float: right;
.grid .actions .more a {
display: block;
padding: 2px 0;
}

View file

@ -1,75 +0,0 @@
/********************************************************************************
* grids3.css
*
* Style tweaks for the new grids.
********************************************************************************/
/******************************
* thead
******************************/
.grid3 tr.header td {
border-right: 1px solid black;
border-bottom: 1px solid black;
font-weight: bold;
padding: 2px 3px;
text-align: center;
}
.grid3 tr.header a {
display: block;
padding-right: 18px;
}
.grid3 tr.header .asc,
.grid3 tr.header .dsc {
background-position: right center;
background-repeat: no-repeat;
}
.grid3 tr.header .asc {
background-image: url(../img/sort_arrow_up.png);
}
.grid3 tr.header .dsc {
background-image: url(../img/sort_arrow_down.png);
}
/******************************
* tbody
******************************/
.grid3 tr.odd {
background-color: #e0e0e0;
}
.newgrid.grid3 tr:not(.header).hovering {
background-color: #bbbbbb;
}
.newgrid.grid3 tr:not(.header).warning.odd {
background-color: #fcc;
}
.newgrid.grid3 tr:not(.header).warning.even {
background-color: #ebb;
}
.newgrid.grid3 tr:not(.header).warning.hovering {
background-color: #daa;
}
.newgrid.grid3 tr:not(.header).notice.odd {
background-color: #fe8;
}
.newgrid.grid3 tr:not(.header).notice.even {
background-color: #fd6;
}
.newgrid.grid3 tr:not(.header).notice.hovering {
background-color: #ec7;
}

View file

@ -1,275 +0,0 @@
/********************************************************************************
* newgrids.css
*
* Style tweaks for the new grids.
********************************************************************************/
/******************************
* header table
******************************/
.newgrid-wrapper .grid-header td.filters {
vertical-align: bottom;
width: 100%;
}
.newgrid-wrapper .grid-header td.menu {
padding: 0.5em;
vertical-align: top;
white-space: nowrap;
}
.newgrid-wrapper .grid-header td.tools {
margin: 0;
padding: 0;
vertical-align: bottom;
white-space: nowrap;
}
.newgrid-wrapper .grid-header td.tools p {
line-height: 2em;
margin: 0;
padding: 0 0.5em 0 0;
}
.newgrid-wrapper .grid-header td.tools form {
display: inline-block;
}
/******************************
* filters
******************************/
.newgrid-wrapper .newfilters {
margin: 0;
}
.newgrid-wrapper .newfilters fieldset {
margin: 0;
padding: 1px 5px 5px 5px;
width: 80%;
}
.newgrid-wrapper .newfilters .filter {
margin-bottom: 2px;
}
.newgrid-wrapper .newfilters .filter:last-child {
margin-bottom: 0;
}
.newgrid-wrapper .newfilters .filter .toggle {
margin: 0;
text-align: left;
width: 15em;
}
.newgrid-wrapper .newfilters .ui-button-text {
line-height: 1.4em;
}
.newgrid-wrapper .ui-button-text-icon-primary .ui-button-text {
padding: 0.2em 1em 0.2em 2.1em;
}
.newgrid-wrapper .ui-selectmenu-button .ui-selectmenu-text {
padding: 0.2em 2.1em 0.2em 1em;
}
.newgrid-wrapper .newfilters .filter label {
font-weight: bold;
padding: 0.4em 0.2em;
position: relative;
top: -14px;
}
.newgrid-wrapper .newfilters .filter .value {
display: inline-block;
vertical-align: top;
}
.newgrid-wrapper .newfilters .filter .value input {
height: 19px;
}
.newgrid-wrapper .newfilters .filter .inputs {
display: inline-block;
/* TODO: Would be nice not to hard-code a height here... */
height: 26px;
vertical-align: top;
}
.newgrid-wrapper .newfilters .buttons {
margin: 0.5em 0 0 0;
padding: 0;
}
.newgrid-wrapper .newfilters #add-filter-button {
margin-right: 5px;
vertical-align: middle;
}
/******************************
* table
******************************/
.newgrid {
clear: both;
margin-top: 1em;
}
.newgrid.no-border {
margin-top: 0;
}
.newgrid table {
background-color: white;
border: 1px solid black;
border-collapse: collapse;
font-size: 10pt;
line-height: normal;
white-space: nowrap;
}
.newgrid.full table {
width: 100%;
}
.newgrid.half table {
width: 50%;
}
.newgrid.no-border table {
border-left: none;
border-top: none;
}
/******************************
* thead
******************************/
.newgrid table thead th {
border-right: 1px solid black;
border-bottom: 1px solid black;
padding: 2px 3px;
}
.newgrid table thead th:last-child {
border-right: none;
}
.newgrid table thead th.sortable a {
display: block;
padding-right: 18px;
}
.newgrid table thead th.sorted {
background-position: right center;
background-repeat: no-repeat;
}
.newgrid table thead th.sorted.asc {
background-image: url(../img/sort_arrow_up.png);
}
.newgrid table thead th.sorted.desc {
background-image: url(../img/sort_arrow_down.png);
}
/******************************
* tbody
******************************/
.newgrid tbody td {
padding: 5px 6px;
}
.newgrid.selectable tbody td {
cursor: default;
}
/* .newgrid tbody tr:nth-child(odd) { */
/* background-color: #e0e0e0; */
/* } */
/* .newgrid tbody tr.hovering { */
/* background-color: #bbbbbb; */
/* } */
/* .newgrid tbody tr.notice { */
/* background-color: #fd6; */
/* } */
/* .newgrid tbody tr.notice:nth-child(odd) { */
/* background-color: #fe8; */
/* } */
/* .newgrid tbody tr.notice.hovering { */
/* background-color: #ec7; */
/* } */
/* .newgrid tbody tr.warning { */
/* background-color: #fcc; */
/* } */
/* .newgrid tbody tr.warning:nth-child(odd) { */
/* background-color: #ebb; */
/* } */
/* .newgrid tbody tr.warning.hovering { */
/* background-color: #daa; */
/* } */
.newgrid tbody td.checkbox {
text-align: center;
}
/******************************
* main actions
******************************/
.newgrid .actions {
width: 1px;
}
.newgrid .actions a {
margin: 0 5px 0 0;
position: relative;
top: -2px;
}
.newgrid .actions a:last-child {
margin: 0;
}
.newgrid .actions .ui-icon {
display: inline-block;
position: relative;
top: 3px;
}
/******************************
* more actions
******************************/
.newgrid .actions div.more {
background-color: white;
border: 1px solid black;
display: none;
padding: 3px 10px 3px 5px;
position: absolute;
z-index: 1;
}
.newgrid .actions .more a {
display: block;
padding: 2px 0;
}

View file

@ -25,7 +25,7 @@ a {
padding-left: 5em;
}
.newgrid-wrapper .grid-header #context-menu {
.grid-wrapper .grid-header #context-menu {
float: none;
margin: 0;
}

View file

@ -23,7 +23,7 @@
this.default_filters = this.filters.find('#default-filters');
this.clear_filters = this.filters.find('#clear-filters');
this.save_defaults = this.filters.find('#save-defaults');
this.grid = this.element.find('.newgrid');
this.grid = this.element.find('.grid');
// Enhance filters etc.
this.filters.find('.filter').gridfilter();
@ -117,31 +117,17 @@
});
// Refresh data when user clicks a sortable column header.
if (this.grid.hasClass('grid3')) {
this.element.on('click', 'tr.header a', function() {
var td = $(this).parent();
var data = {
sortkey: $(this).data('sortkey'),
sortdir: (td.hasClass('asc')) ? 'desc' : 'asc',
page: 1,
partial: true
};
that.refresh(data);
return false;
});
} else {
this.element.on('click', 'thead th.sortable a', function() {
var th = $(this).parent();
var data = {
sortkey: th.data('sortkey'),
sortdir: (th.hasClass('sorted') && th.hasClass('asc')) ? 'desc' : 'asc',
page: 1,
partial: true
};
that.refresh(data);
return false;
});
}
this.element.on('click', 'tr.header a', function() {
var td = $(this).parent();
var data = {
sortkey: $(this).data('sortkey'),
sortdir: (td.hasClass('asc')) ? 'desc' : 'asc',
page: 1,
partial: true
};
that.refresh(data);
return false;
});
// Refresh data when user chooses a new page size setting.
this.element.on('change', '.pager #pagesize', function() {
@ -167,52 +153,29 @@
});
// do some extra stuff for grids with checkboxes
if (this.grid.hasClass('grid3')) {
// (un-)check all rows when clicking check-all box in header
if (this.grid.find('tr.header td.checkbox input').length) {
this.element.on('click', 'tr.header td.checkbox input', function() {
var checked = $(this).prop('checked');
that.grid.find('tr:not(.header) td.checkbox input').prop('checked', checked);
});
}
// Select current row when clicked, unless clicking checkbox
// (since that already does select the row) or a link (since
// that does something completely different).
this.element.on('click', '.newgrid tr:not(.header) td.checkbox input', function(event) {
event.stopPropagation();
});
this.element.on('click', '.newgrid tr:not(.header) a', function(event) {
event.stopPropagation();
});
this.element.on('click', '.newgrid tr:not(.header)', function() {
$(this).find('td.checkbox input').click();
});
} else if (this.grid.hasClass('selectable')) { // pre-v3 newgrid.selectable
// (Un-)Check all rows when clicking check-all box in header.
this.element.on('click', 'thead th.checkbox input', function() {
// (un-)check all rows when clicking check-all box in header
if (this.grid.find('tr.header td.checkbox input').length) {
this.element.on('click', 'tr.header td.checkbox input', function() {
var checked = $(this).prop('checked');
that.grid.find('tbody td.checkbox input').prop('checked', checked);
that.grid.find('tr:not(.header) td.checkbox input').prop('checked', checked);
});
// Select current row when clicked, unless clicking checkbox
// (since that already does select the row) or a link (since
// that does something completely different).
this.element.on('click', 'tbody td.checkbox input', function(event) {
event.stopPropagation();
});
this.element.on('click', 'tbody a', function(event) {
event.stopPropagation();
});
this.element.on('click', 'tbody tr', function() {
$(this).find('td.checkbox input').click();
});
}
// Select current row when clicked, unless clicking checkbox
// (since that already does select the row) or a link (since
// that does something completely different).
this.element.on('click', '.grid tr:not(.header) td.checkbox input', function(event) {
event.stopPropagation();
});
this.element.on('click', '.grid tr:not(.header) a', function(event) {
event.stopPropagation();
});
this.element.on('click', '.grid tr:not(.header)', function() {
$(this).find('td.checkbox input').click();
});
// Show 'more' actions when user hovers over 'more' link.
this.element.on('mouseenter', '.actions a.more', function() {
that.grid.find('.actions div.more').hide();
@ -238,7 +201,7 @@
this.element.mask("Refreshing data...");
$.get(this.grid.data('url'), settings, function(data) {
that.grid.replaceWith(data);
that.grid = that.element.find('.newgrid');
that.grid = that.element.find('.grid');
that.element.unmask();
});
}
@ -264,7 +227,7 @@
this.checkbox = this.element.find('input[name$="-active"]');
this.label = this.element.find('label');
this.inputs = this.element.find('.inputs');
this.add_filter = this.element.parents('.newgrid-wrapper').find('#add-filter');
this.add_filter = this.element.parents('.grid-wrapper').find('#add-filter');
// Hide the checkbox and label, and add button for toggling active status.
this.checkbox.addClass('ui-helper-hidden-accessible');

View file

@ -10,7 +10,7 @@
$(function() {
$('.newgrid-wrapper').gridwrapper();
$('.grid-wrapper').gridwrapper();
$('#execute-batch').click(function() {
if (has_execution_options) {

View file

@ -149,8 +149,6 @@
${h.stylesheet_link(request.static_url('tailbone:static/css/grids.css'))}
${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,5 +1,5 @@
## -*- coding: utf-8 -*-
<div class="newgrid-wrapper">
<div class="grid-wrapper">
<table class="grid-header">
<tbody>
@ -35,4 +35,4 @@
${grid.render_grid()|n}
</div><!-- newgrid-wrapper -->
</div><!-- grid-wrapper -->

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8; -*-
<div class="newgrid grid3 ${grid_class}">
<div class="grid ${grid_class}">
<table>
${grid.make_webhelpers_grid()}
</table>

View file

@ -1,91 +0,0 @@
## -*- 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="/base.mako" />
<%def name="title()">${grid.model_title_plural}</%def>
<%def name="head_tags()">
${parent.head_tags()}
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))}
<script type="text/javascript">
$(function() {
$('.newgrid-wrapper').gridwrapper();
% if master.mergeable and request.has_perm('{}.merge'.format(permission_prefix)):
$('form[name="merge-things"] button').button('option', 'disabled', $('.newgrid tbody td.checkbox input:checked').length != 2);
$('.newgrid-wrapper').on('click', 'tbody td.checkbox input', function() {
$('form[name="merge-things"] button').button('option', 'disabled', $('.newgrid tbody td.checkbox input:checked').length != 2);
});
$('form[name="merge-things"]').submit(function() {
var uuids = [];
$('.newgrid tbody td.checkbox input:checked').each(function() {
uuids.push($(this).parents('tr:first').data('uuid'));
});
if (uuids.length != 2) {
return false;
}
$(this).find('[name="uuids"]').val(uuids.toString());
$(this).find('button')
.button('option', 'label', "Preparing to Merge...")
.button('disable');
});
% endif
% if master.bulk_deletable and request.has_perm('{}.bulk_delete'.format(permission_prefix)):
$('form[name="bulk-delete"] button').click(function() {
var count = 0;
var match = /showing \d+ thru \d+ of (\S+)/.exec($('.pager .showing').text());
if (match) {
count = match[1];
} else {
alert("There don't seem to be any results to delete!");
return;
}
if (! confirm("You are about to delete " + count + " ${model_title_plural}.\n\nAre you sure?")) {
return
}
$(this).button('disable').button('option', 'label', "Deleting Results...");
$('form[name="bulk-delete"]').submit();
});
% endif
});
</script>
</%def>
<%def name="context_menu_items()">
% if master.creatable and request.has_perm('{}.create'.format(grid.permission_prefix)):
<li>${h.link_to("Create a new {}".format(grid.model_title), url('{}.create'.format(grid.route_prefix)))}</li>
% endif
</%def>
<%def name="grid_tools()">
% if master.mergeable and request.has_perm('{}.merge'.format(permission_prefix)):
${h.form(url('{}.merge'.format(route_prefix)), name='merge-things')}
${h.csrf_token(request)}
${h.hidden('uuids')}
<button type="submit">Merge 2 ${model_title_plural}</button>
${h.end_form()}
% endif
% if master.bulk_deletable and request.has_perm('{}.bulk_delete'.format(permission_prefix)):
${h.form(url('{}.bulk_delete'.format(route_prefix)), name='bulk-delete')}
${h.csrf_token(request)}
<button type="button">Delete Results</button>
${h.end_form()}
% endif
</%def>
${grid.render_complete(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n}

View file

@ -13,7 +13,7 @@
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))}
<script type="text/javascript">
$(function() {
$('.newgrid-wrapper').gridwrapper();
$('.grid-wrapper').gridwrapper();
});
</script>
</%def>

View file

@ -9,11 +9,11 @@
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))}
<script type="text/javascript">
$(function() {
$('.newgrid-wrapper').gridwrapper();
$('.grid-wrapper').gridwrapper();
});
</script>
<style type="text/css">
.newgrid-wrapper {
.grid-wrapper {
margin-top: 10px;
}
</style>

View file

@ -6,19 +6,91 @@
## include a "tools" section, just above the grid on the right.
##
## ##############################################################################
<%inherit file="/master/index.mako" />
<%inherit file="/base.mako" />
<%def name="title()">${model_title_plural}</%def>
<%def name="extra_javascript()">
${parent.extra_javascript()}
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))}
<script type="text/javascript">
$(function() {
$('.grid-wrapper').gridwrapper();
% if master.mergeable and request.has_perm('{}.merge'.format(permission_prefix)):
$('form[name="merge-things"] button').button('option', 'disabled', $('.grid tbody td.checkbox input:checked').length != 2);
$('.grid-wrapper').on('click', 'tbody td.checkbox input', function() {
$('form[name="merge-things"] button').button('option', 'disabled', $('.grid tbody td.checkbox input:checked').length != 2);
});
$('form[name="merge-things"]').submit(function() {
var uuids = [];
$('.grid tbody td.checkbox input:checked').each(function() {
uuids.push($(this).parents('tr:first').data('uuid'));
});
if (uuids.length != 2) {
return false;
}
$(this).find('[name="uuids"]').val(uuids.toString());
$(this).find('button')
.button('option', 'label', "Preparing to Merge...")
.button('disable');
});
% endif
% if master.bulk_deletable and request.has_perm('{}.bulk_delete'.format(permission_prefix)):
$('form[name="bulk-delete"] button').click(function() {
var count = 0;
var match = /showing \d+ thru \d+ of (\S+)/.exec($('.pager .showing').text());
if (match) {
count = match[1];
} else {
alert("There don't seem to be any results to delete!");
return;
}
if (! confirm("You are about to delete " + count + " ${model_title_plural}.\n\nAre you sure?")) {
return
}
$(this).button('disable').button('option', 'label', "Deleting Results...");
$('form[name="bulk-delete"]').submit();
});
% endif
});
</script>
</%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>
<%def name="grid_tools()">
% if master.mergeable and request.has_perm('{}.merge'.format(permission_prefix)):
${h.form(url('{}.merge'.format(route_prefix)), name='merge-things')}
${h.csrf_token(request)}
${h.hidden('uuids')}
<button type="submit">Merge 2 ${model_title_plural}</button>
${h.end_form()}
% endif
% if master.bulk_deletable and request.has_perm('{}.bulk_delete'.format(permission_prefix)):
${h.form(url('{}.bulk_delete'.format(route_prefix)), name='bulk-delete')}
${h.csrf_token(request)}
<button type="button">Delete Results</button>
${h.end_form()}
% endif
</%def>
## ${grid.render_complete(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n}
<div class="newgrid-wrapper">
<div class="grid-wrapper">
<table class="grid-header">
<tbody>
@ -51,5 +123,5 @@
${grid.render_grid()|n}
</div><!-- newgrid-wrapper -->
</div><!-- grid-wrapper -->

View file

@ -8,7 +8,7 @@
var destination = null;
function update_move_button() {
var count = $('.newgrid tr:not(.header) td.checkbox input:checked').length;
var count = $('.grid 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('change', 'tr.header td.checkbox input', function() {
$('.grid-wrapper').on('change', 'tr.header td.checkbox input', function() {
update_move_button();
});
$('.newgrid-wrapper').on('click', 'tr:not(.header) td.checkbox input', function() {
$('.grid-wrapper').on('click', 'tr:not(.header) td.checkbox input', function() {
update_move_button();
});
$('form[name="move-selected"]').submit(function() {
var uuids = [];
$('.newgrid tr:not(.header) td.checkbox input:checked').each(function() {
$('.grid tr:not(.header) td.checkbox input:checked').each(function() {
uuids.push($(this).parents('tr:first').data('uuid'));
});
if (! uuids.length) {

View file

@ -21,7 +21,7 @@
</script>
<style type="text/css">
.newgrid-wrapper {
.grid-wrapper {
margin-top: 10px;
}

View file

@ -25,7 +25,7 @@
${parent.extra_styles()}
<style type="text/css">
.newgrid-wrapper {
.grid-wrapper {
margin-top: 10px;
}

View file

@ -179,7 +179,7 @@ ${h.end_form()}
<%def name="extra_td(cost)"></%def>
<%def name="order_form_grid()">
<div class="newgrid">
<div class="grid">
<table class="order-form">
<% column_count = 8 + len(header_columns) + (0 if ignore_cases else 1) + int(capture(self.extra_count)) %>
% for department in sorted(departments.values(), key=lambda d: d.name if d else ''):

View file

@ -35,7 +35,7 @@
$('#permission').selectmenu();
$('#find-by-perm-form').submit(function() {
$('.newgrid').remove();
$('.grid').remove();
$(this).find('#submit').button('disable').button('option', 'label', "Searching, please wait...");
});
@ -59,7 +59,7 @@ ${h.csrf_token(request)}
${h.end_form()}
% if principals is not None:
<div class="newgrid half">
<div class="grid half">
<br />
<h2>${model_title_plural} with that permission (${len(principals)} total):</h2>
${self.principal_table()}

View file

@ -41,9 +41,9 @@
$(function() {
$('.newgrid-wrapper .grid-header .tools select').selectmenu();
$('.grid-wrapper .grid-header .tools select').selectmenu();
$('.newgrid-wrapper').on('click', 'a.print_label', function() {
$('.grid-wrapper').on('click', 'a.print_label', function() {
var tr = $(this).parents('tr:first');
var quantity = $('table.label-printing #label-quantity');
if (isNaN(quantity.val())) {

View file

@ -154,7 +154,7 @@
<%def name="lookup_codes_panel()">
<div class="panel-grid" id="product-codes">
<h2>Additional Lookup Codes</h2>
<div class="newgrid full no-border">
<div class="grid full no-border">
<table>
<thead>
<th>Seq</th>
@ -176,7 +176,7 @@
<%def name="sources_panel()">
<div class="panel-grid" id="product-costs">
<h2>Vendor Sources</h2>
<div class="newgrid full no-border">
<div class="grid full no-border">
<table>
<thead>
<th>Pref.</th>

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,49 +0,0 @@
## -*- coding: utf-8 -*-
<%inherit file="/mobile/base.mako" />
<%def name="title()">New ${mode_title} Batch</%def>
${h.form(request.current_route_url(), class_='ui-filterable', name='new-purchasing-batch')}
${h.csrf_token(request)}
% if vendor is Undefined:
<div class="field-wrapper vendor">
<div class="field autocomplete" data-url="${url('vendors.autocomplete')}">
${h.hidden('vendor')}
${h.text('new-purchasing-batch-vendor-text', placeholder="Vendor name", autocomplete='off', **{'data-type': 'search'})}
<ul data-role="listview" data-inset="true" data-filter="true" data-input="#new-purchasing-batch-vendor-text"></ul>
<button type="button" style="display: none;">Change Vendor</button>
</div>
</div>
<br />
${h.submit('submit', "Find purchase orders")}
## <button type="button">New receiving from scratch</button>
% else: ## vendor is known
<div class="field-wrapper vendor">
<div class="field">
${h.hidden('vendor', value=vendor.uuid)}
${vendor}
</div>
</div>
% if purchases:
${h.hidden('purchase')}
<ul data-role="listview" data-inset="true">
% for uuid, purchase in purchases:
<li data-uuid="${uuid}">${h.link_to(purchase, '#')}</li>
% endfor
</ul>
% else:
<p>(no eligible purchases found)</p>
% endif
## ${h.link_to("Receive from scratch for {}".format(vendor), '#', class_='ui-btn ui-corner-all')}
${h.link_to("Start over", url('purchases.batch.mobile_create'), class_='ui-btn ui-corner-all')}
% endif
${h.end_form()}

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,4 +1,4 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8; -*-
<%namespace file="/shifts/base.mako" import="timesheet" />
<%namespace file="/shifts/schedule.mako" import="render_day" />
<html>
@ -6,7 +6,7 @@
## TODO: this seems a little hacky..?
${h.stylesheet_link(request.static_url('tailbone:static/css/normalize.css'), media='all')}
${h.stylesheet_link(request.static_url('tailbone:static/css/base.css'), media='all')}
${h.stylesheet_link(request.static_url('tailbone:static/css/newgrids.css'), media='all')}
${h.stylesheet_link(request.static_url('tailbone:static/css/grids.css'), media='all')}
${h.stylesheet_link(request.static_url('tailbone:static/css/timesheet.css'), media='all')}
${h.stylesheet_link(request.static_url('tailbone:static/css/schedule_print.css'), media='print')}
</head>

View file

@ -1,6 +0,0 @@
## -*- coding: utf-8 -*-
<%inherit file="tailbone:templates/master/index.mako" />
<%def name="content_title()"></%def>
${parent.body()}

View file

@ -0,0 +1,6 @@
## -*- coding: utf-8; -*-
<%inherit file="tailbone:templates/master2/index.mako" />
<%def name="content_title()"></%def>
${parent.body()}