Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
GerbenAaltink committed Mar 3, 2021
1 parent d18143c commit 4039a59
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 39 additions & 5 deletions aiodav/templates/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,46 @@
<title>{{ path.name or "/" }}</title>
<link href="https://fonts.googleapis.com/css2?family=Material+Icons"
rel="stylesheet">
<script type="text/javascript">
function randomHSL(){
return "hsla(" + ~~(360 * Math.random()) + "," +
"70%,"+
"80%,1)"
}
document.querySelectorAll('div').forEach((el)=>{
el.style.backgroundColor = randomHSL();
})
//document.body.style.backgroundColor = randomHSL()

</script>
<style type="text/css">
.flex-container {
display: flex;
flex-wrap: wrap;
background-color: DodgerBlue;
}
.flex-container > div {
background-color: #f1f1f1;
margin: 10px;
padding: 20px;
font-size: 30px;
flex-grow: true;
}
.item {
display: flex;
flex-wrap: wrap;
background-color: red;
height:50px;
width: 50px;

}

</style>
</head>
<body>

<table>

<thead>
<tr>
{# https://google.github.io/material-design-icons/#icon-font-for-the-web #}
Expand All @@ -18,17 +55,14 @@
</thead>
<tbody>
{% for f in path.glob('*') %}
{# https://material.io/resources/icons/?style=baseline #}
<tr>
<td>
{% if f.is_file() %}<span class="material-icons">file_download</span>{% endif %}
<td>
{% if f.is_file() %}<span class="material-icons">file_download</span>{% endif %}
{% if f.is_dir() %}<span class="material-icons">folder_open</span>{% endif %}
<span class="material-icons">delete_forever</span>
<span class="material-icons">mode_edit</span></td>
<td><a href="/browser/{{ f }}">{{ f.name }}</a></td>
<td>{{ f.suffix }}</td>
<td>
</td>
</tr>
{% endfor %}
</tbody>
Expand Down
102 changes: 102 additions & 0 deletions aiodav/templates/browser__2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ path.name or "/" }}</title>
<link href="https://fonts.googleapis.com/css2?family=Material+Icons"
rel="stylesheet">
<script type="text/javascript">
function randomHSL(){
return "hsla(" + ~~(360 * Math.random()) + "," +
"70%,"+
"80%,1)"
}
document.querySelectorAll('div').forEach((el)=>{
el.style.backgroundColor = randomHSL();
})
//document.body.style.backgroundColor = randomHSL()

</script>
<style type="text/css">
.flex-container {
display: flex;
flex-wrap: wrap;
background-color: DodgerBlue;
}
.flex-container > div {
background-color: #f1f1f1;
margin: 10px;
padding: 20px;
font-size: 30px;
flex-grow: true;
}
.item {
display: flex;
flex-wrap: wrap;
background-color: red;
height:50px;
width: 50px;

}

</style>
</head>
<body>
<div class="flex-container">
{% for f in path.glob('j.mp4') %}
{# https://material.io/resources/icons/?style=baseline #}
<div>
<div>
<a href="/browser/{{ f }}">{{ f.name }}</a>
</div>
{% if f.is_file() %}<span class="material-icons">file_download</span>{% endif %}
{% if f.is_dir() %}<span class="material-icons">folder_open</span>{% endif %}
<span class="material-icons">delete_forever</span>
<span class="material-icons">mode_edit</span>
{{ f.suffix }}
</div>
{% endfor %}
</div>
<table>

<thead>
<tr>
{# https://google.github.io/material-design-icons/#icon-font-for-the-web #}
<span class="material-icons">face</span>
<th colspan="999">{{ path.resolve() }}</th>
</tr>

</thead>
<tbody>
{% for f in path.glob('*') %}
{# https://material.io/resources/icons/?style=baseline #}
<tr>
<td>
{% for f in path.glob('*') %}
{# https://material.io/resources/icons/?style=baseline #}
<tr>
<td>
{% if f.is_file() %}<span class="material-icons">file_download</span>{% endif %}
{% if f.is_dir() %}<span class="material-icons">folder_open</span>{% endif %}
<span class="material-icons">delete_forever</span>
<span class="material-icons">mode_edit</span></td>
<td><a href="/browser/{{ f }}">{{ f.name }}</a></td>
<td>{{ f.suffix }}</td>
<td>
</td>
</tr>
{% endfor %} {% if f.is_file() %}<span class="material-icons">file_download</span>{% endif %}
{% if f.is_dir() %}<span class="material-icons">folder_open</span>{% endif %}
<span class="material-icons">delete_forever</span>
<span class="material-icons">mode_edit</span></td>
<td><a href="/browser/{{ f }}">{{ f.name }}</a></td>
<td>{{ f.suffix }}</td>
<td>
</td>
</tr>
{% endfor %}
</tbody>
<tfoot></tfoot>
</table>
</body>
</html>
4 changes: 2 additions & 2 deletions aiodav/views/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def get(self):

user = await self.resolve_user()

root = pathlib.Path(self.request.match_info.get("tail"))
root = user.joinpath(self.request.match_info.get("tail"))
print(root)

if root.is_file():
Expand All @@ -40,4 +40,4 @@ async def get(self):
files=files,
path=root,
)
return aiohttp_jinja2.render_template("browser.html", self.request, context)
return aiohttp_jinja2.render_template("browser__2.html", self.request, context)
3 changes: 2 additions & 1 deletion tests/views/test_get.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@


async def test():

0 comments on commit 4039a59

Please sign in to comment.