1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Prevent reloading page when showing/hiding archived

This commit is contained in:
Hillel Coren 2016-02-18 20:14:48 +02:00
parent 06fa2e5dc4
commit 6b64910c9d
5 changed files with 22 additions and 12 deletions

View File

@ -117,13 +117,7 @@ class AccountController extends BaseController
{
Session::put("show_trash:{$entityType}", $visible == 'true');
if ($entityType == 'user') {
return Redirect::to('settings/'.ACCOUNT_USER_MANAGEMENT);
} elseif ($entityType == 'token') {
return Redirect::to('settings/'.ACCOUNT_API_TOKENS);
} else {
return Redirect::to("{$entityType}s");
}
return RESULT_SUCCESS;
}
public function getSearchData()

View File

@ -42,9 +42,13 @@
function setTrashVisible() {
var checked = $('#trashed').is(':checked');
window.location = '{!! URL::to('view_archive/token') !!}' + (checked ? '/true' : '/false');
var url = '{{ URL::to('view_archive/token') }}' + (checked ? '/true' : '/false');
$.get(url, function(data) {
refreshDatatable();
})
}
</script>
@stop

View File

@ -39,7 +39,11 @@
function setTrashVisible() {
var checked = $('#trashed').is(':checked');
window.location = '{!! URL::to('view_archive/user') !!}' + (checked ? '/true' : '/false');
var url = '{{ URL::to('view_archive/user') }}' + (checked ? '/true' : '/false');
$.get(url, function(data) {
refreshDatatable();
})
}
</script>

View File

@ -42,8 +42,12 @@
});
@endif
function refreshDatatable() {
window.dataTable.api().ajax.reload();
}
function load_{{ $class }}() {
jQuery('.{{ $class }}').dataTable({
window.dataTable = jQuery('.{{ $class }}').dataTable({
"fnRowCallback": function(row, data) {
if (data[0].indexOf('ENTITY_DELETED') > 0) {
$(row).addClass('entityDeleted');

View File

@ -101,7 +101,11 @@
function setTrashVisible() {
var checked = $('#trashed').is(':checked');
window.location = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false');
var url = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false');
$.get(url, function(data) {
refreshDatatable();
})
}
$(function() {