diff options
Diffstat (limited to 'pgcommitfest/commitfest')
-rw-r--r-- | pgcommitfest/commitfest/static/commitfest/js/commitfest.js | 22 | ||||
-rw-r--r-- | pgcommitfest/commitfest/templates/patch.html | 9 | ||||
-rw-r--r-- | pgcommitfest/commitfest/views.py | 1 |
3 files changed, 26 insertions, 6 deletions
diff --git a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js index 1ac3bc2..ca49f61 100644 --- a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js +++ b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js @@ -25,9 +25,13 @@ function findLatestThreads() { return false; } -function browseThreads(attachfunc) { +function browseThreads(attachfunc, closefunc) { $('#attachThreadList').find('option').remove(); $('#attachThreadMessageId').val(''); + $('#attachModal').off('hidden.bs.modal'); + $('#attachModal').on('hidden.bs.modal', function(e) { + if (closefunc) closefunc(); + }); $('#attachModal').modal(); findLatestThreads(); @@ -52,9 +56,16 @@ function browseThreads(attachfunc) { } -function attachThread(cfid, patchid) { +function attachThread(cfid, patchid, closefunc) { browseThreads(function(msgid) { - doAttachThread(cfid, patchid, msgid); + doAttachThread(cfid, patchid, msgid, !closefunc); + if (closefunc) { + /* We don't really care about closing it, we just reload immediately */ + closefunc(); + } + }, + function() { + if (closefunc) closefunc(); }); } @@ -81,13 +92,14 @@ function attachThreadChanged() { } } -function doAttachThread(cfid, patchid, msgid) { +function doAttachThread(cfid, patchid, msgid, reloadonsuccess) { $.post('/ajax/attachThread/', { 'cf': cfid, 'p': patchid, 'msg': msgid, }).success(function(data) { - location.reload(); + if (reloadonsuccess) + location.reload(); return true; }).fail(function(data) { if (data.status == 404) { diff --git a/pgcommitfest/commitfest/templates/patch.html b/pgcommitfest/commitfest/templates/patch.html index d09a175..2c504cf 100644 --- a/pgcommitfest/commitfest/templates/patch.html +++ b/pgcommitfest/commitfest/templates/patch.html @@ -58,7 +58,7 @@ {%if user.is_authenticated%} <div style="float:right"><button class="btn btn-default" onclick="attachThread({{cf.id}},{{patch.id}})">Attach thread</button></div> {%else%} - <div style="float:right"><button class="btn btn-default" onclick="location.href='/https/git.postgresql.org/login_and_redirect_back'">Attach thread</button></div> + <div style="float:right"><button class="btn btn-default" onclick="location.href='/https/git.postgresql.org/account/login/?next=/{{cf.id}}/{{patch.id}}/%3Fattachthreadnow'">Attach thread</button></div> {%endif%} <dl> {%for t in patch.mailthread_set.all%} @@ -147,5 +147,12 @@ $(document).ready(function() { $(o).tooltip(); }); }); +{%if attachnow%} +$(document).ready(function() { + attachThread({{cf.id}},{{patch.id}}, function() { + document.location.replace('/{{cf.id}}/{{patch.id}}/'); + }); +}); +{%endif%} </script> {%endblock%} diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index b11ee88..3e0dcd1 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -207,6 +207,7 @@ def patch(request, cfid, patchid): 'is_this_committer': is_this_committer, 'is_reviewer': is_reviewer, 'committers': committers, + 'attachnow': request.GET.has_key('attachthreadnow'), 'title': patch.name, 'breadcrumbs': [{'title': cf.title, 'href': '/%s/' % cf.pk},], }, context_instance=RequestContext(request)) |