mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 03:19:13 -04:00
Extract reweighting logic out of Organize_Controller into
item::reweight_all_children as an API and write a test for it. Work in progress on #1914.
This commit is contained in:
@@ -128,13 +128,7 @@ class Organize_Controller extends Controller {
|
||||
access::required("edit", $album);
|
||||
|
||||
if ($album->sort_column != "weight") {
|
||||
// Force all the weights into the current order before changing the order to manual
|
||||
$weight = 0;
|
||||
foreach ($album->children() as $child) {
|
||||
$child->weight = ++$weight;
|
||||
$child->save();
|
||||
}
|
||||
|
||||
item::resequence_child_weights($album);
|
||||
$album->sort_column = "weight";
|
||||
$album->sort_order = "ASC";
|
||||
$album->save();
|
||||
|
||||
Reference in New Issue
Block a user