forked from kevadesu/forgejo
Simplify template helper functions (#24570)
To avoid bloating the template helper functions, some functions could be provided by type methods. And the new code `data-line-type="{{.GetHTMLDiffLineType}}"` reads better than `data-line-type="{{DiffLineTypeToStr .GetType}}"` After the fix, screenshots (the same as before): <details>   </details>
This commit is contained in:
parent
377e0139b0
commit
56ae853ca0
6 changed files with 20 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
|||
{{if $.IsSplitStyle}}
|
||||
{{range $k, $line := $.section.Lines}}
|
||||
<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
|
||||
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}">
|
||||
{{if eq .GetType 4}}
|
||||
<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}">
|
||||
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
|
||||
|
@ -44,7 +44,7 @@
|
|||
{{end}}
|
||||
{{else}}
|
||||
{{range $k, $line := $.section.Lines}}
|
||||
<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
|
||||
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}">
|
||||
{{if eq .GetType 4}}
|
||||
<td colspan="2" class="lines-num">
|
||||
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue