Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
surfer-okd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PUBLIC
surfer-okd
Commits
8a3d0eee
Commit
8a3d0eee
authored
Apr 09, 2017
by
Johannes Zellner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make folder listing sortable
parent
c03cdd30
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
525 additions
and
17 deletions
+525
-17
style.css
frontend/css/style.css
+10
-5
index.html
frontend/index.html
+13
-12
app.js
frontend/js/app.js
+7
-0
sorttable.js
frontend/js/sorttable.js
+495
-0
No files found.
frontend/css/style.css
View file @
8a3d0eee
...
@@ -39,10 +39,6 @@ pre {
...
@@ -39,10 +39,6 @@ pre {
cursor
:
pointer
;
cursor
:
pointer
;
}
}
th
{
vertical-align
:
middle
!important
;
}
.main
{
.main
{
margin-bottom
:
40px
;
margin-bottom
:
40px
;
}
}
...
@@ -65,7 +61,8 @@ footer:hover {
...
@@ -65,7 +61,8 @@ footer:hover {
opacity
:
1
;
opacity
:
1
;
}
}
th
{
td
{
vertical-align
:
middle
!important
;
overflow
:
hidden
;
overflow
:
hidden
;
}
}
...
@@ -77,3 +74,11 @@ th {
...
@@ -77,3 +74,11 @@ th {
tr
:hover
.entry-toolbar
{
tr
:hover
.entry-toolbar
{
opacity
:
1
;
opacity
:
1
;
}
}
table
.sortable
th
:not
(
.sorttable_sorted
)
:not
(
.sorttable_sorted_reverse
)
:not
(
.sorttable_nosort
)
:after
{
content
:
" \25B4\25BE"
}
th
{
cursor
:
pointer
;
}
frontend/index.html
View file @
8a3d0eee
...
@@ -160,34 +160,34 @@
...
@@ -160,34 +160,34 @@
</center>
</center>
</div>
</div>
<div
class=
"col-lg-12"
v-show=
"!busy"
>
<div
class=
"col-lg-12"
v-show=
"!busy"
>
<table
class=
"table table-hover table-condensed"
>
<table
class=
"table table-hover table-condensed
sortable
"
>
<thead>
<thead>
<tr>
<tr>
<th>
Type
</th>
<th>
Type
</th>
<th>
Name
</th>
<th>
Name
</th>
<th>
Size
</th>
<th
class=
"sorttable_numeric"
>
Size
</th>
<th>
Modified
</th>
<th
class=
"sorttable_numeric"
>
Modified
</th>
<th
>
</th>
<th
class=
"sorttable_nosort"
style=
"text-align: right;"
>
Actions
</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
<tr
v-show=
"entries.length === 0"
>
<tr
v-show=
"entries.length === 0"
>
<t
h
colspan=
"5"
><i>
Empty folder
</i></th
>
<t
d
colspan=
"5"
><i>
Empty folder
</i></td
>
</tr>
</tr>
<tr
v-for=
"entry in entries"
v-on:click=
"open(entry)"
class=
"hand"
>
<tr
v-for=
"entry in entries"
v-on:click=
"open(entry)"
class=
"hand"
>
<t
h
>
<t
d
sorttable_customkey=
"{{ entry.extension }}"
>
<img
v-bind:src=
"entry.previewUrl"
height=
"48px"
width=
"48px"
/>
<img
v-bind:src=
"entry.previewUrl"
height=
"48px"
width=
"48px"
/>
</t
h
>
</t
d
>
<t
h>
{{ entry.filePath }}
</th
>
<t
d>
{{ entry.filePath }}
</td
>
<t
h>
{{ entry.size | prettyFileSize }}
</th
>
<t
d
sorttable_customkey=
"{{ entry.size }}"
>
{{ entry.size | prettyFileSize }}
</td
>
<t
h><span
v-my-tooltip=
"foobar"
data-toggle=
"tooltip"
title=
"{{ entry.mtime }}"
>
{{ entry.mtime | prettyDate }}
</span></th
>
<t
d><span
v-my-tooltip=
"foobar"
data-toggle=
"tooltip"
title=
"{{ entry.mtime }}"
>
{{ entry.mtime | prettyDate }}
</span></td
>
<t
h
style=
"text-align: right;"
>
<t
d
style=
"text-align: right;"
>
<span
class=
"entry-toolbar"
>
<span
class=
"entry-toolbar"
>
<button
class=
"btn btn-sm btn-default"
v-on:click
.
stop=
"download(entry)"
title=
"Download"
v-show=
"entry.isFile"
><i
class=
"fa fa-download"
></i></button>
<button
class=
"btn btn-sm btn-default"
v-on:click
.
stop=
"download(entry)"
title=
"Download"
v-show=
"entry.isFile"
><i
class=
"fa fa-download"
></i></button>
<button
class=
"btn btn-sm btn-default"
v-on:click
.
stop=
"renameAsk(entry)"
title=
"Rename"
><i
class=
"fa fa-pencil"
></i></button>
<button
class=
"btn btn-sm btn-default"
v-on:click
.
stop=
"renameAsk(entry)"
title=
"Rename"
><i
class=
"fa fa-pencil"
></i></button>
<button
class=
"btn btn-sm btn-danger"
v-on:click
.
stop=
"delAsk(entry)"
title=
"Delete"
><i
class=
"fa fa-trash"
></i></button>
<button
class=
"btn btn-sm btn-danger"
v-on:click
.
stop=
"delAsk(entry)"
title=
"Delete"
><i
class=
"fa fa-trash"
></i></button>
</span>
</span>
</t
h
>
</t
d
>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
...
@@ -205,6 +205,7 @@
...
@@ -205,6 +205,7 @@
<script
src=
"/_admin/js/vue.min.js"
></script>
<script
src=
"/_admin/js/vue.min.js"
></script>
<script
src=
"/_admin/js/filesize.min.js"
></script>
<script
src=
"/_admin/js/filesize.min.js"
></script>
<script
src=
"/_admin/js/superagent.js"
></script>
<script
src=
"/_admin/js/superagent.js"
></script>
<script
src=
"/_admin/js/sorttable.js"
></script>
<script
src=
"/_admin/js/app.js"
></script>
<script
src=
"/_admin/js/app.js"
></script>
</body>
</body>
...
...
frontend/js/app.js
View file @
8a3d0eee
...
@@ -85,6 +85,12 @@ function getPreviewUrl(entry, basePath) {
...
@@ -85,6 +85,12 @@ function getPreviewUrl(entry, basePath) {
return
path
+
'unknown.png'
;
return
path
+
'unknown.png'
;
}
}
// simple extension detection, does not work with double extension like .tar.gz
function
getExtension
(
entry
)
{
if
(
entry
.
isFile
)
return
entry
.
filePath
.
slice
(
entry
.
filePath
.
lastIndexOf
(
'.'
)
+
1
);
return
''
;
}
function
refresh
()
{
function
refresh
()
{
loadDirectory
(
app
.
path
);
loadDirectory
(
app
.
path
);
}
}
...
@@ -103,6 +109,7 @@ function loadDirectory(filePath) {
...
@@ -103,6 +109,7 @@ function loadDirectory(filePath) {
result
.
body
.
entries
.
sort
(
function
(
a
,
b
)
{
return
a
.
isDirectory
&&
b
.
isFile
?
-
1
:
1
;
});
result
.
body
.
entries
.
sort
(
function
(
a
,
b
)
{
return
a
.
isDirectory
&&
b
.
isFile
?
-
1
:
1
;
});
app
.
entries
=
result
.
body
.
entries
.
map
(
function
(
entry
)
{
app
.
entries
=
result
.
body
.
entries
.
map
(
function
(
entry
)
{
entry
.
previewUrl
=
getPreviewUrl
(
entry
,
filePath
);
entry
.
previewUrl
=
getPreviewUrl
(
entry
,
filePath
);
entry
.
extension
=
getExtension
(
entry
);
return
entry
;
return
entry
;
});
});
app
.
path
=
filePath
;
app
.
path
=
filePath
;
...
...
frontend/js/sorttable.js
0 → 100644
View file @
8a3d0eee
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment