Merge branch 'more_front' into 'beta'

More front

See merge request bde/nk20!96
This commit is contained in:
erdnaxe 2020-08-23 00:35:31 +02:00
commit ac0e9b9da2
13 changed files with 116 additions and 93 deletions

View File

@ -0,0 +1,43 @@
/**
* On form submit, create a new alias
*/
function create_alias (e) {
// Do not submit HTML form
e.preventDefault();
// Get data and send to API
const formData = new FormData(e.target);
$.post("/api/note/alias/", {
"csrfmiddlewaretoken": formData.get("csrfmiddlewaretoken"),
"name": formData.get("name"),
"note": formData.get("note")
}).done(function () {
// Reload table
$("#alias_table").load(location.pathname + " #alias_table");
addMsg("Alias ajouté", "success");
}).fail(function (xhr, _textStatus, _error) {
errMsg(xhr.responseJSON);
});
}
/**
* On click of "delete", delete the alias
* @param Integer button_id Alias id to remove
*/
function delete_button (button_id) {
$.ajax({
url: "/api/note/alias/" + button_id + "/",
method: "DELETE",
headers: { "X-CSRFTOKEN": CSRF_TOKEN }
}).done(function () {
addMsg('Alias supprimé', 'success');
$("#alias_table").load(location.pathname + " #alias_table");
}).fail(function (xhr, _textStatus, _error) {
errMsg(xhr.responseJSON);
});
}
$(document).ready(function () {
// Attach event
document.getElementById("form_alias").addEventListener("submit", create_alias);
})

View File

@ -1,12 +0,0 @@
{% load django_tables2 crispy_forms_tags i18n %}
<div class="d-flex justify-content-center">
<input id="alias_input" type="text" value=""/>
<button id="alias_submit" class="btn btn-primary mx-2" onclick="create_alias( {{ object.note.pk }} )" type="submit">
{% trans "Add alias" %}
</button>
</div>
<div class="card bg-light shadow">
<div class="card-body">
{% render_table aliases %}
</div>
</div>

View File

@ -1,10 +1,25 @@
{% extends "member/club_detail.html" %}
{% load i18n static pretty_money django_tables2 crispy_forms_tags %}
{% load static django_tables2 i18n %}
{% block profile_content %}
{% include "member/alias_update.html" %}
<div class="card bg-light">
<h3 class="card-header text-center">
{% trans "Note aliases" %}
</h3>
<div class="card-body">
<form class="input-group" method="POST" id="form_alias">
{% csrf_token %}
<input type="hidden" name="note" value="{{ object.note.pk }}">
<input type="text" name="name" class="form-control">
<div class="input-group-append">
<input type="submit" class="btn btn-success" value="{% trans "Add" %}">
</div>
</form>
</div>
{% render_table aliases %}
</div>
{% endblock %}
{% block extrajavascript %}
<script src="/static/js/alias.js"></script>
{% endblock%}
<script src="{% static "member/js/alias.js" %}"></script>
{% endblock%}

View File

@ -9,10 +9,10 @@
{% endblock %}
{% block extrajavascript %}
<script>
function refreshHistory() {
$("#history_list").load("{% url 'member:club_detail' pk=object.pk %} #history_list");
$("#profile_infos").load("{% url 'member:club_detail' pk=object.pk %} #profile_infos");
}
</script>
{% endblock %}
<script>
function refreshHistory() {
$("#history_list").load("{% url 'member:club_detail' pk=object.pk %} #history_list");
$("#profile_infos").load("{% url 'member:club_detail' pk=object.pk %} #profile_infos");
}
</script>
{% endblock %}

View File

@ -1,32 +1,32 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load static i18n pretty_money %}
{% load render_table from django_tables2 %}
{% load pretty_money %}
{# Use a fluid-width container #}
{% block containertype %}container-fluid{% endblock %}
{% block content %}
<div class="row mt-4">
<div class="col-xl-4">
{% block profile_info %}
{% endblock %}
</div>
<div class="col-xl-8">
{% block profile_content %}
{% endblock %}
</div>
<div class="row mt-4">
<div class="col-xl-4">
{% block profile_info %}
{% endblock %}
</div>
<div class="col-xl-8">
{% block profile_content %}
{% endblock %}
</div>
</div>
{% block extra_content %}
{% endblock %}
{% block extra_content %}{% endblock %}
{% endblock %}
{% block extrajavascript %}
<script>
{% if object %}
function refreshHistory() {
$("#history_list").load("{% url 'member:user_detail' pk=object.pk %} #history_list");
$("#profile_infos").load("{% url 'member:user_detail' pk=object.pk %} #profile_infos");
}
{% endif %}
</script>
{% endblock %}
<script>
{% if object %}
function refreshHistory() {
$("#history_list").load("{% url 'member:user_detail' pk=object.pk %} #history_list");
$("#profile_infos").load("{% url 'member:user_detail' pk=object.pk %} #profile_infos");
}
{% endif %}
</script>
{% endblock %}

View File

@ -1,10 +1,25 @@
{% extends "member/profile_detail.html" %}
{% load i18n static pretty_money django_tables2 crispy_forms_tags %}
{% load static django_tables2 i18n %}
{% block profile_content %}
{% include "member/alias_update.html"%}
<div class="card bg-light">
<h3 class="card-header text-center">
{% trans "Note aliases" %}
</h3>
<div class="card-body">
<form class="input-group" method="POST" id="form_alias">
{% csrf_token %}
<input type="hidden" name="note" value="{{ object.note.pk }}">
<input type="text" name="name" class="form-control">
<div class="input-group-append">
<input type="submit" class="btn btn-success" value="{% trans "Add" %}">
</div>
</form>
</div>
{% render_table aliases %}
</div>
{% endblock %}
{% block extrajavascript %}
<script src="/static/js/alias.js"></script>
{% endblock%}
<script src="{% static "member/js/alias.js" %}"></script>
{% endblock%}

View File

@ -1,8 +1,5 @@
{% extends "member/noteowner_detail.html" %}
{# Use a fluid-width container #}
{% block containertype %}container-fluid{% endblock %}
{% block profile_info %}
{% include "member/profile_info.html" %}
{% endblock %}

View File

@ -4,15 +4,16 @@ Font-Awesome attribution is already done inside SVG files
*/
#login-form input[type="text"] {
background: #fff right 1rem top 50% / 5% no-repeat url('fa-user.svg');
background: #fff right 1rem top 50% / 5% no-repeat url('../img/fa-user.svg');
padding-right: 3rem;
}
#login-form input[type="password"] {
background: #fff right 1rem top 50% / 5% no-repeat url('fa-lock.svg');
background: #fff right 1rem top 50% / 5% no-repeat url('../img/fa-lock.svg');
padding-right: 3rem;
}
#login-form select {
-moz-appearance: none;
cursor: pointer;
}

View File

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 529 B

View File

Before

Width:  |  Height:  |  Size: 573 B

After

Width:  |  Height:  |  Size: 573 B

View File

@ -41,6 +41,7 @@ select.language {
color: #6c757d;
-moz-appearance: none;
width: auto;
cursor: pointer;
}
/* Last BDE colors */

View File

@ -1,37 +0,0 @@
$("#alias_input").on('keypress',function(e) {
if(e.which == 13) {
$("#alias_submit").click();
}
});
function create_alias(note_id){
$.post("/api/note/alias/",
{
"csrfmiddlewaretoken": CSRF_TOKEN,
"name": $("#alias_input").val(),
"note": note_id
}
).done(function(){
$("#alias_table").load(location.pathname+ " #alias_table");
addMsg("Alias ajouté","success");
})
.fail(function(xhr, textStatus, error){
errMsg(xhr.responseJSON);
});
}
// on click of button "delete" , call the API
function delete_button(button_id){
$.ajax({
url:"/api/note/alias/"+button_id+"/",
method:"DELETE",
headers: {"X-CSRFTOKEN": CSRF_TOKEN}
})
.done(function(){
addMsg('Alias supprimé','success');
$("#alias_table").load(location.pathname + " #alias_table");
})
.fail(function(xhr,textStatus, error){
errMsg(xhr.responseJSON);
});
}

View File

@ -7,7 +7,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
{% block contenttitle %}{% endblock %}
{% block extracss %}
<link rel="stylesheet" href="{% static "registration/login.css" %}">
<link rel="stylesheet" href="{% static "registration/css/login.css" %}">
{% endblock %}
{% block content %}