<a class="btn btn-mini" href="{{toolinfo.getLink(file)}}" style="float: right;">{{toolinfo.getTitle}}</a>
{% endfor %}
<a class="btn btn-mini" href="{{repo.getLink('edit', file.getFilename)}}" style="float: right;" title="edit"><i class="icon-edit"></i></a>
- <h3 id="{{file.getFilename|replace({' ': '-'})}}">{{file.getFilename}}<a class="anchorlink" href="{{repo.getLink('display')}}#{{file.getFilename|replace({' ': '-'})}}"></a></h3>
+ <h3 id="{{file.getAnchorName}}">{{file.getFilename}}<a class="anchorlink" href="{{repo.getLink('display')}}#{{file.getAnchorName}}"></a></h3>
</div>
{{file.getRenderedContent(toolres)|raw}}
</div>
{% block content %}
<div class="content-padding-fix"></div>
-<form method="post" action="{{repo.getLink('edit')}}" enctype="multipart/form-data" class="form-horizontal">
+<form method="post" action="{{repo.getLink('edit', singlefile.getFilename)}}" enctype="multipart/form-data" class="form-horizontal">
<div class="control-group">
<label class="control-label" for="description">Description</label>
<div class="controls">
return $this->path;
}
+ /**
+ * Get the filename usable as HTML anchor.
+ *
+ * @return string
+ */
+ function getAnchorName()
+ {
+ return str_replace(' ', '-', $this->getFilename());
+ }
+
/**
* Return the full path to the file
*
$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(