sub action_reorder {
my ($self) = @_;
- my @ids = @{ $::form->{unit_id} || [] };
- my $result = SL::DB::Unit->new->db->do_transaction(sub {
- foreach my $idx (0 .. scalar(@ids) - 1) {
- SL::DB::Unit->new(id => $ids[$idx])->load->update_attributes(sortkey => $idx + 1);
- }
- });
-
- $self->render(type => 'js', inline => '1;');
+ SL::DB::Unit->reorder_list(@{ $::form->{unit_id} || [] });
+
+ $self->render(\'', { type => 'json' });
}
#