web commit by http://ethan.betacantrips.com/: new patch for user-friendliness
[ikiwiki.git] / doc / patchqueue / friendly_pagelocs.mdwn
1 When you create a new page, the choices for page location have underscores and
2 numbers in them to represent spaces and "special characters". This patch lets
3 ikiwiki display more user-friendly names. --Ethan
4
5 <pre>
6 diff -urX ignorepats ikiwiki/IkiWiki/CGI.pm ikidev/IkiWiki/CGI.pm
7 --- ikiwiki/IkiWiki/CGI.pm      2007-02-14 18:17:12.000000000 -0800
8 +++ ikidev/IkiWiki/CGI.pm       2007-02-20 15:54:13.761158000 -0800
9 @@ -450,6 +450,8 @@
10                                 map { check_canedit($_, $q, $session) } @page_locs;
11                         }
12
13 +                       # don't escape (will be done by formbuilder)
14 +                       my %loc_options = map { $_ => pagetitle($_, 1) } @editable_locs;
15                         my @page_types;
16                         if (exists $hooks{htmlize}) {
17                                 @page_types=keys %{$hooks{htmlize}};
18 @@ -457,7 +459,7 @@
19
20                         $form->tmpl_param("page_select", 1);
21                         $form->field(name => "page", type => 'select',
22 -                               options => \@editable_locs, value => $best_loc);
23 +                               options => \%loc_options, value => $best_loc);
24                         $form->field(name => "type", type => 'select',
25                                 options => \@page_types);
26                         $form->title(sprintf(gettext("creating %s"), pagetitle($page)));
27 </pre>