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

Password strength translations fix and templates cleanup #4678

Merged
merged 6 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions jsapp/scss/main.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '~normalize.css';

@import "variables";

@import "./libs/mdl";
Expand Down
31 changes: 16 additions & 15 deletions kobo/apps/accounts/templates/account/base.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
{% extends "base.html" %}

{% block head %}
{% load static %}
{% load static %}
{% load i18n %}

{% block head_end %}
<script src="{% static 'js/redirect_obsolete_browsers.js' %}"></script>

{% if config.login_background %}
<style>
.registration__bg {
background: url("{{ config.login_background }}");
background-size: cover;
background-repeat: no-repeat;
}
.registration__bg {
background: url('{{ config.login_background }}');
background-size: cover;
background-repeat: no-repeat;
}
</style>
{% endif %}
{% endblock %}

{% block logo %}
{% if config.logo %}
<img src="{{ config.logo }}"/>
{% else %}
<img src="{% static 'kobologo.svg' %}"/>
{% endif %}
{% if config.logo %}
<img src="{{ config.logo }}"/>
{% else %}
<img src="{% static 'kobologo.svg' %}"/>
{% endif %}
{% endblock %}

{% block language_selector %}
{% load i18n %}
{# This is the language switcher dropdown #}
<form action="{% url 'set_language' %}" method="post" class="language-switcher" data-path="{{ request.path }}">
{% csrf_token %}
Expand Down Expand Up @@ -54,7 +55,7 @@
{% endblock %}

{% block background_credit %}
{% if not config.login_background %}
{% if not config.login_background %}
{# Show the background image credit only if we're using the default image #}
<div class="registration__credit">
<a href="https://flic.kr/p/9v4mC5" title="Muhkjar refugee camp" target="_blank">
Expand All @@ -65,5 +66,5 @@
by-nc-nd
</a>
</div>
{% endif %}
{% endif %}
{% endblock %}
1 change: 0 additions & 1 deletion kpi/static/css/normalize.min.css

This file was deleted.

100 changes: 47 additions & 53 deletions kpi/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,58 +1,52 @@
<!DOCTYPE html>
<html class="no-js">
<head>
{% load static %}
{% load render_bundle from webpack_loader %}
<script src="{% static 'js/global_t.js' %}"></script>
{% render_bundle 'app' 'css' %}
{% render_bundle 'app' 'js' %}

<link rel="stylesheet" href="{% static 'css/normalize.min.css' %}">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KoboToolbox {% block title %}{% endblock %}</title>
<meta name="description" content="KoboToolbox is a free toolkit for collecting and managing data in challenging environments and is the most widely-used tool in humanitarian emergencies">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="{% static 'favicon.png' %}" />
<!-- iPhone + iPad icons -->
<link rel="apple-touch-icon" href="{% static 'apple-touch-icon.png' %}">
{% if google_analytics_token %}
<meta name="google-analytics-token" content="{{ google_analytics_token }}">
{% endif %}
{% block head %}{% endblock %}
</head>
<body>
<div class="registration__bg">
{% block language_selector %}{% endblock %}
{% block content %}{% endblock %}
{% if livereload_address %}
<script src="{{livereload_address}}"></script>
{% endif %}
{% extends "base_simple.html" %}

{% load static %}
{% load render_bundle from webpack_loader %}
{% load i18n %}
{% block foot %}
<div class="registration__footer">
<div class="registration__legal">
{% if config.TERMS_OF_SERVICE_URL %}
<a href="{{config.TERMS_OF_SERVICE_URL}}" target="_blank">{% trans "Terms and Conditions" %}</a>
{% endif %}
{% if config.PRIVACY_POLICY_URL %}
<a href="{{config.PRIVACY_POLICY_URL}}" target="_blank">{% trans "Privacy Policy" %}</a>
{% endif %}

{% block head_scripts %}
{% render_bundle 'app' 'js' %}
{% endblock %}

{% block head_stylesheets %}
{% render_bundle 'app' 'css' %}
{% endblock %}

{% block body %}
<div class="registration__bg">
{% block language_selector %}{% endblock %}

{% block content %}{% endblock %}

{% if livereload_address %}
<script src="{{livereload_address}}"></script>
{% endif %}

<div class="registration__footer">
<div class="registration__legal">
{% if config.TERMS_OF_SERVICE_URL %}
<a href="{{config.TERMS_OF_SERVICE_URL}}" target="_blank">
{% trans "Terms and Conditions" %}
</a>
{% endif %}
{% if config.PRIVACY_POLICY_URL %}
<a href="{{config.PRIVACY_POLICY_URL}}" target="_blank">
{% trans "Privacy Policy" %}
</a>
{% endif %}
</div>

{% block background_credit %}
{{ block.super }}
{% endblock %}
</div>
{% block background_credit %}
{{ block.super }}
{% endblock %}
</div>

{% block extra_javascript %}{% endblock %}

{% if google_analytics_token %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{google_analytics_token}}"></script>
<!-- The rest of the setup is in main.es6 file -->
{% endif %}
{% endblock %}
</div>

<script src="{% static 'js/global_t.js' %}"></script>
{% block extra_javascript %}{% endblock %}
{% if google_analytics_token %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{google_analytics_token}}"></script>
<!-- The rest of the setup is in main.es6 file -->
{% endif %}
</body>
</html>
55 changes: 38 additions & 17 deletions kpi/templates/base_simple.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,43 @@
{% load i18n %}
<!DOCTYPE html>
{# NOTE: All the templates we use should extend this either directly or indirectly to ensure every path visited by users behaves the same. #}

{% load static %}
<!doctype html>
<html>
<head>
<!-- Setup -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% if google_analytics_token %}
<meta name="google-analytics-token" content="{{ google_analytics_token }}">
{% endif %}
{% block head_meta %}{% endblock %}

<!-- Title and description -->
<title>KoboToolbox {% block title %}{% endblock %}</title>
<meta name="description" content="KoboToolbox is a free toolkit for collecting and managing data in challenging environments and is the most widely-used tool in humanitarian emergencies">

<!-- Icons -->
<link rel="icon" href="{% static 'favicon.png' %}" />
<link rel="apple-touch-icon" href="{% static 'apple-touch-icon.png' %}" />
<link rel="manifest" href="{% static 'site.webmanifest' %}" />
<link rel="mask-icon" href="{% static 'safari-pinned-tab.svg' %}" color="#2095f3" />

<!-- Scripts -->
<!-- Make Django's internationalization functionality available in client code. -->
<script src="{% url 'javascript-catalog' %}"></script>
<script src="{% static 'js/global_t.js' %}"></script>
{% block head_scripts %}{% endblock %}

<head>
{% load static %}
<link rel="stylesheet" href="{% static 'css/normalize.min.css' %}">
<link rel="stylesheet" href="{% static 'css/kpi_simple.css' %}">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KoboToolbox {% block title %}{% endblock %}</title>
<meta name="description" content="KoboToolbox is a free toolkit for collecting and managing data in challenging environments and is the most widely-used tool in humanitarian emergencies">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="{% static 'img/favicon.ico' %}" />
{% block head %}{% endblock %}
</head>
<!-- Stylesheets -->
{% block head_stylesheets%}
<link rel="stylesheet" href="{% static 'css/kpi_simple.css' %}">
{% endblock %}

<body>
{% block content %}{% endblock %}
</body>
{% block head_end %}{% endblock %}
</head>

<body>
{% block body %}{% endblock %}
</body>
</html>
128 changes: 59 additions & 69 deletions kpi/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,72 +1,62 @@
{% load static %}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{title}}</title>
<meta name="description" content="KoboToolbox is a free toolkit for collecting and managing data in challenging environments and is the most widely-used tool in humanitarian emergencies">
<meta name="viewport" content="width=device-width, initial-scale=1">
{# From the Django documentation: the `url` tag "Returns an absolute path reference (a URL without the domain name)" #}
<meta name="kpi-root-path" content="{% url 'kpi-root' %}">
{% if csrf_token %}<meta name="csrf-token" content="{{csrf_token}}">{% endif %}

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

{% if raven_js_dsn %}
<meta name="sentry-dsn" content="{{ raven_js_dsn }}">
<script src="https://cdn.ravenjs.com/3.22.3/raven.min.js" crossorigin="anonymous"></script>
<script src="{% static 'js/sentry.js' %}"></script>
{% endif %}
{% if google_analytics_token %}
<meta name="google-analytics-token" content="{{ google_analytics_token }}">
{% endif %}

{% load render_bundle from webpack_loader %}

<link rel="apple-touch-icon" sizes="180x180" href="{% static 'apple-touch-icon.png' %}" />
<link rel="manifest" href="{% static 'site.webmanifest' %}" />
<link rel="mask-icon" href="{% static 'safari-pinned-tab.svg' %}" color="#2095f3" />
<link rel="icon" href="{% static 'favicon.png' %}" />

{% render_bundle 'app' 'css' %}
{% extends "base_simple.html" %}

{% if config.logo %}
<style>
{% load static %}
{% load render_bundle from webpack_loader %}

{% block head_meta %}
{# From the Django documentation: the `url` tag "Returns an absolute path reference (a URL without the domain name)" #}
<meta name="kpi-root-path" content="{% url 'kpi-root' %}">
{% if csrf_token %}
<meta name="csrf-token" content="{{csrf_token}}">
{% endif %}
{% endblock %}

{% block title %}{{title}}{% endblock %}

{% block head_scripts %}
<script src="{% static 'js/redirect_obsolete_browsers.js' %}"></script>

<!-- Raven setup -->
{% if raven_js_dsn %}
<meta name="sentry-dsn" content="{{ raven_js_dsn }}">
<script src="https://cdn.ravenjs.com/3.22.3/raven.min.js" crossorigin="anonymous"></script>
<script src="{% static 'js/sentry.js' %}"></script>
{% endif %}
{% endblock %}

{% block head_stylesheets %}
{% render_bundle 'app' 'css' %}
{% endblock %}

{% block head_end %}
<!-- Logo overrides -->
{% if config.logo %}
<style>
.mdl-layout__header .header__logo {
background-image: url('{{ config.logo }}') !important;
}
</style>
{% endif %}
{% if config.logo_small %}
<style>
@media screen and (max-width: 767px) {
.mdl-layout__header .header__logo {
background-image: url("{{ config.logo }}") !important;
}
</style>
{% endif %}
{% if config.logo_small %}
<style>
@media screen and (max-width: 767px) {
.mdl-layout__header .header__logo {
background-image: url("{{ config.logo_small }}") !important;
}
background-image: url('{{ config.logo_small }}') !important;
}
</style>
{% endif %}
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
{% block content %}{% endblock content %}

{% block footer %}
<!-- Make Django's internationalization functionality available in client code. -->
<script src="{% url 'javascript-catalog' %}"></script>
<script src="{% static 'js/global_t.js' %}"></script>

{% render_bundle 'app' 'js' %}

{% endblock footer %}

{% if google_analytics_token %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{google_analytics_token}}"></script>
<!-- The rest of the setup is in main.es6 file -->
{% endif %}
</body>
</html>
}
</style>
{% endif %}
{% endblock %}

{% block body %}
{# Here the `/jsapp/js/main.es6` file will create and inject some HTML element, so that React SPA would render inside of it. #}

{# We load the main js file here, not in the head, because we need the body element to exist in order to inject stuff into it with JS. #}
{% render_bundle 'app' 'js' %}

{% if google_analytics_token %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{google_analytics_token}}"></script>
<!-- The rest of the GA setup is in `/jsapp/js/main.es6` file -->
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion kpi/templates/modern_browsers.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base_simple.html" %}
{% load i18n %}
{% block title %}| {% trans "Modern Browsers" %}{% endblock %}
{% block content %}
{% block body %}
<h1>{% trans "Modern Browsers" %}</h1>

<p>
Expand Down