mirror of
https://github.com/thomiceli/opengist.git
synced 2025-06-13 05:47:12 +02:00
Added gist methods related to git + Truncate command output
This commit is contained in:
6
templates/pages/edit.html
vendored
6
templates/pages/edit.html
vendored
@ -53,11 +53,11 @@
|
||||
|
||||
</div>
|
||||
<div id="editors" class="space-y-4">
|
||||
{{ range $filename, $content := .files }}
|
||||
{{ range $file := .files }}
|
||||
<div class="rounded-md border border-1 border-gray-700 editor">
|
||||
<div class="border-b-1 border-gray-700 bg-gray-800 my-auto">
|
||||
<p class="mx-2 my-2 inline-flex">
|
||||
<input type="text" value="{{ $filename }}" name="name" placeholder="Filename with extension" style="line-height: 0.05em; z-index: 99999" class="form-filename bg-gray-900 shadow-sm focus:ring-primary-500 focus:border-primary-500 block w-full sm:text-sm border-gray-700 rounded-l-md">
|
||||
<input type="text" value="{{ $file.Filename }}" name="name" placeholder="Filename with extension" style="line-height: 0.05em; z-index: 99999" class="form-filename bg-gray-900 shadow-sm focus:ring-primary-500 focus:border-primary-500 block w-full sm:text-sm border-gray-700 rounded-l-md">
|
||||
<button style="line-height: 0.05em" class="delete-file -ml-px relative inline-flex items-center space-x-2 px-4 py-2 border border-gray-700 text-sm font-medium rounded-r-md text-slate-300 bg-gray-800 hover:bg-gray-900 focus:outline-none" type="button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
|
||||
@ -65,7 +65,7 @@
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<input type="hidden" value="{{ $content }}" name="content" class="form-filecontent">
|
||||
<input type="hidden" value="{{ $file.Content }}" name="content" class="form-filecontent">
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
23
templates/pages/gist.html
vendored
23
templates/pages/gist.html
vendored
@ -2,30 +2,35 @@
|
||||
{{ template "gist_header" .}}
|
||||
{{ if .files }}
|
||||
<div class="grid gap-y-4">
|
||||
{{ range $filename, $content := .files }}
|
||||
{{ range $file := .files }}
|
||||
<div class="rounded-md border border-1 border-gray-700 overflow-auto">
|
||||
<div class="border-b-1 border-gray-700 bg-gray-800 my-auto block">
|
||||
<div class="ml-4 py-1.5 flex">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 flex text-slate-300" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" />
|
||||
</svg>
|
||||
<span class="flex-auto ml-2 text-sm text-slate-300 filename" id="file-{{ slug $filename }}"><a href="#file-{{ slug $filename }}" class="text-slate-300 hover:text-white">{{ $filename }}</a></span>
|
||||
<span class="flex-auto ml-2 text-sm text-slate-300 filename" id="file-{{ slug $file.Filename }}"><a href="#file-{{ slug $file.Filename }}" class="text-slate-300 hover:text-white">{{ $file.Filename }}</a></span>
|
||||
|
||||
<button class="float-right mx-2 px-2.5 py-0.5 leading-4 rounded-md text-xs font-medium bg-gray-600 border border-gray-500 hover:bg-gray-700 hover:text-slate-300 select-none copy-gist-btn"> Copy </button>
|
||||
<a href="/{{ $.gist.User.Username }}/{{ $.gist.Uuid }}/raw/{{ $.commit }}/{{$filename}}" class="text-slate-300 float-right mr-2 px-2.5 py-0.5 leading-4 rounded-md text-xs font-medium bg-gray-600 border border-gray-500 hover:bg-gray-700 hover:text-slate-300 select-none"> Raw </a>
|
||||
<div class="hidden gist-content">{{ $content }}</div>
|
||||
<a href="/{{ $.gist.User.Username }}/{{ $.gist.Uuid }}/raw/{{ $.commit }}/{{$file.Filename}}" class="text-slate-300 float-right mr-2 px-2.5 py-0.5 leading-4 rounded-md text-xs font-medium bg-gray-600 border border-gray-500 hover:bg-gray-700 hover:text-slate-300 select-none"> Raw </a>
|
||||
<div class="hidden gist-content">{{ $file.Content }}</div>
|
||||
</div>
|
||||
{{ if $file.Truncated }}
|
||||
<div class="text-sm px-4 py-1.5 border-t-1 border-gray-700">
|
||||
This file has been truncated. <a href="/{{ $.gist.User.Username }}/{{ $.gist.Uuid }}/raw/{{ $.commit }}/{{$file.Filename}}">View the full file.</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="code overflow-auto">
|
||||
{{ if isMarkdown $filename }}
|
||||
<div class="markdown markdown-body p-8">{{ $content }}</div>
|
||||
{{ if isMarkdown $file.Filename }}
|
||||
<div class="markdown markdown-body p-8">{{ $file.Content }}</div>
|
||||
{{ else }}
|
||||
{{ $fileslug := slug $filename }}
|
||||
<table class="table-code w-full whitespace-pre" data-filename-slug="{{ $fileslug }}" data-filename="{{ $filename }}" style="font-size: 0.8em; border-spacing: 0; border-collapse: collapse;">
|
||||
{{ $fileslug := slug $file.Filename }}
|
||||
<table class="table-code w-full whitespace-pre" data-filename-slug="{{ $fileslug }}" data-filename="{{ $file.Filename }}" style="font-size: 0.8em; border-spacing: 0; border-collapse: collapse;">
|
||||
<tbody>
|
||||
{{ $ii := "1" }}
|
||||
{{ $i := toInt $ii }}
|
||||
{{ range $line := lines $content }}<tr><td id="file-{{ $fileslug }}-{{$i}}" class="select-none line-num px-4">{{$i}}</td><td class="line-code">{{ $line }}</td></tr>{{ $i = inc $i }}{{ end }}
|
||||
{{ range $line := lines $file.Content }}<tr><td id="file-{{ $fileslug }}-{{$i}}" class="select-none line-num px-4">{{$i}}</td><td class="line-code">{{ $line }}</td></tr>{{ $i = inc $i }}{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user