Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

🎨 Add MoJ / GOV.UK frontend styling #23

Merged
merged 8 commits into from
Jul 22, 2024
Merged

🎨 Add MoJ / GOV.UK frontend styling #23

merged 8 commits into from
Jul 22, 2024

Conversation

Gary-H9
Copy link
Contributor

@Gary-H9 Gary-H9 commented Jul 17, 2024

This PR adds the MoJ / gov.uk frontend styling / components as per this ticket.

Adds header / footer etc also.

Structure of the templates folders / views will be changed later when User Login is added.

@Gary-H9 Gary-H9 marked this pull request as draft July 17, 2024 09:05
@Gary-H9 Gary-H9 changed the title 🎨 Add MoJ / gov.uk frontend styling 🎨 Add MoJ / GOV.UK frontend styling Jul 17, 2024
conversationHistory.push({"role": "user", "content": userInput});

var newMessage = '<div class="moj-message-item moj-message-item--sent"><div class="moj-message-item__text moj-message-item__text--sent">' + userInput + '</div></div>';
$('#messages .moj-message-list').append(newMessage);

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text is reinterpreted as HTML without escaping meta-characters.
</form>
</div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

Check warning

Code scanning / CodeQL

Inclusion of functionality from an untrusted source Medium

Script loaded from content delivery network with no integrity check.
conversationHistory.push({"role": "user", "content": userInput, "time": currentTime});

var newMessage = '<div class="moj-message-item moj-message-item--sent"><div class="moj-message-item__text moj-message-item__text--sent">' + userInput + '</div><div class="moj-message-item__meta"><span class="moj-message-item__meta--sender">You</span> at <time class="moj-message-item__meta--timestamp" datetime="' + currentTime + '">' + currentTime + '</time></div></div>';
$('#messages .moj-message-list').append(newMessage);

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text is reinterpreted as HTML without escaping meta-characters.

<script src="https://cdn.jsdelivr.net/npm/showdown@1.9.1/dist/showdown.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.0/highlight.min.js"></script>

Check warning

Code scanning / CodeQL

Inclusion of functionality from an untrusted source Medium

Script loaded from content delivery network with no integrity check.
</div>

<script src="https://cdn.jsdelivr.net/npm/showdown@1.9.1/dist/showdown.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

Check warning

Code scanning / CodeQL

Inclusion of functionality from an untrusted source Medium

Script loaded from content delivery network with no integrity check.
@Gary-H9 Gary-H9 marked this pull request as ready for review July 22, 2024 13:50
Copy link

@jamesstottmoj jamesstottmoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled down branch and tested locally. GovUK styling is in.

@Gary-H9 Gary-H9 merged commit dec3b09 into main Jul 22, 2024
28 checks passed
@Gary-H9 Gary-H9 deleted the feat/frontend branch July 22, 2024 15:43
Comment on lines +8 to +17
<pre>
{{ user.email }}
{{ user.name }}
{{ user.user_id }}
</pre>

<h1 class="govuk-heading-xl">User list</h1>
{% for user in users %}
<li>{{ user.name }}: {{ user.nickname }}, {{ user.email }} </li>
{% endfor %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outputting the user info is just there for debugging really, so not needed. Feel free to remove

Copy link

@michaeljcollinsuk michaeljcollinsuk Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wouldnt typically have a base file for a specific app, you'd just have one and then extend from there in your app specific templates (to ensure consistency throughout the site). So when you get chance you might want to merge this with your templates/base.html so you only have one

</form>
</div>

<script src="https://cdn.jsdelivr.net/npm/showdown@2.1.0/dist/showdown.min.js" integrity="sha384-GP2+CwBlakZSDJUr+E4JvbxpM75i1i8+RKkieQxzuyDZLG+5105E1OfHIjzcXyWH" crossorigin="anonymous"></script>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be installed with npm and included in your built assets?

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js" integrity="sha384-GdEWAbCjn+ghjX0gLx7/N1hyTVmPAjdC2OvoAA0RyNcAOhqwtT8qnbCxWle2+uJX" crossorigin="anonymous"></script>

<script>
$(document).ready(function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be better to keep custom JS out of your templates. If you defined files for your custom JS, then you could include them where necessary using the django static templatetag (assuming that they are setup so that django collects them).

<script src="{% static 'conversation.js' %}"></script>

});
</script>

<style>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as custom JS, custom styles ideally shouldnt be in templates

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants