-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathindex.njk
More file actions
104 lines (94 loc) · 3.76 KB
/
index.njk
File metadata and controls
104 lines (94 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{% extends "page.njk" %}
{% block body %}
<section class="hero is-dark">
<div class="hero-body">
<div class="container">
<h1 class="title is-1">
Accord Project <span class="has-light">Template Library</span>
</h1>
<h2 class="subtitle">
This library contains all Accord Project contract and clause templates. Templates are captured using the Accord Project Cicero format. To contribute new templates (or fix existing templates), you can fork this <a href="https://github.com/accordproject/cicero-template-library" target="_blank">GitHub</a> repository and submit pull requests to the maintainers.
</h2>
</div>
</div>
</section>
<section class="section">
<div class="container">
<h2 class="title is-2">Templates</h2>
<!-- Search Bar -->
<div class="field">
<div class="control">
<input type="text" id="searchInput" class="input" placeholder="SEARCH FOR TEMPLATE" onkeyup="filterTable()">
</div>
</div>
<table class="table box versions" id="templateTable">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Cicero Version</th>
<th>Type</th>
</tr>
</thead>
<tbody id="tableBody">
{% for name, val in templateIndex | dictsort %}
<tr>
<th>
<a href="{{name}}.html">
{% if val.displayName %}
{{val.displayName}}
{% else %}
{{name}}
{% endif %}
</a>
</th>
<td>{{val.description}}</td>
<td>{{val.ciceroVersion}}</td>
<td>{% if val.type === 0 %}Contract{% else %}Clause{% endif %}</td>
</tr>
{% endfor %}
<!-- No Results Row (Hidden by Default) -->
<tr id="noResultsRow" style="display: none;">
<td colspan="4" class="has-text-centered">No results found</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Name</th>
<th>Description</th>
<th>Cicero Version</th>
<th>Type</th>
</tr>
</tfoot>
</table>
<div class="content">
<a href="template-library.json" target="_blank">Template Library Index</a>
</div>
</div>
</section>
<!-- JavaScript for Search Functionality -->
<script>
function filterTable() {
let input = document.getElementById("searchInput");
let filter = input.value.toLowerCase();
let table = document.getElementById("templateTable");
let rows = table.getElementsByTagName("tr");
let noResultsRow = document.getElementById("noResultsRow");
let matchFound = false;
for (let i = 1; i < rows.length - 1; i++) { // Exclude the last row (noResultsRow)
let td = rows[i].getElementsByTagName("th")[0];
if (td) {
let textValue = td.textContent || td.innerText;
if (textValue.toLowerCase().indexOf(filter) > -1) {
rows[i].style.display = "";
matchFound = true;
} else {
rows[i].style.display = "none";
}
}
}
// Show "No results found" row if no matches are found
noResultsRow.style.display = matchFound ? "none" : "";
}
</script>
{% endblock %}