diff options
author | Unknwon <u@gogs.io> | 2016-08-14 23:02:14 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-14 23:52:24 -0700 |
commit | cd89f6c5021ef129ecc4652aa620a3562ae30979 (patch) | |
tree | bf476d81479f249d5a1cfb195af2fdee3890d9a1 /templates/repo/editor/diff_preview.tmpl | |
parent | 660e7a178a9d72a03d13f704aca61726b4672232 (diff) | |
download | gitea-cd89f6c5021ef129ecc4652aa620a3562ae30979.tar.gz gitea-cd89f6c5021ef129ecc4652aa620a3562ae30979.zip |
Web editor: improve edit file and diff preview
Diffstat (limited to 'templates/repo/editor/diff_preview.tmpl')
-rw-r--r-- | templates/repo/editor/diff_preview.tmpl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/templates/repo/editor/diff_preview.tmpl b/templates/repo/editor/diff_preview.tmpl new file mode 100644 index 0000000000..1c4787a33c --- /dev/null +++ b/templates/repo/editor/diff_preview.tmpl @@ -0,0 +1,32 @@ +{{$highlightClass := .File.GetHighlightClass}} +<div class="diff-file-box diff-box file-content" id="diff-{{.Index}}"> + <div class="ui attached table segment"> + <div class="file-body file-code code-view code-diff"> + <table> + <tbody> + {{range $j, $section := .File.Sections}} + {{range $k, $line := $section.Lines}} + <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}"> + {{if eq .GetType 4}} + <td colspan="2" class="lines-num"> + {{/* {{if gt $j 0}}<span class="fold octicon octicon-fold"></span>{{end}} */}} + </td> + {{else}} + <td class="lines-num lines-num-old"> + <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $.File.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span> + </td> + <td class="lines-num lines-num-new"> + <span rel="{{if $line.RightIdx}}diff-{{Sha1 $.File.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span> + </td> + {{end}} + <td class="lines-code"> + <pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre> + </td> + </tr> + {{end}} + {{end}} + </tbody> + </table> + </div> + </div> +</div> |