diff options
author | Magnus Hagander | 2015-02-15 11:23:51 +0000 |
---|---|---|
committer | Magnus Hagander | 2015-02-15 11:23:51 +0000 |
commit | a5300fa4802749be5d43f3183f636c70342538cc (patch) | |
tree | 828478631264b1d6b55302d920a639f9866589e8 | |
parent | 27cba025a501c9dbcfb08da0c4db95dc6111d647 (diff) |
Add the ability to copy/paste a msgid when creating an annotation
-rw-r--r-- | pgcommitfest/commitfest/static/commitfest/js/commitfest.js | 16 | ||||
-rw-r--r-- | 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('<option value="">---</option>'); $.each(data, function(i,m) { sel.append('<option value="' + m.msgid + '">' + m.from + ': ' + m.subj + ' (' + m.date + ')</option>'); }); @@ -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 @@ <div id="annotateMessageBody" class="modal-body"> <div>Pick one of the messages in this thread</div> <div id="annotateListWrap"> - <select id="annotateMessageList" style="width:100%;" onChange="annotateChanged()"> + <select id="annotateMessageList" style="width:100%;" onChange="annotateMsgPicked()"> </select> </div> + <div>Or copy/paste the message-id:</div> + <div id="annotateMsgidWrap"> + <input id="annotateMsgId" type="text" style="width:100%" onKeyUp="annotateChanged()"> + </div> <div><br/></div> <div>Enter a messages for the annotation</div> <div id="annotateTextWrap"> |