Fix null case of zero files
Committed b079e4
--- a/webint_code/templates/project/index.html
+++ b/webint_code/templates/project/index.html
<a href=/projects/$project/commits><strong>$len(repo.log())</strong> commits</a>
</div>
- <div id=files>
- $ ignorable_files = (
- $ ".github",
- $ ".gitignore",
- $ "README",
- $ "README.md",
- $ "pyproject.toml",
- $ "pyrightconfig.json",
- $ "package.json",
- $ "tsconfig.json",
- $ "webpack.config.js",
- $ )
$ files = sorted(repo.files)
- $ prev_file = None
- <ul>
- $ unique_files = [f for f in files if str(f).partition("/")[0] not in ignorable_files]
- $for file in unique_files:
- $ file, is_dir, _ = str(file).partition("/")
- $if file == prev_file:
- $continue
- <li><a href=/projects/$project/files/$file>$file</a>\
- $if is_dir:
- /
- </li>
- $ prev_file = file
- </ul>
- $ prev_file = None
- $ known_files = [f for f in files if str(f).partition("/")[0] in ignorable_files]
- <p style=color:#586e75>\
- $for file in known_files:
- $ file, is_dir, _ = str(file).partition("/")
- $if file == prev_file:
- $continue
- <a href=/projects/$project/files/$file>$file</a>\
- $if is_dir:
- /\
- $ prev_file = file
- $if not loop.last:
- ,
- </p>
- </div>
+ $if files:
+ <div id=files>
+ $ ignorable_files = (
+ $ ".github",
+ $ ".gitignore",
+ $ "README",
+ $ "README.md",
+ $ "pyproject.toml",
+ $ "pyrightconfig.json",
+ $ "package.json",
+ $ "tsconfig.json",
+ $ "webpack.config.js",
+ $ )
+ $ prev_file = None
+ <ul>
+ $ unique_files = [f for f in files if str(f).partition("/")[0] not in ignorable_files]
+ $for file in unique_files:
+ $ file, is_dir, _ = str(file).partition("/")
+ $if file == prev_file:
+ $continue
+ <li><a href=/projects/$project/files/$file>$file</a>\
+ $if is_dir:
+ /
+ </li>
+ $ prev_file = file
+ </ul>
+ $ prev_file = None
+ $ known_files = [f for f in files if str(f).partition("/")[0] in ignorable_files]
+ <p style=color:#586e75>\
+ $for file in known_files:
+ $ file, is_dir, _ = str(file).partition("/")
+ $if file == prev_file:
+ $continue
+ <a href=/projects/$project/files/$file>$file</a>\
+ $if is_dir:
+ /\
+ $ prev_file = file
+ $if not loop.last:
+ ,
+ </p>
+ </div>
$# $ git_url = f"{tx.origin}/code/projects/{project}.git"
$# <pre style=text-align:right><small>$git_url <a href=""