# HG changeset patch # User Mads Kiilerich # Date 2014-08-12 13:08:23 # Node ID 44ae84b422ade4ae4622035e458080217e71e153 # Parent 3dda6822009267235e41c83066b4d4ceba6eba00 pull requests: update select2 for target ref when the hidden select is changed because of repo change diff --git a/kallithea/templates/pullrequests/pullrequest.html b/kallithea/templates/pullrequests/pullrequest.html --- a/kallithea/templates/pullrequests/pullrequest.html +++ b/kallithea/templates/pullrequests/pullrequest.html @@ -167,6 +167,14 @@ ${self.repo_context_bar('showpullrequest addReviewMember(_data.user.user_id, _data.user.firstname, _data.user.lastname, _data.user.username, _data.user.gravatar_link); + + // (re)populate the select2 thingie + $("#other_ref").select2({ + dropdownAutoWidth: true, + }); + $("#other_ref").on("change", function(e){ + loadPreview(); + }); } var loadPreview = function(){ @@ -231,13 +239,6 @@ ${self.repo_context_bar('showpullrequest loadPreview(); }); - $("#other_ref").select2({ - dropdownAutoWidth: true, - }); - $("#other_ref").on("change", function(e){ - loadPreview(); - }); - otherrepoChanged(); //lazy load overview after 0.5s setTimeout(loadPreview, 500);