diff --git a/apps/member/static/member/js/alias.js b/apps/member/static/member/js/alias.js new file mode 100644 index 00000000..2d652dde --- /dev/null +++ b/apps/member/static/member/js/alias.js @@ -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); +}) \ No newline at end of file diff --git a/apps/member/templates/member/alias_update.html b/apps/member/templates/member/alias_update.html deleted file mode 100644 index d1f6115b..00000000 --- a/apps/member/templates/member/alias_update.html +++ /dev/null @@ -1,12 +0,0 @@ -{% load django_tables2 crispy_forms_tags i18n %} -
- - -
-
-
- {% render_table aliases %} -
-
diff --git a/apps/member/templates/member/club_alias.html b/apps/member/templates/member/club_alias.html index 4b6f2882..60e2bef0 100644 --- a/apps/member/templates/member/club_alias.html +++ b/apps/member/templates/member/club_alias.html @@ -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" %} +
+

+ {% trans "Note aliases" %} +

+
+
+ {% csrf_token %} + + +
+ +
+
+
+ {% render_table aliases %} +
{% endblock %} {% block extrajavascript %} - -{% endblock%} + +{% endblock%} \ No newline at end of file diff --git a/apps/member/templates/member/club_detail.html b/apps/member/templates/member/club_detail.html index 451e4d76..bd6e8399 100644 --- a/apps/member/templates/member/club_detail.html +++ b/apps/member/templates/member/club_detail.html @@ -9,10 +9,10 @@ {% endblock %} {% block extrajavascript %} - -{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/apps/member/templates/member/noteowner_detail.html b/apps/member/templates/member/noteowner_detail.html index d97f723a..4f5f7a1d 100644 --- a/apps/member/templates/member/noteowner_detail.html +++ b/apps/member/templates/member/noteowner_detail.html @@ -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 %} -
-
- {% block profile_info %} - {% endblock %} -
-
- {% block profile_content %} - {% endblock %} -
+
+
+ {% block profile_info %} + {% endblock %}
+
+ {% block profile_content %} + {% endblock %} +
+
- {% block extra_content %} - {% endblock %} +{% block extra_content %}{% endblock %} {% endblock %} {% block extrajavascript %} - -{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/apps/member/templates/member/profile_alias.html b/apps/member/templates/member/profile_alias.html index eb6e499a..ee2369e4 100644 --- a/apps/member/templates/member/profile_alias.html +++ b/apps/member/templates/member/profile_alias.html @@ -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"%} +
+

+ {% trans "Note aliases" %} +

+
+
+ {% csrf_token %} + + +
+ +
+
+
+ {% render_table aliases %} +
{% endblock %} {% block extrajavascript %} - -{% endblock%} + +{% endblock%} \ No newline at end of file diff --git a/apps/member/templates/member/profile_detail.html b/apps/member/templates/member/profile_detail.html index 35728191..297af21c 100644 --- a/apps/member/templates/member/profile_detail.html +++ b/apps/member/templates/member/profile_detail.html @@ -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 %} diff --git a/apps/registration/static/registration/login.css b/apps/registration/static/registration/css/login.css similarity index 58% rename from apps/registration/static/registration/login.css rename to apps/registration/static/registration/css/login.css index 77a2f007..b789b2f7 100644 --- a/apps/registration/static/registration/login.css +++ b/apps/registration/static/registration/css/login.css @@ -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; } \ No newline at end of file diff --git a/apps/registration/static/registration/fa-lock.svg b/apps/registration/static/registration/img/fa-lock.svg similarity index 100% rename from apps/registration/static/registration/fa-lock.svg rename to apps/registration/static/registration/img/fa-lock.svg diff --git a/apps/registration/static/registration/fa-user.svg b/apps/registration/static/registration/img/fa-user.svg similarity index 100% rename from apps/registration/static/registration/fa-user.svg rename to apps/registration/static/registration/img/fa-user.svg diff --git a/note_kfet/static/css/custom.css b/note_kfet/static/css/custom.css index 6ad67d9b..cfd42a86 100644 --- a/note_kfet/static/css/custom.css +++ b/note_kfet/static/css/custom.css @@ -41,6 +41,7 @@ select.language { color: #6c757d; -moz-appearance: none; width: auto; + cursor: pointer; } /* Last BDE colors */ diff --git a/note_kfet/static/js/alias.js b/note_kfet/static/js/alias.js deleted file mode 100644 index cdb21b2b..00000000 --- a/note_kfet/static/js/alias.js +++ /dev/null @@ -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); - }); - } diff --git a/note_kfet/templates/registration/login.html b/note_kfet/templates/registration/login.html index 027c629d..87ccbd3c 100644 --- a/note_kfet/templates/registration/login.html +++ b/note_kfet/templates/registration/login.html @@ -7,7 +7,7 @@ SPDX-License-Identifier: GPL-2.0-or-later {% block contenttitle %}{% endblock %} {% block extracss %} - + {% endblock %} {% block content %}