Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More clean up in how we load js and css files #4287

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
>
{% csrf_token %}

{{ comment_form.media }}
{% for hidden in comment_form.hidden_fields %}
{{ hidden }}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,3 @@ <h4 class="heading heading--normal">{% trans "PAFs for review" %}</h4>
{% endif %}
</div>
{% endblock %}

{% block extra_js %}
<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 @@ -100,8 +100,3 @@ <h4 class="heading heading--normal">{% trans "PAFs for review" %}</h4>

</div>
{% endblock %}

{% block extra_js %}
{{ my_reviewed.filterset.form.media.js }}
<script src="{% static 'js/submission-filters.js' %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
{% load render_table from django_tables2 %}
{% load i18n static statusbar_tags workflow_tags %}

{% block extra_css %}
{{ filter.form.media.css }}
{% endblock %}

{% block title %}{% trans "Dashboard" %}{% endblock %}

{% block content %}
Expand Down Expand Up @@ -90,6 +86,10 @@ <h2 class="text-xl mb-2">

{% endblock %}

{% block extra_css %}
{{ filter.form.media.css }}
{% endblock %}

{% block extra_js %}
{{ filter.form.media.js }}
<script src="{% static 'js/submission-filters.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
{% load render_table from django_tables2 %}
{% load i18n static nh3_tags markdown_tags heroicons %}

{% block extra_css %}
{{ my_reviewed.filterset.form.media.css }}
{% endblock %}

{% block title %}{% trans "Dashboard" %}{% endblock %}

{% block content %}
Expand Down Expand Up @@ -136,9 +132,12 @@ <h2 class="heading heading--normal">{{ review_heading }}</h2>
</div>
{% endblock %}

{% block extra_css %}
{{ my_reviewed.filterset.form.media.css }}
{% endblock %}

{% block extra_js %}
{{ my_reviewed.filterset.form.media.js }}
<script src="{% static 'js/all-submissions-table.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 @@ -30,7 +30,6 @@
action="" method="post"
x-data="{ isFormSubmitting: false }"
x-on:submit="isFormSubmitting = true">
{{ form.media }}
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
Expand Down Expand Up @@ -87,6 +86,7 @@ <h2>{{ value }}</h2>
{% endblock %}

{% block extra_js %}
{{ form.media.js }}
{{ field_blocks_ids|json_script:"block-ids" }}
<script src="{% static 'js/determination-template.js' %}"></script>
{% endblock %}
4 changes: 1 addition & 3 deletions hypha/apply/funds/templates/funds/application_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ <h3>{% blocktrans %}Sorry this {{ page|verbose_name }} is not accepting applicat
</a>
{% endif %}
<form class="form application-form" action="/test500/" method="POST" enctype="multipart/form-data">
{{ form.media }}
{% csrf_token %}

{% for field in form %}
{% if field.field %}
{% if field.field.multi_input_field %}
Expand Down Expand Up @@ -87,10 +85,10 @@ <h3>{% blocktrans %}Sorry this {{ page|verbose_name }} is not accepting applicat
{% endblock %}

{% block extra_js %}
{{ form.media.js }}
<script src="{% static 'js/application-form.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>
{% if not show_all_group_fields %}
<script src="{% static 'js/form-group-toggle.js' %}"></script>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ <h5>{% trans "Reviews & assignees" %}</h5>

{% block related %}
{% endblock %}

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

{% block extra_css %}
{{ comment_form.media.css }}
{% 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 @@ -14,8 +14,6 @@
<div class="wrapper--sidebar--inner">
<form class="form application-form" action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.media }}

{% for field in form %}
{% if field.field %}
{% if field.field.multi_input_field %}
Expand Down Expand Up @@ -46,10 +44,11 @@
{% endblock %}

{% block extra_js %}
{{ form.media.js }}
<script src="{% static 'js/application-form.js' %}"></script>
<script src="{% static 'js/tinymce-word-count.js' %}"></script>
<script src="{% static 'js/multi-input-fields.js' %}"></script>
<script src="{% static 'js/submission-form-copy.js' %}"></script>
<script src="{% static 'js/application-form-links-new-window.js' %}"></script>
{% if not show_all_group_fields %}
<script src="{% static 'js/form-group-toggle.js' %}"></script>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ <h5>{% trans "Reviews & assignees" %}</h5>

{% block related %}
{% endblock %}

{% block extra_js %}
{{ reviewer_form.media.js }}
{{ block.super }}
{% endblock %}
8 changes: 4 additions & 4 deletions hypha/apply/funds/templates/funds/base_submissions_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
{% load static %}
{% load render_table from django_tables2 %}

{% block extra_css %}
{{ filter.form.media.css }}
{% endblock %}

{% block content %}
{% block table %}
{% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action filter_classes="filters-open" can_export=can_export %}
Expand All @@ -14,6 +10,10 @@
{% endblock %}
{% endblock %}

{% block extra_css %}
{{ filter.form.media.css }}
{% endblock %}

{% block extra_js %}
{{ filter.form.media.js }}
<script src="{% static 'js/all-submissions-table.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{% extends "base-apply.html" %}
{% load i18n static %}

{% block extra_css %}
{{ filter.form.media.css }}
{% endblock %}

{% block content %}

{% adminbar %}
Expand All @@ -14,6 +10,10 @@
<div id="grouped-applications-list"></div>
{% endblock %}

{% block extra_css %}
{{ filter.form.media.css }}
{% endblock %}

{% block extra_js %}
{{ filter.form.media.js }}
<script src="{% static 'js/all-submissions-table.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
{% if action %}action="{{ action }}"{% endif %}
>
{% csrf_token %}

{{ form.media }}
{{ form.media.js }}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
Expand Down Expand Up @@ -42,5 +41,4 @@
{{ value }}
</button>
</div>

</form>
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
enctype="multipart/form-data"
>
{% csrf_token %}

{{ form.media }}
{{ form.media.js }}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
hx-post="{{ request.path }}"
>
{% csrf_token %}
{{ form.media }}
{{ form.media.js }}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
Expand Down Expand Up @@ -122,4 +122,4 @@
showClearBtn(true);
}
})
</script>
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
hx-post="{{ request.path }}"
>
{% csrf_token %}
{{ form.media }}
{{ form.media.js }}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
Expand Down
9 changes: 3 additions & 6 deletions hypha/apply/funds/templates/funds/rounds.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@

{% block title %}{% trans "Rounds" %}{% endblock %}

{% block extra_css %}
{{ filter.form.media.css }}
{% endblock %}


{% block content %}

{% adminbar %}
{% slot header %}{% trans "Rounds" %}{% endslot %}
{% slot sub_heading %}{% trans "Explore current and past rounds" %}{% endslot %}
Expand All @@ -20,7 +14,10 @@
{% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term can_export=can_export %}
{% render_table table %}
</div>
{% endblock %}

{% block extra_css %}
{{ filter.form.media.css }}
{% endblock %}

{% block extra_js %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</a>
{% endif %}
</div>
<div class="data-block__body">
<div class="data-block__body" x-data="{ showrejected: false }">
{% if object.invoices.not_rejected %}
<table class="data-block__table">
<thead>
Expand All @@ -33,10 +33,11 @@

{% if object.invoices.rejected %}
<p class="data-block__rejected">
<a class="data-block__rejected-link js-payment-block-rejected-link" href="#">{% trans "Show rejected" %}</a>
{% trans "Show rejected" as showrejectedtext %}{% trans "Hide rejected" as hiderejectedtext %}
<a class="data-block__rejected-link" href="#" @click="showrejected = ! showrejected" x-text="showrejected ? '{{ hiderejectedtext }}' : '{{ showrejectedtext }}'">{{ showrejectedtext }}</a>
</p>

<table class="data-block__table is-hidden js-payment-block-rejected-table">
<table class="data-block__table" x-show="showrejected" x-transition>
<thead>
<tr>
<th class="data-block__table-date">{% trans "Date submitted" %}</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
<div class="wrapper--sidebar--inner">
<form class="form" action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.media }}

{% for field in form %}
{% if field.field %}
{% include "forms/includes/field.html" %}
Expand All @@ -49,3 +47,7 @@
</div>
</div>
{% endblock %}

{% block extra_js %}
{{ form.media.js }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
{% block title %}{% trans "Invoices" %}{% endblock %}

{% block content %}

{% adminbar %}
{% slot header %}{% trans "All Invoices" %} ({{ table.rows|length }}){% endslot %}
{% slot sub_heading %}{% trans "View, search and filter all project invoices" %}{% endslot %}
Expand All @@ -28,7 +27,6 @@
<p>{% trans "No Invoices available" %}</p>
{% endif %}
</div>

{% endblock content %}

{% block extra_css %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
enctype="multipart/form-data"
>
{% csrf_token %}

{{ form.media }}
{{ form.media.js }}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

{% block title %}{{ object.title }}{% endblock %}

{% block extra_css %}
{{ reviewer_form.media.css }}
{% endblock %}

{% block content %}
{% adminbar %}
{% slot back_link %}
Expand Down Expand Up @@ -150,7 +146,3 @@ <h5>{% trans "Actions to take" %}</h5>
</div>
</div>
{% endblock content %}

{% block extra_js %}
{{ block.super }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<div class="wrapper--sidebar--inner">
<form class="form application-form" action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ pf_form.media }}
{% for field in pf_form %}
{% if field.field %}
{% if field.field.multi_input_field %}
Expand Down Expand Up @@ -69,10 +68,14 @@ <h5>{% trans "Proposal attachments" %}</h5>

{% endblock %}

{% block extra_css %}
{{ pf_form.media.css }}
{% endblock %}

{% block extra_js %}
{{ pf_form.media.js }}
<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>
{% if not show_all_group_fields %}
<script src="{% static 'js/form-group-toggle.js' %}"></script>
{% endif %}
Expand Down
Loading
Loading