Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
98ddcf1
Move clipboard.min.js to vendor dir.
frjo Dec 10, 2024
e23806c
Delete unused all-reviews-table.js.
frjo Dec 10, 2024
5856fff
File uploads js as vanilla js.
frjo Dec 10, 2024
0245c2e
form-group-toggle.js as vanilla js.
frjo Dec 10, 2024
069230f
Remove js-actions-toggle that was used on mobile. Fix bug that did no…
frjo Dec 10, 2024
a0ef448
Remove js-actions-sidebar that was used on mobile.
frjo Dec 10, 2024
7b38151
Remove symbol-es6.min.js, do not think we need it anymore.
frjo Dec 10, 2024
b6f41c7
Improve file-uploads.js.
frjo Dec 12, 2024
48cf893
Polyfill url-search-params.js has not been needed for years.
frjo Dec 12, 2024
3220570
Move jquery and js cookie in to vendor dir.
frjo Dec 12, 2024
386088c
Clean up loading of comment_form.media.
frjo Dec 12, 2024
1ca017b
Rename main.js to csrf-token-ajax.js since that is the only remaning …
frjo Dec 12, 2024
079ab61
When possible load scripts in header with defer. Only load on submiss…
frjo Dec 12, 2024
bd5919b
Comment about jQuery.
frjo Dec 12, 2024
fa408fa
Comments explaning js use.
frjo Dec 12, 2024
e214048
Remove form comment js.
frjo Dec 12, 2024
6f27b58
Move inline js to the bottom and tooltip scipts to the head with defer.
frjo Dec 12, 2024
30daf03
Replace two-factor-focus.js with one line inline vanilla js.
frjo Dec 12, 2024
1de7546
Delete csrf-token-ajax.js plus js.cookie.min.js, not needed anymore.
frjo Dec 12, 2024
80e6130
Remove unneded extra_js block.
frjo Dec 12, 2024
7b2a42e
Fix bug in form-group-toggle.js.
frjo Dec 13, 2024
a013e52
Revert to jQuery version of form-group-toggle.js.
frjo Dec 13, 2024
f193ecc
All jQuery code is loaded in extra_js so it should be loaded just bef…
frjo Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Minified JavaScript files shouldn't be changed
**/**.min.js
**/javascript/esm/**
**/javascript/vendor/**

# Ignore all files in the static & media directory.
static_compiled/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ <h4 class="heading heading--normal">{% trans "PAFs for review" %}</h4>
{% endblock %}

{% block extra_js %}
<script src="{% static 'js/url-search-params.js' %}"></script>
<script src="{% static 'js/submission-filters.js' %}"></script>
<script src="{% static 'js/tabs.js' %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,5 @@ <h4 class="heading heading--normal">{% trans "PAFs for review" %}</h4>

{% block extra_js %}
{{ my_reviewed.filterset.form.media.js }}
<script src="{% static 'js/url-search-params.js' %}"></script>
<script src="{% static 'js/submission-filters.js' %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,5 @@ <h2 class="text-xl mb-2">

{% block extra_js %}
{{ filter.form.media.js }}
<script src="{% static 'js/url-search-params.js' %}"></script>
<script src="{% static 'js/submission-filters.js' %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ <h2 class="heading heading--normal">{{ review_heading }}</h2>

{% block extra_js %}
{{ my_reviewed.filterset.form.media.js }}
<script src="{% static 'js/url-search-params.js' %}"></script>
<script src="{% static 'js/all-submissions-table.js' %}"></script>
<script src="{% static 'js/submission-filters.js' %}"></script>
<script src="{% static 'js/tabs.js' %}"></script>
Expand Down
1 change: 0 additions & 1 deletion hypha/apply/funds/templates/funds/application_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ <h3>{% blocktrans %}Sorry this {{ page|verbose_name }} is not accepting applicat

{% block extra_js %}
<script src="{% static 'js/application-form.js' %}"></script>
<script src="{% static 'js/file-uploads.js' %}"></script>
<script src="{% static 'js/tinymce-word-count.js' %}"></script>
<script src="{% static 'js/submission-form-copy.js' %}"></script>
<script src="{% static 'js/application-form-links-new-window.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ <h5 class="m-0">{% trans "Reminders" %}</h5>
{% endblock %}

{% block extra_js %}
{{ comment_form.media.js }}
{{ block.super }}
<script src="{% static 'js/jquery.fancybox.min.js' %}"></script>
<script src="{% static 'js/fancybox-global.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ <h5>{% trans "Reviews & assignees" %}</h5>

{% block extra_js %}
{{ reviewer_form.media.js }}
{{ comment_form.media.js }}
{{ block.super }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ <h4 class="m-0 sr-only">{% trans "Add communication" %}</h4>
{% endblock %}

{% block extra_js %}
{{ comment_form.media.js }}
<script src="{% static 'js/tabs.js' %}"></script>
<script src="{% static 'js/submission-text-cleanup.js' %}"></script>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ <h5>{% trans "Reviews & assignees" %}</h5>

{% block extra_js %}
{{ reviewer_form.media.js }}
{{ comment_form.media.js }}
{{ block.super }}
{% endblock %}
2 changes: 0 additions & 2 deletions hypha/apply/funds/templates/funds/base_submissions_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<script src="{% static 'js/jquery.fancybox.min.js' %}"></script>
<script src="{% static 'js/fancybox-global.js' %}"></script>
<script src="{% static 'js/all-submissions-table.js' %}"></script>
<script src="{% static 'js/symbol-es6.min.js' %}"></script>
<script src="{% static 'js/url-search-params.js' %}"></script>
<script src="{% static 'js/submission-filters.js' %}"></script>
<script src="{% static 'js/tabs.js' %}"></script>
<script src="{% static 'js/batch-actions.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<script src="{% static 'js/jquery.fancybox.min.js' %}"></script>
<script src="{% static 'js/fancybox-global.js' %}"></script>
<script src="{% static 'js/all-submissions-table.js' %}"></script>
<script src="{% static 'js/symbol-es6.min.js' %}"></script>
<script src="{% static 'js/url-search-params.js' %}"></script>
<script src="{% static 'js/submission-filters.js' %}"></script>
<script src="{% static 'js/tabs.js' %}"></script>
<script src="{% static 'js/batch-actions.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n primaryactions_tags %}

{% if request.user|should_display_primary_actions_block:object %}
<div class="js-actions-sidebar sidebar__inner sidebar__inner--light-blue sidebar__inner--actions {% if mobile %}sidebar__inner--mobile{% endif %}" data-testid="sidebar-primary-actions">
<div class="sidebar__inner sidebar__inner--light-blue sidebar__inner--actions" data-testid="sidebar-primary-actions">
<h5>{% trans "Actions to take" %}</h5>

{% if object.in_internal_review_phase or object.in_external_review_phase %}
Expand Down
1 change: 0 additions & 1 deletion hypha/apply/funds/templates/funds/rounds.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@

{% block extra_js %}
{{ filter.form.media.js }}
<script src="{% static 'js/url-search-params.js' %}"></script>
<script src="{% static 'js/submission-filters.js' %}"></script>
{% endblock %}
5 changes: 0 additions & 5 deletions hypha/apply/funds/templates/funds/staff_assignments.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,3 @@
{% endblock %}
</div>
{% endblock %}

{% block extra_js %}
{{ filter.form.media.js }}
<script src="{% static 'js/symbol-es6.min.js' %}"></script>
{% endblock %}
3 changes: 3 additions & 0 deletions hypha/apply/funds/templates/submissions/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,9 @@ <h2 class='text-2xl'>{% trans "No results matched your search" %}</h2>
{% endspaceless %}{% endblock content %}

{% block extra_js %}
<!-- Datetime picker-->
<script src="{% static 'js/vendor/moment.min.js' %}"></script>
<script src="{% static 'js/vendor/daterangepicker.min.js' %}"></script>
<script>
// Date Range Picker
// ---------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h5 class="card__heading">{% trans "Supporting Documents" %}</h5>
<aside class="sidebar">
{% block deliverables %}
{% endblock %}
<div hx-get="{% url 'apply:projects:partial-invoice-detail-actions' pk=object.project.pk invoice_pk=object.pk %}" hx-trigger="invoicesUpdated from:body" class="sticky js-actions-sidebar sidebar__inner sidebar__inner--light-blue sidebar__inner--actions top-8" data-testid="sidebar-primary-actions">
<div hx-get="{% url 'apply:projects:partial-invoice-detail-actions' pk=object.project.pk invoice_pk=object.pk %}" hx-trigger="invoicesUpdated from:body" class="sticky sidebar__inner sidebar__inner--light-blue sidebar__inner--actions top-8" data-testid="sidebar-primary-actions">
{% include "application_projects/partials/invoice_detail_actions.html" %}
</div>
</aside>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% block admin_assignments %}
{% user_can_update_project_status object user as can_update_status %}
{% if can_update_status %}
<div class="js-actions-sidebar sidebar__inner sidebar__inner--light-blue sidebar__inner--actions {% if mobile %}sidebar__inner--mobile{% endif %}" data-testid="sidebar-primary-actions">
<div class="sidebar__inner sidebar__inner--light-blue sidebar__inner--actions" data-testid="sidebar-primary-actions">

<h5>{% trans "Actions to take" %}</h5>

Expand All @@ -19,7 +19,7 @@ <h5>{% trans "Actions to take" %}</h5>
{% trans "Continue to next status" %}
</a>
{% else %}
<!-- Move the condition below to link if add more than one link to 'More Actions'-->
<!-- Move the condition below to link if add more than one link to 'More Actions'-->
<details>
<summary class="sidebar__separator sidebar__separator--medium">{% trans "More actions" %}</summary>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h4 class="mb-2">{% trans "Supporting Documents" %}</h4>
{% user_can_take_actions object user as can_take_actions %}
{% if can_take_actions %}
<aside class="sidebar sidebar__project">
<div class="js-actions-sidebar sidebar__inner sidebar__inner--light-blue sidebar__inner--actions {% if mobile %}sidebar__inner--mobile{% endif %}" data-testid="sidebar-primary-actions">
<div class="sidebar__inner sidebar__inner--light-blue sidebar__inner--actions" data-testid="sidebar-primary-actions">
<h5>{% trans "Actions to take" %}</h5>
{% user_can_edit_paf object user as can_edit_paf %}
{% if can_edit_paf %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</form>
</div>
<aside class="sidebar sidebar__project">
<div class="js-actions-sidebar sidebar__inner sidebar__inner--actions {% if mobile %}sidebar__inner--mobile{% endif %}">
<div class="sidebar__inner sidebar__inner--actions">
<h5>{% trans "Proposal attachments" %}</h5>
{% for file in submissions_attachments %}
<p><b><a href="{{ file.url }}" target="_blank">{{ file.filename }}</a></b></p>
Expand All @@ -96,7 +96,6 @@ <h5>{% trans "Proposal attachments" %}</h5>
{% endblock %}

{% block extra_js %}
<script src="{% static 'js/file-uploads.js' %}"></script>
<script src="{% static 'js/tinymce-word-count.js' %}"></script>
<script src="{% static 'js/multi-input-fields.js' %}"></script>
<script src="{% static 'js/application-form-links-new-window.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{% block body_class %}{% endblock %}

{% block content %}
{% display_project_status object request.user as project_status %}
<div class="admin-bar" xmlns="http://www.w3.org/1999/html">
<div class="admin-bar__inner">
<h1 class="mb-0 font-medium"
Expand Down Expand Up @@ -56,7 +57,7 @@
{% endfor %}
</div>

<div class="status-bar--mobile">
<div class="status-bar--mobile mt-5">
<h6 class="status-bar__subheading">
{{ project_status }}
</h6>
Expand Down Expand Up @@ -87,7 +88,6 @@ <h6 class="status-bar__subheading">
</div>

{% show_closing_banner object as show_banner %}
{% display_project_status object request.user as project_status %}
{% if show_banner %}
<div class="bg-red-500 text-white font-semibold text-center p-2">
{% blocktrans with status=project_status %} This project is in {{ status }} state. {% endblocktrans %}
Expand Down Expand Up @@ -144,11 +144,7 @@ <h5>{% trans "E-mail" %}</h5>
<aside class="sidebar">
{% user_next_step_on_project object user request=request as next_step %}
{% if next_step %}
{% if mobile %}
<a class="js-actions-toggle button button--white button--full-width button--actions">{{ next_step.heading }}</a>
{% endif %}

<div class="bg-yellow-100 shadow js-actions-sidebar px-5 py-3 mb-8 sidebar__inner--actions {% if mobile %}sidebar__inner--mobile{% endif %}">
<div class="bg-yellow-100 shadow px-5 py-3 mb-8 sidebar__inner--actions">
<h5 class="border-b pb-2 border-b-orange-200">
{% heroicon_solid "sparkles" class="inline me-1 fill-orange-500 align-text-top" aria_hidden=true %}
{{ next_step.heading }}
Expand All @@ -166,12 +162,7 @@ <h5 class="border-b pb-2 border-b-orange-200">
</div>
{% endif %}
{% if object.paf_approvals.exists and not user.is_applicant %}
{% if mobile %}
<a class="js-actions-toggle button button--white button--full-width button--actions">{% trans "Project form approvals" %}</a>
{% endif %}


<div class="js-actions-sidebar sidebar__inner sidebar__inner--actions {% if mobile %}sidebar__inner--mobile{% endif %}">
<div class="sidebar__inner sidebar__inner--actions">

<h5>{% trans "Project form approvals" %}</h5>
{% for paf_approval in object.paf_approvals.all %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h4 class="mb-2">{% trans "Project scope of work (SOW)" %}</h4>
{% user_can_take_actions object user as can_take_actions %}
{% if can_take_actions %}
<aside class="sidebar sidebar__project">
<div class="js-actions-sidebar sidebar__inner sidebar__inner--light-blue sidebar__inner--actions {% if mobile %}sidebar__inner--mobile{% endif %}">
<div class="sidebar__inner sidebar__inner--light-blue sidebar__inner--actions">
<h5>{% trans "Actions to take" %}</h5>
<div x-data="{ show: false }" class="dropdown">
<button x-on:click="show = ! show" class="button button--primary" type="button">
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/review/templates/review/review_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% endif %}
{% endadminbar %}

<div class="wrapper wrapper--reviews-table js-reviews-table">
<div class="wrapper">
<table class="reviews-list">
{% for answers in review_data.values %}
<tr class="reviews-list__tr">
Expand Down
5 changes: 4 additions & 1 deletion hypha/apply/users/templates/two_factor/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@

{% block extra_js %}
{{ block.super }}
<script src="{% static 'js/two-factor-focus.js' %}"></script>
{# Focus the 2FA field. #}
<script>
document.querySelector("#id_generator-token").focus();
</script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h1>{% block title %}{% trans "Backup Codes" %}{% endblock %}</h1>
{% endblock %}

{% block extra_js %}
<script src="{% static 'js/clipboard.min.js' %}"></script>
<script src="{% static 'js/vendor/clipboard.min.js' %}"></script>
<script>

{# Select the codes when clicked #}
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/users/templates/users/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ <h2 class="text-2xl">{% blocktrans %}Log in to {{ ORG_SHORT_NAME }}{% endblocktr
</section>
</div>

<script>
{# Fix copy of dynamic fields label #}
<script>
var labelOtpToken = document.querySelector("label[for=id_token-otp_token]");
if(labelOtpToken){
labelOtpToken.textContent = "{% trans 'Verification Code' %}: ";
Expand Down
35 changes: 0 additions & 35 deletions hypha/static_src/javascript/all-reviews-table.js

This file was deleted.

37 changes: 21 additions & 16 deletions hypha/static_src/javascript/file-uploads.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
jQuery(function ($) {
document.addEventListener("DOMContentLoaded", function () {
// Initialize django-file-form
$("form")
.get()
.forEach(function (form) {
// Prevent initilising it multiple times and run it for forms
// that have a `form_id` field added by django-file-form.
if (
!form.initUploadFieldsDone &&
form.querySelector("[name=form_id]")
) {
init(form);
form.initUploadFieldsDone = true;
}
});
document.querySelectorAll("form").forEach(function (form) {
// Prevent initializing it multiple times and run it for forms
// that have a `form_id` field added by django-file-form.
if (
!form.initUploadFieldsDone &&
form.querySelector("[name=form_id]")
) {
init(form);
form.initUploadFieldsDone = true;
}
});

/**
* Initialize django-file-form for a form.
* @param {object} form The form to initialize.
*/
function init(form) {
if ($(".form__group--file").length) {
if (document.querySelectorAll(".form__group--file").length) {
window.initUploadFields(form);

// Hide wrapper elements for hidden inputs added by django-file-form
$("input[type=hidden]").closest(".form__group").hide();
document
.querySelectorAll("input[type=hidden]")
.forEach(function (input) {
var closestFormGroup = input.closest(".form__group");
if (closestFormGroup) {
closestFormGroup.hidden = true;
}
});
}
}
});
3 changes: 0 additions & 3 deletions hypha/static_src/javascript/js.cookie.min.js

This file was deleted.

Loading
Loading