Fix display of sidebar when previewing page edit. (Thanks, privat)
On second thought, only display a page's personal sidebar when previewing it, not when editing normally.master
parent
95b45864de
commit
e93cee3378
|
@ -153,6 +153,7 @@ sub cgi_editpage ($$) {
|
||||||
noimageinline => 1,
|
noimageinline => 1,
|
||||||
linktext => "FormattingHelp"));
|
linktext => "FormattingHelp"));
|
||||||
|
|
||||||
|
my $previewing=0;
|
||||||
if ($form->submitted eq "Cancel") {
|
if ($form->submitted eq "Cancel") {
|
||||||
if ($form->field("do") eq "create" && defined $from) {
|
if ($form->field("do") eq "create" && defined $from) {
|
||||||
redirect($q, urlto($from, undef, 1));
|
redirect($q, urlto($from, undef, 1));
|
||||||
|
@ -166,6 +167,8 @@ sub cgi_editpage ($$) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
elsif ($form->submitted eq "Preview") {
|
elsif ($form->submitted eq "Preview") {
|
||||||
|
$previewing=1;
|
||||||
|
|
||||||
my $new=not exists $pagesources{$page};
|
my $new=not exists $pagesources{$page};
|
||||||
if ($new) {
|
if ($new) {
|
||||||
# temporarily record its type
|
# temporarily record its type
|
||||||
|
@ -255,7 +258,7 @@ sub cgi_editpage ($$) {
|
||||||
if (! @page_locs) {
|
if (! @page_locs) {
|
||||||
# hmm, someone else made the page in the
|
# hmm, someone else made the page in the
|
||||||
# meantime?
|
# meantime?
|
||||||
if ($form->submitted eq "Preview") {
|
if ($previewing) {
|
||||||
# let them go ahead with the edit
|
# let them go ahead with the edit
|
||||||
# and resolve the conflict at save
|
# and resolve the conflict at save
|
||||||
# time
|
# time
|
||||||
|
@ -313,7 +316,9 @@ sub cgi_editpage ($$) {
|
||||||
}
|
}
|
||||||
|
|
||||||
showform($form, \@buttons, $session, $q,
|
showform($form, \@buttons, $session, $q,
|
||||||
forcebaseurl => $baseurl, page => $page);
|
forcebaseurl => $baseurl,
|
||||||
|
($previewing ? (page => $page) : ()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# save page
|
# save page
|
||||||
|
@ -331,7 +336,7 @@ sub cgi_editpage ($$) {
|
||||||
$form->field(name => "type", type => 'hidden');
|
$form->field(name => "type", type => 'hidden');
|
||||||
$form->title(sprintf(gettext("editing %s"), $page));
|
$form->title(sprintf(gettext("editing %s"), $page));
|
||||||
showform($form, \@buttons, $session, $q,
|
showform($form, \@buttons, $session, $q,
|
||||||
forcebaseurl => $baseurl, page => $page);
|
forcebaseurl => $baseurl);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
elsif ($form->field("do") eq "create" && $exists) {
|
elsif ($form->field("do") eq "create" && $exists) {
|
||||||
|
@ -346,7 +351,7 @@ sub cgi_editpage ($$) {
|
||||||
"\n\n\n".$form->field("editcontent"),
|
"\n\n\n".$form->field("editcontent"),
|
||||||
force => 1);
|
force => 1);
|
||||||
showform($form, \@buttons, $session, $q,
|
showform($form, \@buttons, $session, $q,
|
||||||
forcebaseurl => $baseurl, page => $page);
|
forcebaseurl => $baseurl);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +392,7 @@ sub cgi_editpage ($$) {
|
||||||
$form->field(name => "type", type => 'hidden');
|
$form->field(name => "type", type => 'hidden');
|
||||||
$form->title(sprintf(gettext("editing %s"), $page));
|
$form->title(sprintf(gettext("editing %s"), $page));
|
||||||
showform($form, \@buttons, $session, $q,
|
showform($form, \@buttons, $session, $q,
|
||||||
forcebaseurl => $baseurl, page => $page);
|
forcebaseurl => $baseurl);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +431,7 @@ sub cgi_editpage ($$) {
|
||||||
$form->field(name => "type", type => 'hidden');
|
$form->field(name => "type", type => 'hidden');
|
||||||
$form->title(sprintf(gettext("editing %s"), $page));
|
$form->title(sprintf(gettext("editing %s"), $page));
|
||||||
showform($form, \@buttons, $session, $q,
|
showform($form, \@buttons, $session, $q,
|
||||||
forcebaseurl => $baseurl, page => $page);
|
forcebaseurl => $baseurl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# The trailing question mark tries to avoid broken
|
# The trailing question mark tries to avoid broken
|
||||||
|
|
|
@ -6,7 +6,7 @@ ikiwiki (3.20100609) unstable; urgency=low
|
||||||
* Remove example blog tag pages; allow autotag creation to create them
|
* Remove example blog tag pages; allow autotag creation to create them
|
||||||
when used.
|
when used.
|
||||||
* Fix support for globbing in tagged() pagespecs.
|
* Fix support for globbing in tagged() pagespecs.
|
||||||
* When editing a page, show that page's sidebar. (Thanks, privat)
|
* Fix display of sidebar when previewing page edit. (Thanks, privat)
|
||||||
* relativedate: Fix problem with localised dates not working.
|
* relativedate: Fix problem with localised dates not working.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Mon, 31 May 2010 20:44:17 -0400
|
-- Joey Hess <joeyh@debian.org> Mon, 31 May 2010 20:44:17 -0400
|
||||||
|
|
|
@ -34,9 +34,10 @@ But it causes some nasty bugs for plugins that use the pagetemplate hook. It is
|
||||||
* -> Problem: the sidebar now shows the foo link (it is the root sidebar!)
|
* -> Problem: the sidebar now shows the foo link (it is the root sidebar!)
|
||||||
* -> Was expecte : the sidebar displays "world"
|
* -> Was expecte : the sidebar displays "world"
|
||||||
|
|
||||||
> One could argue that the behavior here is right, or wrong.
|
> I think it's a misconception to think that the page editing page is the same
|
||||||
> Is a page edit page really the same as the page being edited?
|
> as the page it's editing. If you were deleting that page, would you expect
|
||||||
> The next case is more clear.. --[[Joey]]
|
> the "are you sure" confirmation page to display the page's sidebar?
|
||||||
|
> --[[Joey]]
|
||||||
|
|
||||||
### A last example
|
### A last example
|
||||||
|
|
||||||
|
@ -46,7 +47,12 @@ But it causes some nasty bugs for plugins that use the pagetemplate hook. It is
|
||||||
* -> Problem: the sidebar still displays the foo link
|
* -> Problem: the sidebar still displays the foo link
|
||||||
* -> Was expected: the sidebar display "goodby"
|
* -> Was expected: the sidebar display "goodby"
|
||||||
|
|
||||||
> I think this is worth fixing. --[[Joey]]
|
> In the specific case of previewing, it is indeed a bug that the
|
||||||
|
> right sidebar is not displayed. And replacing the regular sidebar
|
||||||
|
> with the one from the previewed page is probably the best we can do..
|
||||||
|
> displaying 2 sidebars would be confusing, and the `page.tmpl` can
|
||||||
|
> put the sidebar anywhere so we can't just display the preview sidebar
|
||||||
|
> next to the rest of the page preview. --[[Joey]]
|
||||||
|
|
||||||
## Some superficial hacking
|
## Some superficial hacking
|
||||||
|
|
||||||
|
@ -63,5 +69,6 @@ I do not guarantee (I do not even expect) that it is the proper way to solve
|
||||||
this bug but it may help developers to find and solve the real problem.
|
this bug but it may help developers to find and solve the real problem.
|
||||||
|
|
||||||
> Oh, it's pretty reasonable. I don't think it breaks anything. :)
|
> Oh, it's pretty reasonable. I don't think it breaks anything. :)
|
||||||
|
> I modified it a bit, and explicitly made it *not* "fix" the second example.
|
||||||
> [[done]]
|
> [[done]]
|
||||||
> --[[Joey]]
|
> --[[Joey]]
|
||||||
|
|
Loading…
Reference in New Issue