Skip to content

Commit

Permalink
Merge remote-tracking branch 'default-theme/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrocha committed Sep 19, 2024
2 parents 6518c0f + 8a2e2e1 commit d0f23f0
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 22 deletions.
18 changes: 0 additions & 18 deletions static/css/header.css

This file was deleted.

18 changes: 18 additions & 0 deletions static/js/incidents_observer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$(document).ready(function () {
$('.contacts_incident').on("click", function () {
let $this = $(this);
const contacts = $this.data('contacts');
if (contacts.contact_name == contacts.technical_name) {
$('#technical-card').remove();
let both_subtitle = $('#translated-both-contact-text').text();
$('#card-subtitle-contact').text(both_subtitle);
}

$('#contact-name').text(contacts.contact_name);
$('#contact-email').text(contacts.contact_email);
$('#contact-telephone').text(contacts.contact_telephone);
$('#technical-name').text(contacts.technical_name);
$('#technical-email').text(contacts.technical_email);
$('#technical-telephone').text(contacts.technical_telephone);
});
});
23 changes: 21 additions & 2 deletions static/js/incidents_regulator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
$(document).ready(function () {
$('.contacts_incident').on("click", function () {
let $this = $(this);
const contacts = $this.data('contacts');
if (contacts.contact_name == contacts.technical_name) {
$('#technical-card').remove();
let both_subtitle = $('#translated-both-contact-text').text();
$('#card-subtitle-contact').text(both_subtitle);
}

$('#contact-name').text(contacts.contact_name);
$('#contact-email').text(contacts.contact_email);
$('#contact-telephone').text(contacts.contact_telephone);
$('#technical-name').text(contacts.technical_name);
$('#technical-email').text(contacts.technical_email);
$('#technical-telephone').text(contacts.technical_telephone);
});
});

function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
Expand Down Expand Up @@ -40,7 +59,7 @@ function onChangeIncident(value, id) {
});
}

function onChangeWorkflowStatus(value,id,workflow_id) {
function onChangeWorkflowStatus(value, id, workflow_id) {
const csrftoken = getCookie('csrftoken');

let formdata = $(value).serialize();
Expand Down Expand Up @@ -80,4 +99,4 @@ function getReviewStatusClass(reviewStatus) {
default:
return "";
}
}
}
53 changes: 53 additions & 0 deletions templates/modals/contacts_incident.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{% load django_bootstrap5 %}
{% load i18n %}

{% block content %}
<div class="modal-content">
<div class="modal-header bg-primary text-white">
<h4 class="modal-title" id="contacts_incident_label">
{% translate "Contacts" %}
</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body text-center">
<div class="card" id="contact-card">
<div class="card-body text-center">
<h5 class="card-title" id="contact-name"></h5>
<h6 class="card-subtitle text-muted" id="card-subtitle-contact">{% translate "Person in charge" %}</h6>
<span id="translated-both-contact-text" class="d-none">
{% translate "Person in charge and technical contact" %}
</span>
</div>
<ul class="list-group list-group-flush bg-white">
<li class="list-group-item">
<i class="bi bi-envelope me-2"></i>
<span id="contact-email"></span>
</li>
<li class="list-group-item">
<i class="bi bi-phone me-2"></i>
<span id="contact-telephone"></span>
</li>
</ul>
</div>
<div id="technical-card">
<hr />
<div class="card" >
<div class="card-body text-center">
<h5 class="card-title" id="technical-name"></h5>
<h6 class="card-subtitle mb-2 text-muted">{% translate "Technical contact" %}</h6>
</div>
<ul class="list-group list-group-flush bg-white">
<li class="list-group-item">
<i class="bi bi-envelope me-2"></i>
<span id="technical-email"></span>
</li>
<li class="list-group-item">
<i class="bi bi-phone me-2"></i>
<span id="technical-telephone"></span>
</li>
</ul>
</div>
</div>
</div>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion templates/modals/delete_incident.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% block content %}
<div class="modal-content">
<div class="modal-header bg-danger text-white">
<h4 class="modal-title" id="report_versions_label">
<h4 class="modal-title" id="delete_incident_label">
{% translate "Delete incident" %}
</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal"
Expand Down
36 changes: 36 additions & 0 deletions templates/observer/incidents.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{% extends 'incidents_base.html' %}
{% load static %}

{% block bootstrap5_extra_script %}
{{ block.super }}
<script src='{% static "js/incidents_observer.js" %}'></script>
{% endblock %}

{% load i18n %}
{% load custom_filters %}
{% load django_bootstrap5 %}
Expand Down Expand Up @@ -66,3 +73,32 @@
<span class="bi bi-check-lg d-flex align-items-center justify-content-center"></span>
{% endif %}
{% endblock %}

{% block content_table_actions %}
{{ block.super }}
<button class="btn text-secondary p-0 border-0 contacts_incident"
data-contacts='{
"contact_name": "{{ incident.contact_title }} {{ incident.contact_firstname }} {{ incident.contact_lastname }}",
"contact_email": "{{ incident.contact_email }}",
"contact_telephone": "{{ incident.contact_telephone }}",
"technical_name": "{{ incident.technical_title }} {{ incident.technical_firstname }} {{ incident.technical_lastname }}",
"technical_email": "{{ incident.technical_email }}",
"technical_telephone": "{{ incident.technical_telephone }}"
}'
data-bs-toggle="modal"
data-bs-target="#contacts_incident"
title="Contacts">
<i class="bi bi-person-vcard h4"></i>
</button>
{% endblock %}

{% block content_modals %}
{{ block.super }}
<div class="modal fade" id="contacts_incident" data-bs-backdrop="static"
data-bs-keyboard="false" tabindex="-1" aria-labelledby="contacts_incident_label"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-sm modal-dialog-scrollable">
{% include "modals/contacts_incident.html" %}
</div>
</div>
{% endblock %}
1 change: 0 additions & 1 deletion templates/parts/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{% load i18n %}

{% block bootstrap5_extra_head %}
<link rel="stylesheet" href="{% static 'css/header.css' %}">
<script src='{% static "npm_components/@popperjs/core/dist/umd/popper.min.js" %}'></script>
<script src='{% static "npm_components/jquery/dist/jquery.min.js" %}'></script>
{% endblock %}
Expand Down
29 changes: 29 additions & 0 deletions templates/regulator/incidents.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,32 @@
{{ block.super }}
<script src='{% static "js/incidents_regulator.js" %}'></script>
{% endblock %}

{% block content_table_actions %}
{{ block.super }}
<button class="btn text-secondary p-0 border-0 contacts_incident"
data-contacts='{
"contact_name": "{{ incident.contact_title }} {{ incident.contact_firstname }} {{ incident.contact_lastname }}",
"contact_email": "{{ incident.contact_email }}",
"contact_telephone": "{{ incident.contact_telephone }}",
"technical_name": "{{ incident.technical_title }} {{ incident.technical_firstname }} {{ incident.technical_lastname }}",
"technical_email": "{{ incident.technical_email }}",
"technical_telephone": "{{ incident.technical_telephone }}"
}'
data-bs-toggle="modal"
data-bs-target="#contacts_incident"
title="Contacts">
<i class="bi bi-person-vcard h4"></i>
</button>
{% endblock %}

{% block content_modals %}
{{ block.super }}
<div class="modal fade" id="contacts_incident" data-bs-backdrop="static"
data-bs-keyboard="false" tabindex="-1" aria-labelledby="contacts_incident_label"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-sm modal-dialog-scrollable">
{% include "modals/contacts_incident.html" %}
</div>
</div>
{% endblock %}

0 comments on commit d0f23f0

Please sign in to comment.