Browse Source

css: not include line numbers in diff selection (#4584)

Changed template file in order to make CSS work properly.
pull/4633/head
Unknwon 8 years ago
parent
commit
c970c4ee41
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      gogs.go
  2. 3
      public/css/gogs.css
  3. 4
      public/less/_repository.less
  4. 2
      templates/.VERSION
  5. 18
      templates/repo/diff/section_unified.tmpl

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/pkg/setting" "github.com/gogits/gogs/pkg/setting"
) )
const APP_VER = "0.11.24.0627" const APP_VER = "0.11.25.0714"
func init() { func init() {
setting.AppVer = APP_VER setting.AppVer = APP_VER

3
public/css/gogs.css

@ -2140,6 +2140,9 @@ footer .ui.language .menu {
padding: 0 5px; padding: 0 5px;
user-select: none; user-select: none;
} }
.repository .diff-file-box .code-diff .lines-num::before {
content: attr(data-line-number);
}
.repository .diff-file-box .code-diff .lines-num.lines-num-old, .repository .diff-file-box .code-diff .lines-num.lines-num-old,
.repository .diff-file-box .code-diff .lines-num.lines-num-new { .repository .diff-file-box .code-diff .lines-num.lines-num-new {
cursor: pointer; cursor: pointer;

4
public/less/_repository.less

@ -1057,6 +1057,10 @@
padding: 0 5px; padding: 0 5px;
user-select: none; user-select: none;
&::before {
content: attr(data-line-number);
}
&.lines-num-old, &.lines-num-new { &.lines-num-old, &.lines-num-new {
cursor: pointer; cursor: pointer;
&:hover { &:hover {

2
templates/.VERSION

@ -1 +1 @@
0.11.24.0627 0.11.25.0714

18
templates/repo/diff/section_unified.tmpl

@ -4,20 +4,12 @@
{{range $k, $line := $section.Lines}} {{range $k, $line := $section.Lines}}
<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}"> <tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
{{if eq .GetType 4}} {{if eq .GetType 4}}
<td colspan="2" class="lines-num"> <td colspan="2" class="lines-num">
{{/* {{if gt $j 0}}<span class="fold octicon octicon-fold"></span>{{end}} */}} {{/* {{if gt $j 0}}<span class="fold octicon octicon-fold"></span>{{end}} */}}
</td> </td>
{{else}} {{else}}
<td class="lines-num lines-num-old" {{if $line.LeftIdx}}id="diff-{{$file.Index}}L{{$line.LeftIdx}}"{{end}}> <td class="lines-num lines-num-old" {{if $line.LeftIdx}} id="diff-{{$file.Index}}L{{$line.LeftIdx}}" data-line-number="{{$line.LeftIdx}}"{{end}}></td>
{{if $line.LeftIdx}} <td class="lines-num lines-num-new" {{if $line.RightIdx}} id="diff-{{$file.Index}}R{{$line.RightIdx}}" data-line-number="{{$line.RightIdx}}"{{end}}></td>
<span>{{$line.LeftIdx}}</span>
{{end}}
</td>
<td class="lines-num lines-num-new" {{if $line.RightIdx}}id="diff-{{$file.Index}}R{{$line.RightIdx}}"{{end}}>
{{if $line.RightIdx}}
<span>{{$line.RightIdx}}</span>
{{end}}
</td>
{{end}} {{end}}
<td class="lines-code"> <td class="lines-code">
<pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.ComputedInlineDiffFor $line}}</code></pre> <pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.ComputedInlineDiffFor $line}}</code></pre>

Loading…
Cancel
Save