Skip to content

Commit

Permalink
Fix deleted drop-down items being cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
abeverley committed Sep 19, 2023
1 parent db503cf commit 5f0191c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/GADS/Column/Enum.pm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ has enumvals => (
});
$enumrs->result_class('DBIx::Class::ResultClass::HashRefInflator');
# Make enumvals match Curval value types, as both use the same
# front-end code
# front-end code.
# Note, any changes must be replicated in GADS::Datum::Enum::_build_deleted_values
my @enumvals = map {
+{
value => $_->{value},
Expand Down
8 changes: 6 additions & 2 deletions lib/GADS/Datum/Enum.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

package GADS::Datum::Enum;

use HTML::Entities qw/encode_entities/;
use Log::Report 'linkspace';
use Moo;
use MooX::Types::MooseLike::Base qw/:all/;
Expand Down Expand Up @@ -191,8 +192,11 @@ sub _build_deleted_values
my $text = shift @text;
next unless shift @deleted;
push @return, {
id => $id,
value => $text,
id => $id,
value => $text,
html => encode_entities($text), # Needed for edit form render
selector_id => $id,
value_id => $id,
};
}
return \@return;
Expand Down
1 change: 1 addition & 0 deletions lib/GADS/Role/Presentation/Datum/Enum.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sub presentation {
my $base = $self->presentation_base;

$base->{id_hash} = $self->id_hash;
$base->{deleted_values} = $self->deleted_values;

return $base;
}
Expand Down

0 comments on commit 5f0191c

Please sign in to comment.