From acfd53c7afbcae79d5d674c8380640b78128f109 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 3 Jun 2010 23:55:01 +0200 Subject: [PATCH 1/1] added commit changes --- lib/MojoFacets/Changes.pm | 8 ++++++-- templates/changes/edits.html.ep | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/MojoFacets/Changes.pm b/lib/MojoFacets/Changes.pm index 6db19ea..1fb2cde 100644 --- a/lib/MojoFacets/Changes.pm +++ b/lib/MojoFacets/Changes.pm @@ -51,6 +51,7 @@ sub _edit_path { sub edits { my ( $self ) = @_; my $path = $self->param('path') || $self->session('path'); + my $commit = $self->param('commit'); my ( $items, $unique2id ); if ( my $apply_on_path = $self->param('apply_on_path') ) { $items = $MojoFacets::Data::loaded->{$apply_on_path}->{data}->{items}; @@ -70,8 +71,11 @@ sub edits { $unique2id->{$pk}->{ $items->[$i]->{$pk}->[0] } = $i; } } - my $i = $unique2id->{$pk}->{$id}; - my $status = defined $i ? 'found' : 'missing'; + my $status = 'missing'; + if ( my $i = $unique2id->{$pk}->{$id} ) { + $status = 'found'; + $items->[$i]->{$pk} = $e->{new} if $commit; + } $e->{_status} = $status; $stats->{$status}++; } diff --git a/templates/changes/edits.html.ep b/templates/changes/edits.html.ep index f1417db..953b989 100644 --- a/templates/changes/edits.html.ep +++ b/templates/changes/edits.html.ep @@ -12,7 +12,6 @@ % } - % if ( $apply_on_path ) { + + + % } + + -- 2.20.1
oldnew