Changeset - cb360bf40863
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2014-10-03 00:20:36
madski@unity3d.com
pull requests: when creating, disable other_ref on other_repo change until new data has been loaded
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/pullrequests/pullrequest.html
Show inline comments
 
@@ -145,25 +145,26 @@ ${self.repo_context_bar('showpullrequest
 
  PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
 

	
 
  pyroutes.register('pullrequest_repo_info', "${url('pullrequest_repo_info',repo_name='%(repo_name)s')}", ['repo_name']);
 

	
 
  var pendingajax = undefined;
 
  var otherrepoChanged = function(){
 
      var $other_ref = $('#other_ref');
 
      $other_ref.prop('disabled', true);
 
      var repo_name = $('#other_repo').val();
 
      if (pendingajax) {
 
          pendingajax.abort();
 
          pendingajax = undefined;
 
      }
 
      pendingajax = ajaxGET(pyroutes.url('pullrequest_repo_info', {"repo_name": repo_name}),
 
          function(o){
 
              pendingajax = undefined;
 
              var data = JSON.parse(o.responseText);
 
              $('#other_repo_desc').html(data.description);
 

	
 
              // replace options of other_ref with the ones for the current other_repo
 
              var $other_ref = $('#other_ref');
 
              $other_ref.empty();
 
              for(var i = 0; i < data.refs.length; i++)
 
              {
 
                var $optgroup = $('<optgroup/>').attr('label', data.refs[i][1]);
 
                var options = data.refs[i][0];
 
                var length = options.length;
 
@@ -183,12 +184,13 @@ ${self.repo_context_bar('showpullrequest
 

	
 
              // re-populate the select2 thingie
 
              $("#other_ref").select2({
 
                  dropdownAutoWidth: true
 
              });
 

	
 
              $other_ref.prop('disabled', false);
 
              loadPreview();
 
          });
 
  };
 

	
 
  var loadPreview = function(){
 
      //url template
0 comments (0 inline, 0 general)