Francois Gouget : testbot/cgi: Don't offer to save the item if no field is editable.

Alexandre Julliard julliard at winehq.org
Mon May 2 15:19:07 CDT 2022


Module: tools
Branch: master
Commit: 5783c4f88d469db676316523578c4f7f50734dd8
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=5783c4f88d469db676316523578c4f7f50734dd8

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon May  2 19:23:33 2022 +0200

testbot/cgi: Don't offer to save the item if no field is editable.

This allows derived pages to offer a read-only view of the item details
just by overriding DisplayProperty().

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/ObjectModel/CGI/ItemPage.pm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/testbot/lib/ObjectModel/CGI/ItemPage.pm b/testbot/lib/ObjectModel/CGI/ItemPage.pm
index 1b77eea..8bea816 100644
--- a/testbot/lib/ObjectModel/CGI/ItemPage.pm
+++ b/testbot/lib/ObjectModel/CGI/ItemPage.pm
@@ -132,10 +132,7 @@ sub GetActions($)
 {
   my ($self) = @_;
 
-  my @Actions = @{$self->SUPER::GetActions()};
-  push @Actions, "Save", "Cancel";
-
-  return \@Actions;
+  return $self->{HasRW} ? ["Save", "Cancel"] : [];
 }
 
 sub RedirectToList($)




More information about the wine-cvs mailing list