Update universal_table templates.

This commit is contained in:
rulingcom 2024-08-11 23:06:30 +08:00
parent 6a12f220ad
commit 10071458f4
2 changed files with 19 additions and 26 deletions

View File

@ -48,6 +48,7 @@
width: 120px; width: 120px;
} }
</style> </style>
<form class="form-inline universal-form-inline" action="{{url}}" method="get">
<table class="table table-hover table-striped universal-table-index"> <table class="table table-hover table-striped universal-table-index">
<caption> <caption>
<h3>{{table-name}}</h3> <h3>{{table-name}}</h3>
@ -64,13 +65,10 @@
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<div class="dropdown-menu universal-dropdown-menu" aria-labelledby="dLabel"> <div class="dropdown-menu universal-dropdown-menu" aria-labelledby="dLabel">
<form class="form-inline universal-form-inline" action="{{url}}" method="get">
<div class="form-group"> <div class="form-group">
{{form-field}} {{form-field}}
<input type="hidden" value="{{key}}" name="column" >
</div> </div>
<button class="btn btn-primary" type="submit" class="btn btn-default">Go</button> <button class="btn btn-primary" type="submit" class="btn btn-default">Go</button>
</form>
</div> </div>
</div> </div>
</th> </th>
@ -82,10 +80,11 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</form>
<div>{{total_entries}}</div> <div>{{total_entries}}</div>
<div>{{export_button}}</div> <div>{{export_button}}</div>
{{pagination_goes_here}} {{pagination_goes_here}}
<script> <script type="text/javascript">
$('.universal-table-index th').eq(1).attr('class', 'desktop tablet-l tablet-p'); $('.universal-table-index th').eq(1).attr('class', 'desktop tablet-l tablet-p');
$('.universal-table-index th').filter(':gt(1)').attr('class', 'desktop tablet-l tablet-p mobile-l'); $('.universal-table-index th').filter(':gt(1)').attr('class', 'desktop tablet-l tablet-p mobile-l');
$('.universal-table-index').each(function(){ $('.universal-table-index').each(function(){
@ -101,6 +100,9 @@
}); });
} }
}); });
$(document).on('click', '.universal-table-index .dropdown-menu', function (e) {
e.stopPropagation();
});
</script> </script>
<style> <style>
.universal-table-index.dtr-inline.collapsed td.dtr-control{ .universal-table-index.dtr-inline.collapsed td.dtr-control{

View File

@ -7,10 +7,11 @@
padding: 8px 0 0 0; padding: 8px 0 0 0;
display: inline; display: inline;
margin-right: 5px; margin-right: 5px;
color: #888; color: #fff;
} }
.universal-dropdown { .universal-dropdown {
display: inline-block; display: inline-block;
color: gray;
} }
a.universal-btn { a.universal-btn {
vertical-align: baseline; vertical-align: baseline;
@ -36,26 +37,14 @@
.universal-table-index tbody { .universal-table-index tbody {
counter-reset: item; counter-reset: item;
} }
.universal-table-index tbody > tr > td:first-child:before {
content: counter(item);
counter-increment: item;
}
.universal-table-index thead > tr > th:first-child:before {
content: "No.";
}
.universal-table-index thead > tr > th:first-child { .universal-table-index thead > tr > th:first-child {
width: 4em; width: 4em;
} }
.universal-th-icon { .universal-th-icon {
border: 1px solid #eee; border: 1px solid #eee;
padding: 5px 8px; padding: 5px 8px;
margin-right: 5px; margin-right: 5px;
color: gray; color: #fff;
cursor: pointer; cursor: pointer;
} }
.universal-th-text.no-sort.no-search { .universal-th-text.no-sort.no-search {
@ -102,7 +91,9 @@
<div>{{total_entries}}</div> <div>{{total_entries}}</div>
<div>{{export_button}}</div> <div>{{export_button}}</div>
{{pagination_goes_here}} {{pagination_goes_here}}
<script>
$('.universal-table-index thead tr').prepend('<th></th>') <script type="text/javascript">
$('.universal-table-index tbody tr').prepend('<td></td>') $(document).on('click', '.universal-table-index .dropdown-menu', function (e) {
e.stopPropagation();
});
</script> </script>