]> source.dussan.org Git - gitea.git/commitdiff
Fix file edit change preview functionality (#5300)
authorLauris BH <lauris@nix.lv>
Fri, 9 Nov 2018 12:05:43 +0000 (14:05 +0200)
committerGitHub <noreply@github.com>
Fri, 9 Nov 2018 12:05:43 +0000 (14:05 +0200)
templates/repo/editor/diff_preview.tmpl
templates/repo/editor/edit.tmpl

index 06b4a2e830cc584eec3c9d707cf9590e4304a948..b663e4e93d5a6c940eb4e2fe693e76b7f3f98254 100644 (file)
@@ -3,9 +3,7 @@
                <div class="file-body file-code code-view code-diff">
                        <table>
                                <tbody>
-                                       {{with .File}}
-                                               {{template "repo/diff/section_unified" .}}
-                                       {{end}}
+                                       {{template "repo/diff/section_unified" dict "file" .File "root" $}}
                                </tbody>
                        </table>
                </div>
index b08838cac8831ab4ec7f6b84053baa46a59dfd9d..82656d65575b94ecd594e4b24406867ee97ac836 100644 (file)
@@ -30,7 +30,7 @@
                                <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff">
                                        <a class="active item" data-tab="write"><i class="octicon octicon-code"></i> {{if .IsNewFile}}{{.i18n.Tr "repo.editor.new_file"}}{{else}}{{.i18n.Tr "repo.editor.edit_file"}}{{end}}</a>
                                        {{if not .IsNewFile}}
-                                       <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL | EscapePound}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "repo.release.preview"}}</a>
+                                       <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL | EscapePound}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "preview"}}</a>
                                        <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName | EscapePound}}/{{.TreePath | EscapePound}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.editor.preview_changes"}}</a>
                                        {{end}}
                                </div>