From 2851d7764c947adaf5a3c6f3ba5024d05f25e548 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 5 Aug 2020 19:52:36 +0200 Subject: [PATCH] Profile pictures are clickable --- static/js/base.js | 10 +++------- static/js/consos.js | 1 + static/js/transfer.js | 1 + templates/note/conso_form.html | 6 ++++-- templates/note/transaction_form.html | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/static/js/base.js b/static/js/base.js index 9e458ee6..52fce901 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -131,13 +131,9 @@ function displayNote(note, alias, user_note_field = null, profile_pic_field = nu $("#" + user_note_field).text(alias + (note.balance == null ? "" : (" :\n" + pretty_money(note.balance)))); if (profile_pic_field != null) { $("#" + profile_pic_field).attr('src', img); - $("#" + profile_pic_field).click(function () { - if (note.resourcetype === "NoteUser") { - document.location.href = "/accounts/user/" + note.user; - } else if (note.resourcetype === "NoteClub") { - document.location.href = "/accounts/club/" + note.club; - } - }); + $("#" + profile_pic_field + "_link").attr('href', note.resourcetype === "NoteUser" ? + "/accounts/user/" + note.user : note.resourcetype === "NoteClub" ? + "/accounts/club/" + note.club : "#"); } } } diff --git a/static/js/consos.js b/static/js/consos.js index b75a7b59..cb6b730f 100644 --- a/static/js/consos.js +++ b/static/js/consos.js @@ -145,6 +145,7 @@ function reset() { $("#consos_list").html(""); $("#user_note").text(""); $("#profile_pic").attr("src", "/media/pic/default.png"); + $("#profile_pic_link").attr("href", "#"); refreshHistory(); refreshBalance(); } diff --git a/static/js/transfer.js b/static/js/transfer.js index bff6b493..88368a27 100644 --- a/static/js/transfer.js +++ b/static/js/transfer.js @@ -37,6 +37,7 @@ function reset(refresh=true) { $("#bank").val(""); $("#user_note").val(""); $("#profile_pic").attr("src", "/media/pic/default.png"); + $("#profile_pic_link").attr("href", "#"); if (refresh) { refreshBalance(); refreshHistory(); diff --git a/templates/note/conso_form.html b/templates/note/conso_form.html index a63f7ffe..52c6b94f 100644 --- a/templates/note/conso_form.html +++ b/templates/note/conso_form.html @@ -12,8 +12,10 @@ {# User details column #}
- + + +
diff --git a/templates/note/transaction_form.html b/templates/note/transaction_form.html index 3549871f..8494c22b 100644 --- a/templates/note/transaction_form.html +++ b/templates/note/transaction_form.html @@ -36,8 +36,8 @@ SPDX-License-Identifier: GPL-2.0-or-later
- +