Skip to content

Commit

Permalink
run djhtml
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s committed Sep 5, 2024
1 parent 626739e commit c1c70ba
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 92 deletions.
6 changes: 3 additions & 3 deletions ec_api/apps/api_docs/templates/api_docs/api_docs_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

{% block content %}

{% block api_docs_content %}
{% include 'api_docs/docs_parent.html' %}
{% endblock %}
{% block api_docs_content %}
{% include 'api_docs/docs_parent.html' %}
{% endblock %}

{% endblock %}
20 changes: 10 additions & 10 deletions ec_api/apps/api_docs/templates/api_docs/concepts.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ <h3>High level concepts</h3>
<figure>
<figcaption>Case 1: Results after address picker shown</figcaption>
<div class="mermaid">
sequenceDiagram
Client->>+API: Postcode lookup to /api/postcode/{postcode}
API->>+Client: Address picker with UPRNs
Client->>+API: UPRN lookup to /api/address/{UPRN}
API->>+Client: Results
sequenceDiagram
Client->>+API: Postcode lookup to /api/postcode/{postcode}
API->>+Client: Address picker with UPRNs
Client->>+API: UPRN lookup to /api/address/{UPRN}
API->>+Client: Results

</div>

</figure>
<figure>
<figcaption>Case 2: Results direct from postcode</figcaption>
<div class="mermaid">
sequenceDiagram
Client->>+API: Postcode lookup to /api/postcode/{postcode}
API->>+Client: Address picker with UPRNs
Client->>+API: UPRN lookup to /api/address/{UPRN}
API->>+Client: Results
sequenceDiagram
Client->>+API: Postcode lookup to /api/postcode/{postcode}
API->>+Client: Address picker with UPRNs
Client->>+API: UPRN lookup to /api/address/{UPRN}
API->>+Client: Results

</div>

Expand Down
122 changes: 61 additions & 61 deletions ec_api/apps/frontend/templates/frontend/widget_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ <h1 class="phase-banner">Election lookup widget</h1>
voting in their area. By entering their postcode, your users can quickly access information on the following:
</p>
<ul>
<li>Upcoming elections, including the election type and date</li>
<li>Polling station information, including address</li>
<li>Candidate information</li>
<li>Contact details for electoral services teams at local councils, and electoral registration offices in
Scotland – useful for submitting postal or proxy vote application forms
</li>
<li>Upcoming elections, including the election type and date</li>
<li>Polling station information, including address</li>
<li>Candidate information</li>
<li>Contact details for electoral services teams at local councils, and electoral registration offices in
Scotland – useful for submitting postal or proxy vote application forms
</li>
</ul>
<p>You can add the Electoral Commission’s election lookup widget to any website.</p>
<p>Here’s how the lookup widget will look on your site. Feel free to test it by entering a
Expand All @@ -22,7 +22,7 @@ <h1 class="phase-banner">Election lookup widget</h1>
<div id="dc_wdiv" data-language="en" aria-live="polite" role="region" data-candidates="true">
</div>
<script type="text/javascript"
src="{% url "widget_js" %}">
src="{% url "widget_js" %}">
</script>
</div>
</figure>
Expand Down Expand Up @@ -71,66 +71,66 @@ <h1 class="phase-banner">Election lookup widget</h1>
</div>

<script>
var form = document.querySelector('#widget-options');
if (form) {
form.addEventListener('submit', handleWidgetOptions);
}
var form = document.querySelector('#widget-options');
if (form) {
form.addEventListener('submit', handleWidgetOptions);
}

function handleWidgetOptions(event) {
event.preventDefault();
createWidgetVersion(form.elements.language.value);
}
function handleWidgetOptions(event) {
event.preventDefault();
createWidgetVersion(form.elements.language.value);
}

function getEmbedCode(customAttributes) {
return '<pre><code>&lt;noscript&gt;\n' +
'&lt;a href=&quot;https://www.electoralcommission.org.uk/i-am-a/voter/your-election-information&quot;&gt;Find election information at\n' +
'&lt;span aria-label=&quot;The Electoral Commission&quot;&gt;electoralcommission.org.uk&lt;/span&gt;&lt;/a&gt;' +
'&lt;/noscript&gt;\n' +
'&lt;div id="dc_wdiv" ' + customAttributes + '&gt;&lt;/div&gt;\n' +
'&lt;script type="text/javascript"\n' +
' src="https://api.electoralcommission.org.uk/widget/widget.js"&gt;\n' +
'&lt;/script&gt;\n' +
'</code></pre>\n';
}
function getEmbedCode(customAttributes) {
return '<pre><code>&lt;noscript&gt;\n' +
'&lt;a href=&quot;https://www.electoralcommission.org.uk/i-am-a/voter/your-election-information&quot;&gt;Find election information at\n' +
'&lt;span aria-label=&quot;The Electoral Commission&quot;&gt;electoralcommission.org.uk&lt;/span&gt;&lt;/a&gt;' +
'&lt;/noscript&gt;\n' +
'&lt;div id="dc_wdiv" ' + customAttributes + '&gt;&lt;/div&gt;\n' +
'&lt;script type="text/javascript"\n' +
' src="https://api.electoralcommission.org.uk/widget/widget.js"&gt;\n' +
'&lt;/script&gt;\n' +
'</code></pre>\n';
}

function makeAttributeList(language) {
var attrs = '';
if ((language === 'en') || (language === 'cy')) {
attrs = 'data-language="' + language + '" ';
}
return attrs + 'aria-live="polite" role="region" data-candidates="true"';
function makeAttributeList(language) {
var attrs = '';
if ((language === 'en') || (language === 'cy')) {
attrs = 'data-language="' + language + '" ';
}
return attrs + 'aria-live="polite" role="region" data-candidates="true"';
}

function makeWidget(language) {
var div = document.createElement('div');
div.setAttribute('id', 'dc_wdiv');
if ((language === 'en') || (language === 'cy')) {
div.setAttribute('data-language', language);
}
div.setAttribute('aria-live', 'polite');
div.setAttribute('role', 'region');
div.setAttribute('data-candidates', 'true');
return div;
function makeWidget(language) {
var div = document.createElement('div');
div.setAttribute('id', 'dc_wdiv');
if ((language === 'en') || (language === 'cy')) {
div.setAttribute('data-language', language);
}
div.setAttribute('aria-live', 'polite');
div.setAttribute('role', 'region');
div.setAttribute('data-candidates', 'true');
return div;
}

function makeScript() {
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "https://api.electoralcommission.org.uk/widget/widget.js";
return script;
}
function makeScript() {
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "https://api.electoralcommission.org.uk/widget/widget.js";
return script;
}

function createWidgetVersion(language) {
debugger
var widgetArea = document.querySelector('#widget-area');
var codeArea = document.querySelector('#code-area');
var widget = makeWidget(language);
var script = makeScript();
var embedCode = getEmbedCode(makeAttributeList(language));
widgetArea.innerHTML = '';
widgetArea.appendChild(widget);
widgetArea.appendChild(script);
codeArea.innerHTML = embedCode;
}
</script>
function createWidgetVersion(language) {
debugger
var widgetArea = document.querySelector('#widget-area');
var codeArea = document.querySelector('#code-area');
var widget = makeWidget(language);
var script = makeScript();
var embedCode = getEmbedCode(makeAttributeList(language));
widgetArea.innerHTML = '';
widgetArea.appendChild(widget);
widgetArea.appendChild(script);
codeArea.innerHTML = embedCode;
}
</script>
{% endblock %}
18 changes: 9 additions & 9 deletions ec_api/apps/users/templates/users/delete_key.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

{% block content %}

<div class="ds-card">
<div class="ds-card-body">
<h1>Delete {{key.name}} key</h1>
<form method="POST" action=".">
<p>Are you sure you want to delete key <code>{{ key.key }}</code>?</p>
{% csrf_token %}
<button class="ds-button-blue" type="submit">Delete key</button>
</form>
<div class="ds-card">
<div class="ds-card-body">
<h1>Delete {{key.name}} key</h1>
<form method="POST" action=".">
<p>Are you sure you want to delete key <code>{{ key.key }}</code>?</p>
{% csrf_token %}
<button class="ds-button-blue" type="submit">Delete key</button>
</form>
</div>
</div>
</div>

{% endblock %}
18 changes: 9 additions & 9 deletions ec_api/apps/users/templates/users/refresh_key.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

{% block content %}

<div class="ds-card">
<div class="ds-card-body">
<h1>Refresh {{key.name}} key</h1>
<form method="POST" action=".">
<p>Are you sure you want to refresh key <code>{{ key.key }}</code>?</p>
{% csrf_token %}
<button class="ds-button-blue" type="submit">Refresh key</button>
</form>
<div class="ds-card">
<div class="ds-card-body">
<h1>Refresh {{key.name}} key</h1>
<form method="POST" action=".">
<p>Are you sure you want to refresh key <code>{{ key.key }}</code>?</p>
{% csrf_token %}
<button class="ds-button-blue" type="submit">Refresh key</button>
</form>
</div>
</div>
</div>

{% endblock %}

0 comments on commit c1c70ba

Please sign in to comment.