don't special case preview
authorJoey Hess <joey@kodama.kitenet.net>
Thu, 2 Oct 2008 16:42:46 +0000 (12:42 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Thu, 2 Oct 2008 16:42:46 +0000 (12:42 -0400)
Whenever the edit form is submitted, but not saved, the page location
select should reduce to the currently selected value. This was only done
when previewing before, but is also needed in order to support the case of
adding an attachment to a page that is just being created.

Before this change, the attachment plugin would get a weird value in
$form->field("page"), that did not reflect the actual page location.

IkiWiki/Plugin/editpage.pm

index 794548c6de933d03f1e2755ae3ad8cdefc2ca8a8..30c93df20961090f0bc1e278d0bbf0e5685ecbbb 100644 (file)
@@ -250,7 +250,7 @@ sub cgi_editpage ($$) { #{{{
                            file_pruned($from, $config{srcdir}) ||
                            $from=~/^\// || 
                            $absolute ||
                            file_pruned($from, $config{srcdir}) ||
                            $from=~/^\// || 
                            $absolute ||
-                           $form->submitted eq "Preview") {
+                           $form->submitted) {
                                @page_locs=$best_loc=$page;
                        }
                        else {
                                @page_locs=$best_loc=$page;
                        }
                        else {