Browse Source

Adding hilighting type and lines count to file view header

pull/4300/head
brian.paulson 8 years ago
parent
commit
06ebe7e3ad
  1. 1
      routers/repo/view.go
  2. 17
      templates/repo/view_file.tmpl

1
routers/repo/view.go

@ -185,6 +185,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
output.WriteString(fmt.Sprintf(`<span id="L%d">%d</span>`, i+1, i+1))
}
ctx.Data["LineNums"] = gotemplate.HTML(output.String())
ctx.Data["LineCount"] = len(lines)
}
if canEnableEditor {

17
templates/repo/view_file.tmpl

@ -5,11 +5,22 @@
{{if .ReadmeInList}}
<strong>{{.FileName}}</strong>
{{else}}
<strong>{{.FileName}}</strong> <span class="text grey normal">{{FileSize .FileSize}}</span>
<div class="ui large breadcrumb">
<strong>{{.FileName}}</strong> <span class="text grey normal">{{FileSize .FileSize}}</span>
<div class="divider">|</div>
<span class="text grey small">{{.LineCount}} lines </span>
<div class="divider">|</div>
<span class="text grey small">Highlighting: {{ .HighlightClass }}</span>
</div>
{{end}}
{{else}}
<i class="file text outline icon ui left"></i>
<strong>{{.FileName}}</strong> <span class="text grey normal">{{FileSize .FileSize}}</span>
<div class="ui large breadcrumb">
<i class="file text outline icon ui left"></i><strong>{{.FileName}}</strong> <span class="text grey normal">{{FileSize .FileSize}}</span>
<div class="divider">|</div>
<span class="text grey small">{{.LineCount}} lines </span>
<div class="divider">|</div>
<span class="text grey small">Highlighting: {{ .HighlightClass }}</span>
</div>
{{end}}
{{if not .ReadmeInList}}
<div class="ui right file-actions">

Loading…
Cancel
Save