move templates into subdir

This commit is contained in:
Mike McLean 2025-03-17 23:15:20 -04:00 committed by Tomas Kopecek
parent 4e407c7f1b
commit 0fa58716cc
52 changed files with 117 additions and 120 deletions

View file

@ -1,4 +1,4 @@
SUBDIRS = includes
SUBDIRS = templates
SERVERDIR = /usr/share/koji-web/scripts
FILES = $(wildcard *.py *.html.j2)

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
#set _PASSTHROUGH = ['userID']
@ -26,4 +26,4 @@
#endfor
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,4 +1,4 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>API reference <small>(hub version: {{ koji_version }}, web version: {{ web_version }})</small></h4>
@ -34,4 +34,4 @@ except koji.GenericError:
#endfor
</ul>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,8 +1,8 @@
#set _PASSTHROUGH = ['archiveID', 'fileOrder', 'fileStart', 'buildrootOrder', 'buildrootStart']
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Information for archive <a href="archiveinfo?archiveID={{ archive.id }}">{{ archive.filename }}</a></h4>
<table>
@ -157,4 +157,4 @@
#endif
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
#macro getID()
#if type == 'image'
@ -90,4 +90,4 @@ buildrootID={{ buildroot.id }}
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
#set nvrpath = pathinfo.build(build)
<h4>Information for build <a href="buildinfo?buildID={{ build.id }}">{{ koji.buildLabel(build) }}</a></h4>
@ -258,4 +258,4 @@
#endif
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Information for buildroot <a href="buildrootinfo?buildrootID={{ buildroot.id }}">{{ util.brLabel(buildroot) }}</a></h4>
@ -56,4 +56,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Information for external buildroot <a href="buildrootinfo?buildrootID={{ buildroot.id }}">{{ util.brLabel(buildroot) }}</a></h4>
@ -41,4 +41,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,8 +1,8 @@
#set _PASSTHROUGH = ['repoID', 'order', 'state']
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Buildroots in repo <a href="repoinfo?repoID={{ repoID }}">{{ repoID }}</a></h4>
@ -93,4 +93,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,8 +1,8 @@
#set _PASSTHROUGH = ['userID', 'tagID', 'packageID', 'order', 'prefix', 'state', 'inherited', 'latest', 'type']
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
#macro getDescription()
#if latest
@ -185,4 +185,4 @@ in tag <a href="taginfo?tagID={{ tag.id }}">{{ tag.name }}</a>
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -8,7 +8,7 @@
#set numTotal = numSucceeded + numFailed + numCanceled
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Succeeded/Failed/Canceled Builds{{ ' in the last %i days' % days if days != -1 else '' }}</h4>
<table class="data-list">
@ -60,4 +60,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -6,8 +6,8 @@
<option value="{{ value }}"{{ ' selected' if value == days else '' }}>{{ label }}</option>
#endmacro
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Builds by Target{{ ' in the last %i days' % days if days != -1 else '' }}</h4>
<table class="data-list">
@ -96,4 +96,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Builds by User</h4>
<table class="data-list">
@ -70,4 +70,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
#if target
<h4>Edit target {{ target.name }}</h4>
@ -59,4 +59,4 @@
</table>
</form>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,4 +1,4 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Information for target <a href="buildtargetinfo?targetID={{ target.id }}">{{ target.name }}</a></h4>
@ -25,4 +25,4 @@
#endif
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Build Targets</h4>
<table class="data-list">
@ -73,4 +73,4 @@
<a href="buildtargetcreate{{ util.authToken(first=True) }}">Create new Build Target</a>
#endif
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Information for channel <a href="channelinfo?channelID={{ channel.id }}">{{ channel.name }}</a></h4>
@ -57,4 +57,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -6,7 +6,7 @@
<option value="{{ value }}"{{ ' selected' if value == arch else '' }}>{{ label }}</option>
#endmacro
#include "includes/header.html.j2"
#include "header.html.j2"
<style>
span {
display: inline-block;
@ -80,4 +80,4 @@
#endfor
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,4 +1,4 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Error</h4>
@ -24,4 +24,4 @@
</pre>
</div>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,4 +1,4 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Information for external repo <a href="externalrepoinfo?extrepoID={{ extRepo.id }}">{{ extRepo.name }}</a></h4>
@ -26,4 +26,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
#if rpm
<h4>Information for file <a href="fileinfo?rpmID={{ rpm.id }}&amp;filename={{ file.name|urlencode }}">{{ file.name }}</a></h4>
#elif archive
@ -58,4 +58,4 @@
#endif
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Edit host {{ host.name }}</h4>
@ -53,4 +53,4 @@
</table>
</form>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Information for host <a href="hostinfo?hostID={{ host.id }}">{{ host.name }}</a></h4>
@ -88,4 +88,4 @@
#endif
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -35,8 +35,8 @@ in {{ channel }} channel
#set _PASSTHROUGH = ['state', 'order', 'ready', 'channel', 'arch']
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>{{ headerState(state) }} {{ headerReady(ready) }} {{ headerArch(arch) }} {{ headerChannel(channel) }}</h4>
<table class="data-list">
@ -166,4 +166,4 @@ in {{ channel }} channel
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<div class="pageHeader">{{ welcomeMessage }}</div>
@ -157,4 +157,4 @@
<a href="notificationcreate{{ util.authToken(first=True) }}">Add a Notification</a>
#endif
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
#if notif
<h4>Edit notification</h4>
@ -52,4 +52,4 @@
</table>
</form>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Information for package <a href="packageinfo?packageID={{ package.id }}">{{ package.name }}</a></h4>
@ -124,4 +124,4 @@
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,8 +1,8 @@
#set _PASSTHROUGH = ['userID', 'tagID', 'order', 'prefix', 'inherited', 'blocked']
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
#macro getDescription()
Packages
@ -134,4 +134,4 @@ owned by <a href="userinfo?userID={{ user.id }}">{{ user.name }}</a>
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Packages by User</h4>
<table class="data-list">
@ -70,4 +70,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,4 +1,4 @@
{% include "includes/header.html.j2" %}
{% include "header.html.j2" %}
<h4>Information for repo {{ repo_id }}</h4>
@ -23,4 +23,4 @@ Repo {{ repo_id }} not found.
{% endif %}
{% include "includes/footer.html.j2" %}
{% include "footer.html.j2" %}

View file

@ -1,4 +1,4 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Reports</h4>
@ -16,4 +16,4 @@
#endif
</ul>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,8 +1,8 @@
#set _PASSTHROUGH = ['rpmID', 'fileOrder', 'fileStart', 'buildrootOrder', 'buildrootStart']
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
#set epoch = (rpm.epoch|string + ':' if rpm.epoch != None else '')
<h4>Information for RPM <a href="rpminfo?rpmID={{ rpm.id }}">{{ rpm.name }}-{{ epoch }}{{ rpm.version }}-{{ rpm.release }}.{{rpm.arch}}.rpm</a></h4>
@ -313,4 +313,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
#macro getID()
#if type == 'image'
@ -107,4 +107,4 @@ colspan="2"
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>{{ rpmArch + ' ' if rpmArch else '' }}RPMs by Host{{ ' (%s)' % hostArch if hostArch else '' }}</h4>
<table class="data-list">
@ -104,4 +104,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
{% include "includes/header.html.j2" %}
{% from 'includes/macros.html.j2' import rowToggle %}
{% include "header.html.j2" %}
{% from 'macros.html.j2' import rowToggle %}
<h4>Search</h4>
@ -113,4 +113,4 @@
</table>
{% endif %}
{% include "includes/footer.html.j2" %}
{% include "footer.html.j2" %}

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
#if tag
<h4>Edit tag {{ tag.name }}</h4>
@ -61,4 +61,4 @@
</table>
</form>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Information for tag <a href="taginfo?tagID={{ tag.id }}">{{ tag.name }}</a></h4>
@ -174,4 +174,4 @@
#endif
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,4 +1,4 @@
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Information for deleted tag <a href="taginfo?tagID={{ tag.id }}">{{ tag.name }}</a></h4>
@ -14,4 +14,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,5 +1,5 @@
#include "includes/header.html.j2"
#include "header.html.j2"
#if inheritanceData
<h4>Edit Parent</h4>
@ -68,4 +68,4 @@
</table>
</form>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Tags</h4>
<table class="data-list">
@ -73,4 +73,4 @@
<a href="tagcreate{{ util.authToken(first=True) }}">Create new Tag</a>
#endif
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -95,7 +95,7 @@ None
#endmacro
#include "includes/header.html.j2"
#include "header.html.j2"
<h4>Information for task <a href="taskinfo?taskID={{ task.id }}">{{ koji.taskLabel(task) }}</a></h4>
@ -321,4 +321,4 @@ None
})();
</script>
#endif
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -34,8 +34,8 @@ All
#set _PASSTHROUGH = ['owner', 'state', 'view', 'method', 'hostID', 'channelID', 'order']
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
#macro getDescription()
{{ headerPrefix(state) }}
@ -219,4 +219,4 @@ in channel <a href="channelinfo?channelID={{ channel.id }}">{{ channel.name }}</
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Tasks by Host{{ ' (%s)' % hostArch if hostArch else '' }}</h4>
<table class="data-list">
@ -87,4 +87,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Tasks by User</h4>
<table class="data-list">
@ -70,4 +70,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Information for user <a href="userinfo?userID={{ user.id }}">{{ user.name }}</a></h4>
@ -105,4 +105,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -1,6 +1,6 @@
#include "includes/header.html.j2"
# from "includes/macros.html.j2" import rowToggle
#include "header.html.j2"
# from "macros.html.j2" import rowToggle
<h4>Users {{ ' starting with "%s"' % prefix if prefix else '' }}</h4>
<table class="data-list">
@ -91,4 +91,4 @@
</tr>
</table>
#include "includes/footer.html.j2"
#include "footer.html.j2"

View file

@ -157,10 +157,6 @@ def get_jinja_env(dirpath):
def _genHTML(environ, fileName):
reqdir = os.path.dirname(environ['SCRIPT_FILENAME'])
if os.getcwd() != reqdir:
os.chdir(reqdir)
if 'koji.currentUser' in environ:
environ['koji.values']['currentUser'] = environ['koji.currentUser']
environ['koji.values']['greeting'] = random.choice(greetings)
@ -183,6 +179,7 @@ def _genHTML(environ, fileName):
else:
environ['koji.values']['LoginDisabled'] = False
reqdir = os.path.dirname(environ['SCRIPT_FILENAME']) + '/templates'
env = get_jinja_env(reqdir)
template = env.get_template(fileName)
return template.render(**environ['koji.values'])