fix html links for items in vfs root

This commit is contained in:
ed 2019-07-08 18:00:35 +00:00
parent f7b19a04e1
commit 88701157d5
5 changed files with 26 additions and 20 deletions

View file

@ -597,7 +597,9 @@ class HttpCli(object):
return True
def tx_mounts(self):
html = self.conn.tpl_mounts.render(this=self)
rvol = [x + "/" if x else x for x in self.rvol]
wvol = [x + "/" if x else x for x in self.wvol]
html = self.conn.tpl_mounts.render(this=self, rvol=rvol, wvol=wvol)
self.reply(html.encode("utf-8"))
return True
@ -610,13 +612,14 @@ class HttpCli(object):
def tx_browser(self):
vpath = ""
vpnodes = [["", "/"]]
for node in self.vpath.split("/"):
if not vpath:
vpath = node
else:
vpath += "/" + node
if self.vpath:
for node in self.vpath.split("/"):
if not vpath:
vpath = node
else:
vpath += "/" + node
vpnodes.append([quotep(vpath) + "/", cgi.escape(node)])
vpnodes.append([quotep(vpath) + "/", cgi.escape(node)])
vn, rem = self.auth.vfs.get(self.vpath, self.uname, True, False)
abspath = vn.canonical(rem)
@ -635,7 +638,7 @@ class HttpCli(object):
files = []
for fn in exclude_dotfiles(vfs_ls):
href = fn
if self.absolute_urls:
if self.absolute_urls and vpath:
href = "/" + vpath + "/" + fn
fspath = fsroot + "/" + fn

View file

@ -32,7 +32,7 @@ body {
font-weight: normal;
background: #4c4c4c;
display: inline-block;
padding: .35em .5em .2em 1em;
padding: .35em .5em .2em .5em;
border-radius: 0 .3em .3em 0;
box-shadow: .1em .1em .4em #222;
margin: 1em 0;
@ -104,8 +104,14 @@ a {
#path a {
margin: 0 0 0 -.2em;
padding: 0 0 0 .4em;
/* ie: */
border-bottom: .1em solid #777\9;
margin-right: 1em\9;
}
#path a:after {
#path a:first-child {
padding-left: .8em;
}
#path a:not(:last-child):after {
content: '';
width: 1.05em;
height: 1.05em;
@ -120,9 +126,6 @@ a {
color: #fff;
background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,0.2), rgba(0,0,0,0));
}
#path span {
padding-left: .2em;
}
.logue {
padding: .2em 1.5em;
}

View file

@ -18,10 +18,9 @@
{%- endif %}
<h1 id="path">
{%- for n in vpnodes[:-1] %}
{%- for n in vpnodes %}
<a href="/{{ n[0] }}">{{ n[1] }}</a>
{%- endfor %}
<span>{{ vpnodes[-1][1] }}</span>
</h1>
{%- if prologue %}

View file

@ -20,7 +20,8 @@ li {
a {
color: #047;
background: #fff;
text-decoration: none;
border-bottom: 1px solid #aaa;
border-radius: .2em;
padding: .2em .5em;
padding: .2em .8em;
}

View file

@ -15,15 +15,15 @@
<h1>you can browse these:</h1>
<ul>
{% for mp in this.rvol %}
<li><a href="/{{ mp }}/">/{{ mp }}/</a></li>
{% for mp in rvol %}
<li><a href="/{{ mp }}">/{{ mp }}</a></li>
{% endfor %}
</ul>
<h1>you can upload to:</h1>
<ul>
{% for mp in this.wvol %}
<li><a href="/{{ mp }}/">/{{ mp }}/</a></li>
{% for mp in wvol %}
<li><a href="/{{ mp }}">/{{ mp }}</a></li>
{% endfor %}
</ul>