mirror of https://gitlab.crans.org/bde/nk20
Fix emitter button
This commit is contained in:
parent
9361f3f2f0
commit
484560fe4b
|
@ -130,7 +130,6 @@ function displayNote(note, alias, user_note_field = null, profile_pic_field = nu
|
|||
if (profile_pic_field != null) {
|
||||
$("#" + profile_pic_field).attr('src', img);
|
||||
$("#" + profile_pic_field).click(function () {
|
||||
console.log(note);
|
||||
if (note.resourcetype === "NoteUser") {
|
||||
document.location.href = "/accounts/user/" + note.user;
|
||||
} else if (note.resourcetype === "NoteClub") {
|
||||
|
@ -223,9 +222,7 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
|
|||
|
||||
// When the user type "Enter", the first alias is clicked
|
||||
field.keypress(function (event) {
|
||||
console.log(notes);
|
||||
if (event.originalEvent.charCode === 13 && notes.length > 0) {
|
||||
console.log(42);
|
||||
let li_obj = field.parent().find("ul li").first();
|
||||
displayNote(notes[0], li_obj.text(), user_note_field, profile_pic_field);
|
||||
li_obj.trigger("click");
|
||||
|
|
|
@ -7,7 +7,7 @@ function refreshHistory() {
|
|||
$("#history").load("/note/transfer/ #history");
|
||||
}
|
||||
|
||||
function reset() {
|
||||
function reset(refresh=true) {
|
||||
sources_notes_display.length = 0;
|
||||
sources.length = 0;
|
||||
dests_notes_display.length = 0;
|
||||
|
@ -21,8 +21,10 @@ function reset() {
|
|||
$("#bank").val("");
|
||||
$("#user_note").val("");
|
||||
$("#profile_pic").attr("src", "/media/pic/default.png");
|
||||
refreshBalance();
|
||||
refreshHistory();
|
||||
if (refresh) {
|
||||
refreshBalance();
|
||||
refreshHistory();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
@ -138,15 +140,18 @@ $(document).ready(function() {
|
|||
|
||||
$("#source_me").click(function() {
|
||||
// Shortcut to set the current user as the only emitter
|
||||
reset();
|
||||
reset(false);
|
||||
|
||||
let source_note = $("#source_note");
|
||||
source_note.focus();
|
||||
source_note.val(username);
|
||||
source_note.val("");
|
||||
let event = jQuery.Event("keyup");
|
||||
event.originalEvent = {charCode: 0};
|
||||
event.originalEvent = {charCode: 97};
|
||||
source_note.trigger(event);
|
||||
source_note.val(username);
|
||||
event = jQuery.Event("keyup");
|
||||
event.originalEvent = {charCode: 97};
|
||||
source_note.trigger(event);
|
||||
console.log(sources.length);
|
||||
let fill_note = function() {
|
||||
if (sources.length === 0) {
|
||||
setTimeout(fill_note, 100);
|
||||
|
|
|
@ -56,9 +56,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
|||
<div class="card-body">
|
||||
<input class="form-control mx-auto d-block" type="text" id="source_note" placeholder="{% trans "Name or alias..." %}" />
|
||||
<hr>
|
||||
<button class="form-control mx-auto d-block btn btn-secondary" id="source_me">
|
||||
<span class="form-control mx-auto d-block btn btn-secondary" id="source_me">
|
||||
{% trans "I am the emitter" %}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue