Skip to content

Commit

Permalink
show file name
Browse files Browse the repository at this point in the history
  • Loading branch information
fnwinter committed Sep 20, 2024
1 parent 888e9be commit 801ee31
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
19 changes: 13 additions & 6 deletions cnas/genhtml/photo_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ class photo_builder(tag):
def __init__(self, *args, **kwargs):
# no inheritance
super().__init__([], {})

image_file = kwargs.get("src")
file_path = kwargs.get("path")
file_type = kwargs.get("type")

self.set_content(
f"""
<div data-path="{file_path}" class="column is-one-quarter picture">
<figure class="image is-square">
<img src="{image_file}" class="rounded" alt="Placeholder image" style="z-index:-1;">
<div style="overflow: hidden;text-overflow: ellipsis;white-space: wrap;">{file_path}</div>
</figure>
</div>
<div data-path="{file_path}" class="column is-one-quarter picture">
<figure class="image is-square" style="align-items:flex-end; display:flex;">
<img src="{image_file}" class="rounded" style="z-index:-1;">
<div
class="box is-align-content-center"
style="width:100%; overflow:hidden; text-overflow:ellipsis; white-space:wrap; background-color:rgba(0, 0, 0, 0.6);">
{file_path}
</div>
</figure>
</div>
"""
).make_element()
9 changes: 5 additions & 4 deletions cnas/pages/gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def set_current_path(self):
self.set_session("current_path", _full)

def get_files(self):
if self.current_path != self.gallery_path:
self.files.append(
photo_builder(src="static/images/up.png", path=".."))

# folder
for _folder in os.listdir(self.current_path):
_path = os.path.join(self.current_path, _folder)
Expand Down Expand Up @@ -87,10 +91,7 @@ def __str__(self):
br()
)

_div = div(
photo_builder(src="static/images/up.png", path=".."),
class_="'columns is-multiline'"
)
_div = div(class_="'columns is-multiline'")

for _file in self.files:
_div.append(_file)
Expand Down

0 comments on commit 801ee31

Please sign in to comment.