Skip to content

Commit

Permalink
Fixed naming for pages with dash and diacritic
Browse files Browse the repository at this point in the history
  • Loading branch information
foxycode committed Oct 17, 2017
1 parent d0d0f45 commit de90317
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/Presenters/WikiPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ protected function startup()
$currentMenu = $this->getMenu()->getItem('wiki');
foreach (explode('/', $page) as $level) {
$path[] = $level;
$currentMenu->addItem($level, $level, function (IMenuItem $item) use ($path) {
$name = str_replace('-', '_', $level);
$title = str_replace('_', ' ', $level);
$currentMenu->addItem($name, $title, function (IMenuItem $item) use ($path) {
$item->setMenuVisibility(false);
$item->setAction('Wiki:default', ['page' => implode('/', $path)]);
});
$currentMenu = $currentMenu->getItem($level);
$currentMenu = $currentMenu->getItem($name);
}
}

Expand Down
3 changes: 1 addition & 2 deletions app/Router/RouterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public static function createRouter()
{
$router = new RouteList;

$router[] = new Route('wiki[/<page [A-Za-z0-9_\-/]+>]', 'Wiki:default');
$router[] = new Route('wiki-edit[/<page [A-Za-z0-9_\-/]+>]', 'WikiEdit:default');
$router[] = new Route('wiki[/<page .+>]', 'Wiki:default');
$router[] = new Route('sign/<action>', 'Sign:in');
$router[] = new Route('user/create', 'UserCreate:default');
$router[] = new Route('', 'Wiki:default', Route::ONE_WAY);
Expand Down

0 comments on commit de90317

Please sign in to comment.