##// END OF EJS Templates
pullrequest: just replace children of other_ref when other_repo changes...
Mads Kiilerich -
r3512:ff3f10a6 beta
parent child Browse files
Show More
@@ -86,19 +86,6 b' var prevElementSibling = function( el ) '
86 }
86 }
87 }
87 }
88
88
89 var setSelectValue = function(select, val){
90 var selection = YUD.get(select);
91
92 // select element
93 for(var i=0;i<selection.options.length;i++){
94 if (selection.options[i].innerHTML == val) {
95 selection.selectedIndex = i;
96 break;
97 }
98 }
99 }
100
101
102 /**
89 /**
103 * SmartColorGenerator
90 * SmartColorGenerator
104 *
91 *
@@ -161,12 +161,19 b''
161 ypjax(url,'pull_request_overview', function(data){
161 ypjax(url,'pull_request_overview', function(data){
162 var sel_box = YUQ('#pull_request_form #other_repo')[0];
162 var sel_box = YUQ('#pull_request_form #other_repo')[0];
163 var repo_name = sel_box.options[sel_box.selectedIndex].value;
163 var repo_name = sel_box.options[sel_box.selectedIndex].value;
164 YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description'];
165 // replace options of other_ref with the ones for the current other_repo
166 var other_ref_selector = YUD.get('other_ref');
167 var new_select = YUD.createElementFromMarkup(other_repos_info[repo_name]['revs']);
168 var new_selectedIndex = new_select.selectedIndex;
169 other_ref_selector.innerHTML = ""; // clear old options
170 while (new_select.length > 0){ // children will be popped when appened to other_ref_selector
171 other_ref_selector.appendChild(new_select.children[0]);
172 }
173 // browsers lost track of selected when appendChild was used
174 other_ref_selector.selectedIndex = new_selectedIndex;
175 // reset && add the reviewer based on selected repo
164 var _data = other_repos_info[repo_name];
176 var _data = other_repos_info[repo_name];
165 YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description'];
166 YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
167 // select back the revision that was just compared
168 setSelectValue(YUD.get('other_ref'), rev_data['other_ref']);
169 // reset && add the reviewer based on selected repo
170 YUD.get('review_members').innerHTML = '';
177 YUD.get('review_members').innerHTML = '';
171 addReviewMember(_data.user.user_id, _data.user.firstname,
178 addReviewMember(_data.user.user_id, _data.user.firstname,
172 _data.user.lastname, _data.user.username,
179 _data.user.lastname, _data.user.username,
@@ -182,8 +189,6 b''
182
189
183 YUE.on('other_repo', 'change', function(e){
190 YUE.on('other_repo', 'change', function(e){
184 var repo_name = e.currentTarget.value;
191 var repo_name = e.currentTarget.value;
185 // replace the <select> of changed repo
186 YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
187 loadPreview();
192 loadPreview();
188 });
193 });
189
194
General Comments 0
You need to be logged in to leave comments. Login now