From 93ef642c25d65519b334fecad56bf6567eeb733b Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 6 Jul 2015 22:42:14 +0200 Subject: single file edit: jump to file after saving --- www/edit.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'www/edit.php') diff --git a/www/edit.php b/www/edit.php index e95ca3f..33b22c2 100644 --- a/www/edit.php +++ b/www/edit.php @@ -9,16 +9,20 @@ require_once 'www-header.php'; $repo = new Repository(); $repo->loadFromRequest(); -$repopo = new Repository_Post($repo); -if ($repopo->process($_POST, $_SESSION)) { - redirect($repo->getLink('display', null, true)); -} - $file = null; if (isset($_GET['file'])) { $file = $repo->getFileByName($_GET['file']); } +$repopo = new Repository_Post($repo); +if ($repopo->process($_POST, $_SESSION)) { + $anchor = ''; + if ($file !== null) { + $anchor = '#' . $file->getAnchorName(); + } + redirect($repo->getLink('display', null, true) . $anchor); +} + render( 'edit', array( -- cgit v1.2.3