finishing the visibility updates

This commit is contained in:
Andy Miller
2015-08-14 14:28:24 -06:00
parent 7c8b3363b9
commit 059cab3504
2 changed files with 25 additions and 29 deletions

View File

@@ -829,6 +829,8 @@ class AdminController
$original_slug = $obj->slug();
$original_order = intval(trim($obj->order(), '.'));
// Change parent if needed and initialize move (might be needed also on ordering/folder change).
$obj = $obj->move($parent);
$this->preparePage($obj);
@@ -845,6 +847,16 @@ class AdminController
$obj->order($original_order + 1);
}
// add or remove numeric prefix based on ordering value
if (isset($data['ordering'])) {
if ($data['ordering'] && !$obj->order()) {
$obj->order(1001);
} elseif (!$data['ordering'] && $obj->order()) {
$obj->folder($obj->slug());
}
}
} else {
// Handle standard data types.
$obj = $this->prepareData();
@@ -1134,10 +1146,17 @@ class AdminController
{
$input = $this->post;
$order = max(0, (int) isset($input['order']) ? $input['order'] : $page->value('order'));
$ordering = $order ? sprintf('%02d.', $order) : '';
$slug = empty($input['folder']) ? $page->value('folder') : (string) $input['folder'];
$page->folder($ordering . $slug);
if (isset($input['order'])) {
$order = max(0, (int) isset($input['order']) ? $input['order'] : $page->value('order'));
$ordering = $order ? sprintf('%02d.', $order) : '';
$slug = empty($input['folder']) ? $page->value('folder') : (string) $input['folder'];
$page->folder($ordering . $slug);
if (isset($input['header']['visible']) && $input['header']['visible'] == true) {
unset($input['header']['visible']);
}
}
if (isset($input['type']) && !empty($input['type'])) {
@@ -1147,7 +1166,6 @@ class AdminController
$page->template($type);
}
// Special case for Expert mode: build the raw, unset content
if (isset($input['frontmatter']) && isset($input['content'])) {
$page->raw("---\n" . (string) $input['frontmatter'] . "\n---\n" . (string) $input['content']);
@@ -1166,7 +1184,7 @@ class AdminController
}
} elseif ($key == 'taxonomy') {
foreach ($header[$key] as $taxkey => $taxonomy) {
if (is_array($taxonomy) && count($taxonomy) == 1 && $taxonomy[0] == '') {
if (is_array($taxonomy) && count($taxonomy) == 1 && trim($taxonomy[0]) == '') {
unset($header[$key][$taxkey]);
}
}