diff options
| author | Magnus Hagander | 2015-02-14 12:07:48 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2015-02-14 12:07:48 +0000 |
| commit | 27cba025a501c9dbcfb08da0c4db95dc6111d647 (patch) | |
| tree | 6c793f942597c9aee7cc31435baf8eaaabd9b3a9 /pgcommitfest/commitfest/static | |
| parent | 4800696f20614bd2017d671a1b28df55f9952345 (diff) | |
Implement simple message annotations
This feature makes it possible to "pull in" a message in a thread and highlight
it with an annotation (free text format). This will list the message in a table
along with the annotation and who made it.
Annotations have to be attached to a specific message - for a "generic" one it
makes sense to attach it to the latest message available, as that will put it
at the correct place in time.
Diffstat (limited to 'pgcommitfest/commitfest/static')
| -rw-r--r-- | pgcommitfest/commitfest/static/commitfest/css/commitfest.css | 13 | ||||
| -rw-r--r-- | pgcommitfest/commitfest/static/commitfest/js/commitfest.js | 65 |
2 files changed, 78 insertions, 0 deletions
diff --git a/pgcommitfest/commitfest/static/commitfest/css/commitfest.css b/pgcommitfest/commitfest/static/commitfest/css/commitfest.css index 74cb018..e3058a3 100644 --- a/pgcommitfest/commitfest/static/commitfest/css/commitfest.css +++ b/pgcommitfest/commitfest/static/commitfest/css/commitfest.css @@ -60,3 +60,16 @@ div.form-group div.controls input.threadpick-input { #attachThreadListWrap.loading * { display: none; } + +/* + * Annotate message dialog */ +#annotateMessageBody.loading { + display: block; + background: url('/static/commitfest/spinner.gif') no-repeat center; + width: 124px; + height: 124px; + margin: 0 auto; +} +#annotateMessageBody.loading * { + display: none; +} diff --git a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js index f1797ff..4fd06e5 100644 --- a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js +++ b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js @@ -118,6 +118,71 @@ function doAttachThread(cfid, patchid, msgid, reloadonsuccess) { }); } +function updateAnnotationMessages(threadid) { + $('#annotateMessageBody').addClass('loading'); + $('#doAnnotateMessageButton').addClass('disabled'); + $.get('/ajax/getMessages', { + 't': threadid, + }).success(function(data) { + sel = $('#annotateMessageList') + sel.find('option').remove(); + $.each(data, function(i,m) { + sel.append('<option value="' + m.msgid + '">' + m.from + ': ' + m.subj + ' (' + m.date + ')</option>'); + }); + }).always(function() { + $('#annotateMessageBody').removeClass('loading'); + }); +} +function addAnnotation(threadid) { + $('#annotateThreadList').find('option').remove(); + $('#annotateMessage').val(''); + $('#annotateModal').modal(); + updateAnnotationMessages(threadid); + $('#doAnnotateMessageButton').unbind('click'); + $('#doAnnotateMessageButton').click(function() { + $('#doAnnotateMessageButton').addClass('disabled'); + $('#annotateMessageBody').addClass('loading'); + $.post('/ajax/annotateMessage/', { + 't': threadid, + 'msgid': $('#annotateMessageList').val(), + 'msg': $('#annotateMessage').val() + }).success(function(data) { + if (data != 'OK') { + alert(data); + } + else { + $('#annotateModal').modal('hide'); + location.reload(); + } + }).fail(function(data) { + alert('Failed to annotate message'); + $('#annotateMessageBody').removeClass('loading'); + }); + }); +} + +function annotateChanged() { + /* Enable/disable the annotate button */ + if ($('#annotateMessage').val() != '' && $('#annotateMessageList').val()) { + $('#doAnnotateMessageButton').removeClass('disabled'); + } + else { + $('#doAnnotateMessageButton').addClass('disabled'); + } +} + +function deleteAnnotation(annid) { + if (confirm('Are you sure you want to delete this annotation?')) { + $.post('/ajax/deleteAnnotation/', { + 'id': annid, + }).success(function(data) { + location.reload(); + }).fail(function(data) { + alert('Failed to delete annotation!'); + }); + } +} + function flagCommitted(committer) { $('#commitModal').modal(); $('#committerSelect').val(committer); |
