Skip to content

Commit

Permalink
Fixed #76 and toggle hidden files
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkraft committed Dec 30, 2023
1 parent 6231628 commit 7b5ca5d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
24 changes: 18 additions & 6 deletions odmf/static/templates/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
$('#help-edit').collapse('hide');
});

$('#hiddenFiles').on('change', () => {
$('.hiddenfile').toggleClass('d-none', ~this.checked)
})
$('.hiddenfile').toggleClass('d-none', ~$('#hiddenFiles').prop('checked'))


});
//]]>
</script>
Expand Down Expand Up @@ -170,6 +176,7 @@ <h5 class="card-title">
<span class="badge bg-warning ml-8 float-right" py:content="modes[curdir].name"/>
</h5>
<ul class="nav flex-column card-text mb-3" id="files">

<li class="nav-item flexbox mt-1 pt-1 border-top" py:if="not curdir.isroot()" >
<span >
<a href="${curdir.parent().href}" class="nav-link">
Expand All @@ -194,7 +201,7 @@ <h5 class="card-title">
</button>
</span>
</li>
<li py:for="f in files" class="nav-item flexbox mt-1 pt-1 border-top" >
<li py:for="f in files" class="nav-item flexbox mt-1 pt-1 border-top ${'hiddenfile' if f.ishidden() else ''}" >
<span >
<a href="${f.href}" class="nav-link">
<i class="fas fa-${handler[f].icon} fa-lg" />
Expand All @@ -221,21 +228,26 @@ <h5 class="card-title">

</li>
</ul>
<div class="row">
<button class="btn btn-primary dropdown-toggle mr-3 col-sm" type="button"
<div class="nav">
<button class="btn btn-primary dropdown-toggle mr-3 nav-item" type="button"
id="addFileDropdownButton" data-toggle="dropdown" py:attrs="prop(disabled=modes[curdir]==Mode.read)"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-plus-circle" />
Add files and folders
</button>
<form method="post" action="${conf.root_url}/download/create_access_file" class="col-sm">
<button class="btn btn-warning mr-3" type="submit" name="uri" value="${curdir}"
py:if="modes[curdir]==Mode.admin"
<form method="post" action="${conf.root_url}/download/create_access_file" class="nav-item">
<button class="btn btn-secondary mr-3" type="submit" name="uri" value="${curdir}"
py:if="modes[curdir]>=Mode.admin"
>
<i class="fas fa-cog" /> manage access
</button>

</form>
<div class="nav-item custom-control custom-checkbox" py:if="modes[curdir]>=Mode.admin">
<input type="checkbox" class="custom-control-input" id="hiddenFiles"/>
<label class="custom-control-label" for="hiddenFiles">show hidden files</label>
</div>


<div class="dropdown-menu" aria-labelledby="addFileDropdownButton">
<div class="dropdown-item" >
Expand Down
4 changes: 2 additions & 2 deletions odmf/webpage/filemanager/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def upload(self, dir, datafiles, **kwargs):
def saveindex(self, dir, s):
"""Saves the string s to index.html
"""
path = Path(dir, 'index.html')
path = Path(dir, '.readme.md')
s = s.replace('\r', '')
open(path.absolute, 'w').write(s)
return web.markdown(s)
Expand All @@ -201,7 +201,7 @@ def saveindex(self, dir, s):
@web.method.get
def getindex(self, dir):
io = StringIO()
for indexfile in ['README.md', 'index.html']:
for indexfile in ['.readme.md', 'README.md', 'index.html']:
if (index:=Path(dir, indexfile)).exists():
text = open(index.absolute).read()
io.write(text)
Expand Down

0 comments on commit 7b5ca5d

Please sign in to comment.