Skip to content

Commit

Permalink
[DONE] Fix jsi18n (EsupPortail#1011)
Browse files Browse the repository at this point in the history
* * Replace every `<script src="/admin/jsi18n/"></script>` by `<script id="jsi18n" src="{% url 'javascript-catalog' %}"></script>`
* Add js-catalog in theme_edit.html

* Add jsi18n in more scripts

* Add JS catalog in caption maker

* Remove every `javascript-catalog` as it is already in base.html

* rename i18njs as jsi18n

* Remove the "version" number in base html, as webpush also load it without version number and we do not want it to be downloaded twice.
  • Loading branch information
Badatos authored Jan 4, 2024
1 parent 23b0a62 commit 23517c8
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 54 deletions.
6 changes: 0 additions & 6 deletions pod/enrichment/templates/enrichment/group_enrichment.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@
{% load i18n %}
{% load static %}

{% block page_extra_head %}

{% endblock page_extra_head %}

{% block breadcrumbs %}{{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'video:my_videos' %}">{% trans 'My videos' %}</a></li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Editing group for the enrichment of the video" %}</li>
{% endblock %}

{% block page_title %}{% trans "Editing group for the enrichment of the video" %} "{{video.title}}"{% endblock %}


{% block page_content %}
{% spaceless %}
<h3>{% trans "Editing group for the enrichment of the video" %} "{{video.title}}"
Expand Down Expand Up @@ -79,7 +74,6 @@ <h2 class="card-header card-title pod-card__title h4">
{% endblock page_aside %}

{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'admin/js/vendor/jquery/jquery.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'admin/js/jquery.init.js' %}?ver={{VERSION}}"></script>
Expand Down
1 change: 0 additions & 1 deletion pod/import_video/templates/import_video/add_or_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ <h2 class="card-header card-title pod-card__title h4">{% trans "Terms of Service
{% endblock page_aside %}

{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}?ver={{VERSION}}">
{{form.media}}
Expand Down
4 changes: 0 additions & 4 deletions pod/live/templates/live/directs.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
{% load i18n %}
{% load static %}

{% block page_extra_head %}
{% endblock %}


{% block breadcrumbs %}
{{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'live:directs_all'%}">{% trans "Lives" %}</a></li>
Expand Down
4 changes: 2 additions & 2 deletions pod/live/templates/live/event-iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load static %}

<!DOCTYPE html>
<html itemscope itemtype="https://schema.org/MediaObject" lang="eng">
<html itemscope itemtype="https://schema.org/MediaObject">
<head>
<meta charset="utf-8">

Expand All @@ -27,7 +27,7 @@

<link rel="stylesheet" href="{% static 'bootstrap/dist/css/bootstrap.min.css' %}?ver={{VERSION}}" crossorigin="anonymous">
<script src="{% static 'bootstrap/dist/js/bootstrap.bundle.min.js' %}?ver={{VERSION}}"></script>
<script src="{% url 'javascript-catalog' %}"></script>
<script id="jsi18n" src="{% url 'javascript-catalog' %}?ver={{VERSION}}"></script>

<link rel="stylesheet" href="{% static 'css/video-iframe.css' %}?ver={{VERSION}}">
</head>
Expand Down
2 changes: 1 addition & 1 deletion pod/live/templates/live/event_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
</style>
{% endblock %}

{% block breadcrumbs %}{{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'live:my_events' %}">{% trans 'My events' %}</a></li>
{% if form.instance.title and form.instance.slug != '' %}
Expand Down Expand Up @@ -163,7 +164,6 @@ <h2 class="h4 card-header card-title pl-2">{% trans "Mandatory fields" %}</h2>
{% endblock page_aside %}

{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{ VERSION }}"></script>
<script src="{% static 'js/broadcaster_from_building.js' %}?ver={{ VERSION }}"></script>

Expand Down
1 change: 0 additions & 1 deletion pod/live/templates/live/event_immediate_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ <h2 class="h4 card-header card-title pl-2">{% trans "Mandatory fields" %}</h2>
{% endblock page_aside %}

{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{ VERSION }}"></script>
<script src="{% static 'admin/js/vendor/jquery/jquery.js' %}?ver={{ VERSION }}"></script>
<script src="{% static 'admin/js/jquery.init.js' %}?ver={{ VERSION }}"></script>
Expand Down
17 changes: 10 additions & 7 deletions pod/main/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@
<link href="{% static 'css/event.css' %}?ver={{ VERSION }}" rel="stylesheet">
{% endif %}
<!-- more styles for each App -->
{% block more_style %}
{% endblock more_style %}
<title>{{ TITLE_SITE }} - {% block page_title %}{{page_title|striptags|capfirst}}{% endblock %}</title> <script src="{% static 'jquery/dist/jquery.min.js' %}"></script>
{% block page_extra_head %}
{% endblock %}
{% block more_style %}{% endblock more_style %}

<title>{{ TITLE_SITE }} - {% block page_title %}{{page_title|striptags|capfirst}}{% endblock %}</title>

<script src="{% static 'jquery/dist/jquery.min.js' %}"></script>
<script id="jsi18n" src="{% url 'javascript-catalog' %}"></script>

{% block page_extra_head %}{% endblock %}

{% if request.GET.is_iframe %}
<link rel="stylesheet" href="{% static 'css/iframe.css' %}?ver={{VERSION}}" media="screen">
{% endif %}
Expand Down Expand Up @@ -166,7 +170,7 @@ <h1 class="page_title">{{page_title|capfirst}}</h1>
<img src="{% static 'img/cookie.svg' %}" alt="" width="50">
<span class="mt-2">{% trans 'We use third party cookies to personalize content, manage session and analyze site traffic.' %}</span>
{% if COOKIE_LEARN_MORE != "" %}
<a class="d-flex align-items-center" href="{{COOKIE_LEARN_MORE}}">{% trans 'Learn more' %}<i class="bi bi-caret-right ms-2"></i></a>
<a class="d-flex align-items-center" href="{{COOKIE_LEARN_MORE}}">{% trans 'Learn more' %}<i class="bi bi-caret-right ms-2" aria-hidden="true"></i></a>
{% endif %}
<button class="btn btn-dark mt-3 px-4" type="button" id='okcookie'>{% trans 'I understand' %}</button>
</div>
Expand All @@ -177,7 +181,6 @@ <h1 class="page_title">{{page_title|capfirst}}</h1>
<!-- Javascript migration from header to footer-->
<!-- except for jquery, to do later ! -->
<script src="{% static 'js-cookie/dist/js.cookie.min.js' %}?ver={{VERSION}}"></script>
<script src="{% url 'javascript-catalog' %}"></script>
<!-- JS -->
<script src="{% static 'bootstrap/dist/js/bootstrap.bundle.min.js' %}?ver={{VERSION}}"></script>

Expand Down
1 change: 0 additions & 1 deletion pod/meeting/templates/meeting/add_or_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ <h2 class="modal-title h3" id="addEditLabel">{{ options.legend|safe }}</h2>
{% endblock page_aside %}

{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<!--
<script src="{% static 'admin/js/vendor/jquery/jquery.js' %}?ver={{VERSION}}"></script>
Expand Down
3 changes: 1 addition & 2 deletions pod/playlist/templates/playlist/add_or_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{% endfor %}
</p>
{% endif %}

{% for field_hidden in form.hidden_fields %}
{{ field_hidden }}
{% endfor %}
Expand Down Expand Up @@ -96,7 +96,6 @@
{% endblock page_aside %}

{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{ VERSION }}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}?ver={{ VERSION }}">
<script src="{% static 'playlist/js/add-or-edit.js' %}?ver={{ VERSION }}"></script>
Expand Down
2 changes: 0 additions & 2 deletions pod/podfile/templates/podfile/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<link rel="stylesheet" type="text/css" href="{% static 'podfile/css/podfile.css' %}?ver={{VERSION}}">
{% endblock more_style %}

{% block page_extra_head %}
{% endblock %}

{% block page_content %}
{% include 'podfile/home_content.html' %}
Expand Down
17 changes: 8 additions & 9 deletions pod/video/templates/channel/channel_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{% load static %}
{% load thumbnail %}
{% block page_extra_head %}
<style>
{{ form.instance.style }}
<style>
{{ form.instance.style }}

{% if form.instance.color %}
body {
background-color: {{form.instance.color}};
}
{% endif %}
</style>
{% if form.instance.color %}
body {
background-color: {{form.instance.color}};
}
{% endif %}
</style>
{% endblock page_extra_head %}

{% block breadcrumbs %}{{ block.super }}
Expand Down Expand Up @@ -152,7 +152,6 @@ <h2 class="h4 card-header card-title pod-card__title">{% trans "Form fields"%}</
{% endblock page_aside %}

{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}?ver={{VERSION}}">
{{form.media}}
Expand Down
2 changes: 1 addition & 1 deletion pod/video/templates/channel/theme_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ <h2 class="h4 card-header card-title pod-card__title">{% trans "Form fields"%}</
{% endblock page_aside %}

{% block more_script %}
{% endblock more_script %}
{% endblock more_script %}
12 changes: 3 additions & 9 deletions pod/video/templates/videos/add_video.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
{% load static %}
{% load tagging_tags %}


{% block page_extra_head %}
{% endblock page_extra_head %}


{% block breadcrumbs %}{{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'video:my_videos' %}">{% trans 'My videos' %}</a></li>
<li class="breadcrumb-item active" aria-current="page">{{page_title}}</li>
<li class="breadcrumb-item"><a href="{% url 'video:my_videos' %}">{% trans 'My videos' %}</a></li>
<li class="breadcrumb-item active" aria-current="page">{{page_title}}</li>
{% endblock %}

{% block page_title %}{% if form.instance.title %}{% trans "Editing the video" %} "{{form.instance.title}}"{% else %}{% trans "Choose an audio or video file to upload" %}{% endif %}{% endblock %}
Expand Down Expand Up @@ -113,7 +108,6 @@ <h2 class="card-header card-title pod-card__title h4">{% trans "Help for form fi


{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'admin/js/vendor/jquery/jquery.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'admin/js/jquery.init.js' %}?ver={{VERSION}}"></script>
Expand Down Expand Up @@ -235,4 +229,4 @@ <h2 class="card-header card-title pod-card__title h4">{% trans "Help for form fi
}
</style>

{% endblock more_script %}
{% endblock more_script %}
2 changes: 1 addition & 1 deletion pod/video/templates/videos/video-iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<link rel="stylesheet" href="{% static 'bootstrap/dist/css/bootstrap.min.css' %}?ver={{VERSION}}" crossorigin="anonymous">
<script src="{% static 'bootstrap/dist/js/bootstrap.bundle.min.js' %}?ver={{VERSION}}"></script>
<script src="{% url 'javascript-catalog' %}"></script>
<script id="jsi18n" src="{% url 'javascript-catalog' %}?ver={{VERSION}}"></script>

<link rel="stylesheet" href="{% static 'css/video-iframe.css' %}?ver={{VERSION}}">

Expand Down
5 changes: 0 additions & 5 deletions pod/video/templates/videos/video_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
{% load static %}
{% load tagging_tags %}

{% block page_extra_head %}
{% endblock page_extra_head %}


{% block breadcrumbs %}{{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'video:my_videos' %}">{% trans 'My videos' %}</a></li>
{% if form.instance.title and form.instance.slug != '' %}
Expand Down Expand Up @@ -271,7 +267,6 @@ <h2 class="h4 card-header card-title pod-card__title ps-2">{% trans "Help for fo


{% block more_script %}
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<script>
var listTheme = {{listTheme | safe}};
Expand Down
2 changes: 0 additions & 2 deletions pod/video_search/templates/search/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ <h2 class="card-title pod-card__title h4">{% trans 'Filter' %}</h2>
{% endblock page_aside %}

{% block more_script %}

<script src="{% static 'waypoints/lib/jquery.waypoints.min.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'waypoints/lib/shortcuts/infinite.min.js' %}?ver={{VERSION}}"></script>
<script>
Expand All @@ -188,7 +187,6 @@ <h2 class="card-title pod-card__title h4">{% trans 'Filter' %}</h2>
}
});
</script>
<script src="/admin/jsi18n/"></script>
<script src="{% static 'admin/js/core.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'admin/js/vendor/jquery/jquery.js' %}?ver={{VERSION}}"></script>
<script src="{% static 'admin/js/jquery.init.js' %}?ver={{VERSION}}"></script>
Expand Down

0 comments on commit 23517c8

Please sign in to comment.