From 8c5a635de9253e3a4cfdb929dbd69f7b7d9634fd Mon Sep 17 00:00:00 2001
From: Gregor Sturm
Date: Mon, 18 Jan 2021 19:44:55 +0100
Subject: [PATCH] Use url_for in all templates
---
cellxgene_gateway/filecrawl.py | 9 ++++++---
cellxgene_gateway/templates/cellxgene_error.html | 4 ++--
cellxgene_gateway/templates/filecrawl.html | 4 ++--
cellxgene_gateway/templates/loading.html | 4 ++--
cellxgene_gateway/templates/process_error.html | 4 ++--
5 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/cellxgene_gateway/filecrawl.py b/cellxgene_gateway/filecrawl.py
index aa15eef..b83d70d 100644
--- a/cellxgene_gateway/filecrawl.py
+++ b/cellxgene_gateway/filecrawl.py
@@ -45,10 +45,13 @@ def recurse_dir(path):
"name": x[:-13]
if (len(x) > 13 and x[-13] in ["-", "_"])
else (x[:-4] if x.endswith(".csv") else x),
- "path": os.path.join(full_path, x).replace(env.cellxgene_data, ""),
+ "path": os.path.join(full_path, x).replace(
+ env.cellxgene_data, ""
+ ),
}
for x in sorted(os.listdir(full_path))
- if x.endswith(".csv") and os.path.isfile(os.path.join(full_path, x))
+ if x.endswith(".csv")
+ and os.path.isfile(os.path.join(full_path, x))
]
return [
{
@@ -89,7 +92,7 @@ def render_entries(entries):
def get_url(entry):
- return url_for("do_view", path=entry["path"])
+ return url_for("do_view", path=entry["path"].lstrip("/"))
def get_class(entry):
diff --git a/cellxgene_gateway/templates/cellxgene_error.html b/cellxgene_gateway/templates/cellxgene_error.html
index 908b5bf..aea6764 100644
--- a/cellxgene_gateway/templates/cellxgene_error.html
+++ b/cellxgene_gateway/templates/cellxgene_error.html
@@ -28,11 +28,11 @@
{{ message }}
-
+
Please click here to be redirected to the file directory.
-
+
Please click here to return to the homepage.
diff --git a/cellxgene_gateway/templates/filecrawl.html b/cellxgene_gateway/templates/filecrawl.html
index 7d59e34..e31f54d 100644
--- a/cellxgene_gateway/templates/filecrawl.html
+++ b/cellxgene_gateway/templates/filecrawl.html
@@ -36,10 +36,10 @@
Navigation: