Skip to content

Commit

Permalink
Save the item before updating the order of the children. Also always …
Browse files Browse the repository at this point in the history
…increment the weight count (even if it is equal to the weight of the current child)
  • Loading branch information
Tim Almdal committed Jun 4, 2010
1 parent a600185 commit 686da5a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/gallery/helpers/item_rest.php
Expand Up @@ -126,18 +126,19 @@ static function put($request) {
}
}
}
$item->save();

$weight = 0;
if (isset($request->params->members)) {
$weight = 0;
foreach ($request->params->members as $url) {
$child = rest::resolve($url);
if ($child->parent_id == $item->id && $child->weight != $weight) {
$child->weight = $weight++;
$child->weight = $weight;
$child->save();
}
$weight++;
}
}
$item->save();
}

static function post($request) {
Expand Down

0 comments on commit 686da5a

Please sign in to comment.