Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/ObjectModel/CGI/CollectionBlock.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm index 13c2a62bd..736c3f8a3 100644 --- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm +++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm @@ -570,6 +570,15 @@ sub OnItemAction($$$) # Actions handling #
+sub GetAddButtonLabel($) +{ + my ($self) = @_; + + my $Label = $self->{Collection}->GetItemName(); + $Label =~ s/([a-z])([A-Z])/$1 $2/g; + return "Add $Label"; +} + =pod =over 12
@@ -587,9 +596,7 @@ sub GetActions($) { my ($self) = @_;
- return $self->GetDetailsPage() ? - ["Add ". $self->{Collection}->GetItemName()] : - []; + return $self->GetDetailsPage() ? [$self->GetAddButtonLabel()] : []; }
=pod @@ -614,7 +621,7 @@ sub OnAction($$) { my ($self, $Action) = @_;
- if ($self->{RW} and $Action eq "Add ". $self->{Collection}->GetItemName()) + if ($self->{RW} and $Action eq $self->GetAddButtonLabel()) { my $Target = $self->GetDetailsPage(); my ($MasterColNames, $MasterColValues) = $self->{Collection}->GetMasterCols();