Fix page saving in expert mode (/ != /home)

This commit is contained in:
Matias Griese
2014-09-26 14:10:32 +03:00
parent c501097a78
commit 0017d05493
2 changed files with 3 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ use Grav\Common\Uri;
use Grav\Common\Page\Pages; use Grav\Common\Page\Pages;
use Grav\Common\Page\Page; use Grav\Common\Page\Page;
use Grav\Common\Data; use Grav\Common\Data;
use Symfony\Component\Yaml\Yaml;
class Admin class Admin
{ {
@@ -398,8 +399,8 @@ class Admin
// Found the type and header from the session. // Found the type and header from the session.
$data = $this->session->{$page->route()}; $data = $this->session->{$page->route()};
$page->name($data['type'] . '.md'); $page->name($data['type'] . '.md');
$page->frontmatter('title: ' . $data['title']);
$page->header(['title' => $data['title']]); $page->header(['title' => $data['title']]);
$page->frontmatter(Yaml::dump((array) $page->header()));
} else { } else {
// Find out the type by looking at the parent. // Find out the type by looking at the parent.
$type = $parent->child_type() ? $parent->child_type() : $parent->blueprints()->get('child_type', 'default'); $type = $parent->child_type() ? $parent->child_type() : $parent->blueprints()->get('child_type', 'default');

View File

@@ -282,7 +282,7 @@ class AdminController
// Find new parent page in order to build the path. // Find new parent page in order to build the path.
$route = !isset($data['route']) ? dirname($this->admin->route) : $data['route']; $route = !isset($data['route']) ? dirname($this->admin->route) : $data['route'];
$parent = $route ? $pages->dispatch($route, true) : $pages->root(); $parent = $route && $route != '/' ? $pages->dispatch($route, true) : $pages->root();
$obj = $this->admin->page(true); $obj = $this->admin->page(true);
// Change parent if needed and initialize move (might be needed also on ordering/folder change). // Change parent if needed and initialize move (might be needed also on ordering/folder change).