Skip to content

Commit be73a54

Browse files
[ADD] sort buttons in grid mode
1 parent 2f0fc62 commit be73a54

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

modules/caddyhttp/fileserver/browse.html

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,96 @@ <h1>
828828
</svg>
829829
Grid
830830
</a>
831+
{{- if and (eq .Layout "grid") (eq .Sort "name") (ne .Order "asc")}}
832+
<a href="?sort=name&order=asc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
833+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
834+
<text x="2" y="10" font-size="9" fill="currentColor">Z</text>
835+
<text x="2" y="20" font-size="9" fill="currentColor">A</text>
836+
<path d="M13 4v12"></path>
837+
<path d="M12 16l1 2l1 -2"></path>
838+
</svg>
839+
</a>
840+
{{- else if and (eq .Layout "grid") (eq .Sort "name") (ne .Order "desc")}}
841+
<a href="?sort=name&order=desc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
842+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
843+
<text x="2" y="10" font-size="9" fill="currentColor">A</text>
844+
<text x="2" y="20" font-size="9" fill="currentColor">Z</text>
845+
<path d="M13 4v12"></path>
846+
<path d="M12 16l1 2l1 -2"></path>
847+
</svg>
848+
</a>
849+
{{- else if and (eq .Layout "grid")}}
850+
<a href="?sort=name&order=asc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
851+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
852+
<text x="2" y="20" font-size="9" fill="currentColor">A</text>
853+
<text x="2" y="10" font-size="9" fill="currentColor">Z</text>
854+
<path d="M13 4v12"></path>
855+
<path d="M12 16l1 2l1 -2"></path>
856+
</svg>
857+
</a>
858+
{{- end}}
859+
{{- if and (eq .Layout "grid") (eq .Sort "size") (ne .Order "asc")}}
860+
<a href="?sort=size&order=asc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
861+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
862+
<rect x="2" y="4" width="4" height="3" rx="0.4" ry="0.4"></rect>
863+
<rect x="2" y="10" width="8" height="3" rx="0.4" ry="0.4"></rect>
864+
<rect x="2" y="16" width="12" height="3" rx="0.4" ry="0.4"></rect>
865+
<path d="M18 4v12"></path>
866+
<path d="M17 16l1 2l1 -2"></path>
867+
</svg>
868+
</a>
869+
{{- else if and (eq .Layout "grid") (eq .Sort "size") (ne .Order "desc")}}
870+
<a href="?sort=size&order=desc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
871+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
872+
<rect x="2" y="4" width="12" height="3" rx="0.4" ry="0.4"></rect>
873+
<rect x="2" y="10" width="8" height="3" rx="0.4" ry="0.4"></rect>
874+
<rect x="2" y="16" width="4" height="3" rx="0.4" ry="0.4"></rect>
875+
<path d="M18 4v12"></path>
876+
<path d="M17 16l1 2l1 -2"></path>
877+
</svg>
878+
</a>
879+
{{- else if and (eq .Layout "grid")}}
880+
<a href="?sort=size&order=asc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
881+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
882+
<rect x="2" y="4" width="4" height="3" rx="0.4" ry="0.4"></rect>
883+
<rect x="2" y="10" width="8" height="3" rx="0.4" ry="0.4"></rect>
884+
<rect x="2" y="16" width="12" height="3" rx="0.4" ry="0.4"></rect>
885+
<path d="M18 4v12"></path>
886+
<path d="M17 16l1 2l1 -2"></path>
887+
</svg>
888+
</a>
889+
{{- end}}
890+
{{- if and (eq .Layout "grid") (eq .Sort "time") (ne .Order "asc")}}
891+
<a href="?sort=time&order=asc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
892+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
893+
<circle cx="9" cy="11" r="8"></circle>
894+
<line x1="9" y1="12" x2="9" y2="7" stroke-linecap="round"></line>
895+
<line x1="9" y1="12" x2="12" y2="12" stroke-linecap="round"></line>
896+
<path d="M20 4v12"></path>
897+
<path d="M19 16l1 2l1 -2"></path>
898+
</svg>
899+
</a>
900+
{{- else if and (eq .Layout "grid") (eq .Sort "time") (ne .Order "desc")}}
901+
<a href="?sort=time&order=desc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
902+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
903+
<circle cx="9" cy="11" r="8"></circle>
904+
<line x1="9" y1="12" x2="9" y2="7" stroke-linecap="round"></line>
905+
<line x1="9" y1="12" x2="12" y2="12" stroke-linecap="round"></line>
906+
<path d="M20 4v12"></path>
907+
<path d="M19 5l1 -2l1 2"></path>
908+
</svg>
909+
</a>
910+
{{- else if and (eq .Layout "grid")}}
911+
<a href="?sort=time&order=asc{{if ne 0 .Limit}}&limit={{.Limit}}{{end}}{{if ne 0 .Offset}}&offset={{.Offset}}{{end}}&layout=grid">
912+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
913+
<circle cx="9" cy="11" r="8"></circle>
914+
<line x1="9" y1="12" x2="9" y2="7" stroke-linecap="round"></line>
915+
<line x1="9" y1="12" x2="12" y2="12" stroke-linecap="round"></line>
916+
<path d="M20 4v12"></path>
917+
<path d="M19 16l1 2l1 -2"></path>
918+
</svg>
919+
</a>
920+
{{- end}}
831921
</div>
832922
<div class='listing{{if eq .Layout "grid"}} grid{{end}}'>
833923
{{- if eq .Layout "grid"}}

0 commit comments

Comments
 (0)