mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-03 04:41:41 +00:00
Go from get to post.
This commit is contained in:
33
public/v1/js/ff/budgets/index.js
vendored
33
public/v1/js/ff/budgets/index.js
vendored
@@ -108,38 +108,7 @@ function sortStop(event, ui) {
|
|||||||
page: page,
|
page: page,
|
||||||
_token: token
|
_token: token
|
||||||
};
|
};
|
||||||
// var thisDate = current.data('date');
|
$.post('budgets/reorder', arr);
|
||||||
// var originalBG = current.css('backgroundColor');
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (current.prev().data('date') !== thisDate && current.next().data('date') !== thisDate) {
|
|
||||||
// // animate something with color:
|
|
||||||
// current.animate({backgroundColor: "#d9534f"}, 200, function () {
|
|
||||||
// $(this).animate({backgroundColor: originalBG}, 200);
|
|
||||||
// return undefined;
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // do update
|
|
||||||
// var list = $('tr[data-date="' + thisDate + '"]');
|
|
||||||
// var submit = [];
|
|
||||||
// $.each(list, function (i, v) {
|
|
||||||
// var row = $(v);
|
|
||||||
// var id = row.data('id');
|
|
||||||
// submit.push(id);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // do extra animation when done?
|
|
||||||
$.get('budgets/reorder', arr);
|
|
||||||
//
|
|
||||||
// current.animate({backgroundColor: "#5cb85c"}, 200, function () {
|
|
||||||
// $(this).animate({backgroundColor: originalBG}, 200);
|
|
||||||
// return undefined;
|
|
||||||
// });
|
|
||||||
// return undefined;
|
|
||||||
//alert('drop!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ Route::group(
|
|||||||
Route::get('list/no-budget/{start_date?}/{end_date?}', ['uses' => 'Budget\ShowController@noBudget', 'as' => 'no-budget']);
|
Route::get('list/no-budget/{start_date?}/{end_date?}', ['uses' => 'Budget\ShowController@noBudget', 'as' => 'no-budget']);
|
||||||
|
|
||||||
// reorder budgets
|
// reorder budgets
|
||||||
Route::get('reorder', ['uses' => 'Budget\IndexController@reorder', 'as' => 'reorder']);
|
Route::post('reorder', ['uses' => 'Budget\IndexController@reorder', 'as' => 'reorder']);
|
||||||
|
|
||||||
// index
|
// index
|
||||||
Route::get('{start_date?}/{end_date?}', ['uses' => 'Budget\IndexController@index', 'as' => 'index']);
|
Route::get('{start_date?}/{end_date?}', ['uses' => 'Budget\IndexController@index', 'as' => 'index']);
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ class IndexControllerTest extends TestCase
|
|||||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||||
$date = new Carbon;
|
$date = new Carbon;
|
||||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
|
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
|
||||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
|
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
|
||||||
|
|
||||||
@@ -186,8 +186,8 @@ class IndexControllerTest extends TestCase
|
|||||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||||
$date = new Carbon;
|
$date = new Carbon;
|
||||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
|
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
|
||||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
|
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
|
||||||
|
|
||||||
@@ -239,8 +239,8 @@ class IndexControllerTest extends TestCase
|
|||||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||||
$date = new Carbon;
|
$date = new Carbon;
|
||||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
|
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
|
||||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
|
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
|
||||||
|
|
||||||
@@ -254,4 +254,25 @@ class IndexControllerTest extends TestCase
|
|||||||
$response = $this->get(route('budgets.index', ['Hello-there']));
|
$response = $this->get(route('budgets.index', ['Hello-there']));
|
||||||
$response->assertStatus(404);
|
$response->assertStatus(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Budget\IndexController
|
||||||
|
*/
|
||||||
|
public function testReorder(): void
|
||||||
|
{
|
||||||
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
|
$data = [
|
||||||
|
'budgetIds' => [1,2],
|
||||||
|
'page' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
$repository->shouldReceive('cleanupBudgets')->atLeast()->once();
|
||||||
|
$repository->shouldReceive('findNull')->atLeast()->once()->andReturn(new Budget);
|
||||||
|
$repository->shouldReceive('setBudgetOrder')->atLeast()->once();
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$response = $this->post(route('budgets.reorder', $data));
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user