Show More
@@ -148,7 +148,10 | |||||
148 | //Monitor range checkboxes and build a link to changesets |
|
148 | //Monitor range checkboxes and build a link to changesets | |
149 | //ranges |
|
149 | //ranges | |
150 | var checkboxes = YUD.getElementsByClassName('changeset_range'); |
|
150 | var checkboxes = YUD.getElementsByClassName('changeset_range'); | |
151 | var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}"; |
|
151 | // register our routes needed for this view | |
|
152 | pyroutes.register('changeset_home', "${h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s')}", ['repo_name', 'revision']); | |||
|
153 | pyroutes.register('changelog_home', "${h.url('changelog_home', repo_name='%(repo_name)s')}", ['repo_name']); | |||
|
154 | pyroutes.register('pullrequest_home', "${h.url('pullrequest_home', repo_name='%(repo_name)s')}", ['repo_name']); | |||
152 |
|
155 | |||
153 | var checkbox_checker = function(e){ |
|
156 | var checkbox_checker = function(e){ | |
154 | var checked_checkboxes = []; |
|
157 | var checked_checkboxes = []; | |
@@ -173,8 +176,8 | |||||
173 | if(checked_checkboxes.length>0){ |
|
176 | if(checked_checkboxes.length>0){ | |
174 | var rev_end = checked_checkboxes[0].name; |
|
177 | var rev_end = checked_checkboxes[0].name; | |
175 | var rev_start = checked_checkboxes[checked_checkboxes.length-1].name; |
|
178 | var rev_start = checked_checkboxes[checked_checkboxes.length-1].name; | |
176 | var url = url_tmpl.replace('__REVRANGE__', |
|
179 | var url = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}', | |
177 | rev_start+'...'+rev_end); |
|
180 | 'revision': rev_start+'...'+rev_end}); | |
178 |
|
181 | |||
179 | var link = (rev_start == rev_end) |
|
182 | var link = (rev_start == rev_end) | |
180 | ? _TM['Show selected changeset __S'] |
|
183 | ? _TM['Show selected changeset __S'] | |
@@ -187,16 +190,22 | |||||
187 | YUD.setStyle('rev_range_container','display',''); |
|
190 | YUD.setStyle('rev_range_container','display',''); | |
188 | YUD.setStyle('rev_range_clear','display',''); |
|
191 | YUD.setStyle('rev_range_clear','display',''); | |
189 |
|
192 | |||
190 | var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name,rev_start='{0}',rev_end='{1}')}"; |
|
193 | YUD.get('open_new_pr').href = pyroutes.url('pullrequest_home', | |
191 | YUD.get('open_new_pr').href = pr_tmpl.format(rev_start,rev_end); |
|
194 | {'repo_name': '${c.repo_name}', | |
|
195 | 'rev_start': rev_start, | |||
|
196 | 'rev_end': rev_end}) | |||
|
197 | ||||
192 | YUD.setStyle('compare_fork','display','none'); |
|
198 | YUD.setStyle('compare_fork','display','none'); | |
193 | }else{ |
|
199 | }else{ | |
194 | YUD.setStyle('rev_range_container','display','none'); |
|
200 | YUD.setStyle('rev_range_container','display','none'); | |
195 | YUD.setStyle('rev_range_clear','display','none'); |
|
201 | YUD.setStyle('rev_range_clear','display','none'); | |
196 | %if c.branch_name: |
|
202 | %if c.branch_name: | |
197 |
YUD.get('open_new_pr').href = |
|
203 | YUD.get('open_new_pr').href = pyroutes.url('pullrequest_home', | |
|
204 | {'repo_name': '${c.repo_name}', | |||
|
205 | 'branch':'${c.branch_name}'}); | |||
198 | %else: |
|
206 | %else: | |
199 |
YUD.get('open_new_pr').href = |
|
207 | YUD.get('open_new_pr').href = pyroutes.url('pullrequest_home', | |
|
208 | {'repo_name': '${c.repo_name}'}); | |||
200 | %endif |
|
209 | %endif | |
201 | YUD.setStyle('compare_fork','display',''); |
|
210 | YUD.setStyle('compare_fork','display',''); | |
202 | } |
|
211 | } | |
@@ -244,15 +253,12 | |||||
244 | // change branch filter |
|
253 | // change branch filter | |
245 | YUE.on(YUD.get('branch_filter'),'change',function(e){ |
|
254 | YUE.on(YUD.get('branch_filter'),'change',function(e){ | |
246 | var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value; |
|
255 | var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value; | |
247 | var url_main = "${h.url('changelog_home',repo_name=c.repo_name)}"; |
|
|||
248 | var url = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}"; |
|
|||
249 | var url = url.replace('__BRANCH__', encodeURIComponent(selected_branch)); |
|
|||
250 | if(selected_branch != ''){ |
|
256 | if(selected_branch != ''){ | |
251 |
window.location = url |
|
257 | window.location = pyroutes.url('changelog_home', {'repo_name': '${c.repo_name}', | |
|
258 | 'branch':encodeURIComponent(selected_branch)}); | |||
252 | }else{ |
|
259 | }else{ | |
253 |
window.location = |
|
260 | window.location = pyroutes.url('changelog_home', {'repo_name': '${c.repo_name}'}); | |
254 | } |
|
261 | } | |
255 |
|
||||
256 | }); |
|
262 | }); | |
257 |
|
263 | |||
258 | function set_canvas(width) { |
|
264 | function set_canvas(width) { |
General Comments 0
You need to be logged in to leave comments.
Login now