From a5300fa4802749be5d43f3183f636c70342538cc Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sun, 15 Feb 2015 12:23:51 +0100 Subject: [PATCH] Add the ability to copy/paste a msgid when creating an annotation --- .../static/commitfest/js/commitfest.js | 16 ++++++++++++++-- pgcommitfest/commitfest/templates/patch.html | 6 +++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js index 4fd06e5..be143f9 100644 --- a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js +++ b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js @@ -126,6 +126,7 @@ function updateAnnotationMessages(threadid) { }).success(function(data) { sel = $('#annotateMessageList') sel.find('option').remove(); + sel.append(''); $.each(data, function(i,m) { sel.append(''); }); @@ -136,7 +137,9 @@ function updateAnnotationMessages(threadid) { function addAnnotation(threadid) { $('#annotateThreadList').find('option').remove(); $('#annotateMessage').val(''); + $('#annotateMsgId').val(''); $('#annotateModal').modal(); + $('#annotateThreadList').focus(); updateAnnotationMessages(threadid); $('#doAnnotateMessageButton').unbind('click'); $('#doAnnotateMessageButton').click(function() { @@ -144,11 +147,12 @@ function addAnnotation(threadid) { $('#annotateMessageBody').addClass('loading'); $.post('/ajax/annotateMessage/', { 't': threadid, - 'msgid': $('#annotateMessageList').val(), + 'msgid': $.trim($('#annotateMsgId').val()), 'msg': $('#annotateMessage').val() }).success(function(data) { if (data != 'OK') { alert(data); + $('#annotateMessageBody').removeClass('loading'); } else { $('#annotateModal').modal('hide'); @@ -161,9 +165,17 @@ function addAnnotation(threadid) { }); } +function annotateMsgPicked() { + var val = $('#annotateMessageList').val(); + if (val) { + $('#annotateMsgId').val(val); + annotateChanged(); + } +} + function annotateChanged() { /* Enable/disable the annotate button */ - if ($('#annotateMessage').val() != '' && $('#annotateMessageList').val()) { + if ($('#annotateMessage').val() != '' && $('#annotateMsgId').val()) { $('#doAnnotateMessageButton').removeClass('disabled'); } else { diff --git a/pgcommitfest/commitfest/templates/patch.html b/pgcommitfest/commitfest/templates/patch.html index f18cf9d..36ff044 100644 --- a/pgcommitfest/commitfest/templates/patch.html +++ b/pgcommitfest/commitfest/templates/patch.html @@ -176,9 +176,13 @@