Show More
@@ -1,314 +1,314 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | <%inherit file="/base/base.mako"/> |
|
4 | 4 | |
|
5 | 5 | <%def name="title()"> |
|
6 | 6 | ${_('%s Changelog') % c.repo_name} |
|
7 | 7 | %if c.changelog_for_path: |
|
8 | 8 | /${c.changelog_for_path} |
|
9 | 9 | %endif |
|
10 | 10 | %if c.rhodecode_name: |
|
11 | 11 | · ${h.branding(c.rhodecode_name)} |
|
12 | 12 | %endif |
|
13 | 13 | </%def> |
|
14 | 14 | |
|
15 | 15 | <%def name="breadcrumbs_links()"> |
|
16 | 16 | %if c.changelog_for_path: |
|
17 | 17 | /${c.changelog_for_path} |
|
18 | 18 | %endif |
|
19 | 19 | </%def> |
|
20 | 20 | |
|
21 | 21 | <%def name="menu_bar_nav()"> |
|
22 | 22 | ${self.menu_items(active='repositories')} |
|
23 | 23 | </%def> |
|
24 | 24 | |
|
25 | 25 | <%def name="menu_bar_subnav()"> |
|
26 | 26 | ${self.repo_menu(active='changelog')} |
|
27 | 27 | </%def> |
|
28 | 28 | |
|
29 | 29 | <%def name="main()"> |
|
30 | 30 | |
|
31 | 31 | <div class="box"> |
|
32 | 32 | <div class="title"> |
|
33 | 33 | ${self.repo_page_title(c.rhodecode_db_repo)} |
|
34 | 34 | <ul class="links"> |
|
35 | 35 | <li> |
|
36 | 36 | <a href="#" class="btn btn-small" id="rev_range_container" style="display:none;"></a> |
|
37 | 37 | %if c.rhodecode_db_repo.fork: |
|
38 | 38 | <span> |
|
39 | 39 | <a id="compare_fork_button" |
|
40 | 40 | title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}" |
|
41 | 41 | class="btn btn-small" |
|
42 | 42 | href="${h.route_path('repo_compare', |
|
43 | 43 | repo_name=c.rhodecode_db_repo.fork.repo_name, |
|
44 | 44 | source_ref_type=c.rhodecode_db_repo.landing_rev[0], |
|
45 | 45 | source_ref=c.rhodecode_db_repo.landing_rev[1], |
|
46 | 46 | target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0], |
|
47 | 47 | target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1], |
|
48 | 48 | _query=dict(merge=1, target_repo=c.repo_name))}" |
|
49 | 49 | > |
|
50 | 50 | ${_('Compare fork with Parent (%s)' % c.rhodecode_db_repo.fork.repo_name)} |
|
51 | 51 | </a> |
|
52 | 52 | </span> |
|
53 | 53 | %endif |
|
54 | 54 | |
|
55 | 55 | ## pr open link |
|
56 | 56 | %if h.is_hg(c.rhodecode_repo) or h.is_git(c.rhodecode_repo): |
|
57 | 57 | <span> |
|
58 | 58 | <a id="open_new_pull_request" class="btn btn-small btn-success" href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}"> |
|
59 | 59 | ${_('Open new pull request')} |
|
60 | 60 | </a> |
|
61 | 61 | </span> |
|
62 | 62 | %endif |
|
63 | 63 | |
|
64 | 64 | ## clear selection |
|
65 | 65 | <div title="${_('Clear selection')}" class="btn" id="rev_range_clear" style="display:none"> |
|
66 | 66 | ${_('Clear selection')} |
|
67 | 67 | </div> |
|
68 | 68 | |
|
69 | 69 | </li> |
|
70 | 70 | </ul> |
|
71 | 71 | </div> |
|
72 | 72 | |
|
73 | 73 | % if c.pagination: |
|
74 | 74 | <script type="text/javascript" src="${h.asset('js/src/plugins/jquery.commits-graph.js')}"></script> |
|
75 | 75 | |
|
76 | 76 | <div class="graph-header"> |
|
77 | 77 | <div id="filter_changelog"> |
|
78 | 78 | ${h.hidden('branch_filter')} |
|
79 | 79 | %if c.selected_name: |
|
80 | 80 | <div class="btn btn-default" id="clear_filter" > |
|
81 | 81 | ${_('Clear filter')} |
|
82 | 82 | </div> |
|
83 | 83 | %endif |
|
84 | 84 | </div> |
|
85 | 85 | ${self.breadcrumbs('breadcrumbs_light')} |
|
86 | 86 | <div class="pull-right"> |
|
87 | 87 | % if h.is_hg(c.rhodecode_repo): |
|
88 | 88 | % if c.show_hidden: |
|
89 | 89 | <a class="action-link" href="${h.current_route_path(request, evolve=0)}">${_('Hide obsolete/hidden')}</a> |
|
90 | 90 | % else: |
|
91 | 91 | <a class="action-link" href="${h.current_route_path(request, evolve=1)}">${_('Show obsolete/hidden')}</a> |
|
92 | 92 | % endif |
|
93 | 93 | % else: |
|
94 | 94 | <span class="action-link disabled">${_('Show hidden')}</span> |
|
95 | 95 | % endif |
|
96 | 96 | </div> |
|
97 | 97 | <div id="commit-counter" data-total=${c.total_cs} class="pull-right"> |
|
98 | 98 | ${_ungettext('showing %d out of %d commit', 'showing %d out of %d commits', c.showing_commits) % (c.showing_commits, c.total_cs)} |
|
99 | 99 | </div> |
|
100 | 100 | </div> |
|
101 | 101 | |
|
102 | 102 | <div id="graph"> |
|
103 | 103 | <div class="graph-col-wrapper"> |
|
104 | 104 | <div id="graph_nodes"> |
|
105 | 105 | <div id="graph_canvas"></div> |
|
106 | 106 | </div> |
|
107 | 107 | <div id="graph_content" class="main-content graph_full_width"> |
|
108 | 108 | |
|
109 | 109 | <div class="table"> |
|
110 | 110 | <table id="changesets" class="rctable"> |
|
111 | 111 | <tr> |
|
112 | 112 | ## checkbox |
|
113 | 113 | <th></th> |
|
114 | 114 | <th colspan="2"></th> |
|
115 | 115 | |
|
116 | 116 | <th>${_('Commit')}</th> |
|
117 | 117 | ## Mercurial phase/evolve state |
|
118 | 118 | <th></th> |
|
119 | 119 | ## commit message expand arrow |
|
120 | 120 | <th></th> |
|
121 | 121 | <th>${_('Commit Message')}</th> |
|
122 | 122 | |
|
123 | 123 | <th>${_('Age')}</th> |
|
124 | 124 | <th>${_('Author')}</th> |
|
125 | 125 | |
|
126 | 126 | <th>${_('Refs')}</th> |
|
127 | 127 | </tr> |
|
128 | 128 | |
|
129 | 129 | <tbody class="commits-range"> |
|
130 | 130 | <%include file='changelog_elements.mako'/> |
|
131 | 131 | </tbody> |
|
132 | 132 | </table> |
|
133 | 133 | </div> |
|
134 | 134 | </div> |
|
135 | 135 | <div class="pagination-wh pagination-left"> |
|
136 | 136 | ${c.pagination.pager('$link_previous ~2~ $link_next')} |
|
137 | 137 | </div> |
|
138 | 138 | </div> |
|
139 | 139 | |
|
140 | 140 | <script type="text/javascript"> |
|
141 | 141 | var cache = {}; |
|
142 | 142 | $(function(){ |
|
143 | 143 | |
|
144 | 144 | // Create links to commit ranges when range checkboxes are selected |
|
145 | 145 | var $commitCheckboxes = $('.commit-range'); |
|
146 | 146 | // cache elements |
|
147 | 147 | var $commitRangeContainer = $('#rev_range_container'); |
|
148 | 148 | var $commitRangeClear = $('#rev_range_clear'); |
|
149 | 149 | |
|
150 | 150 | var checkboxRangeSelector = function(e){ |
|
151 | 151 | var selectedCheckboxes = []; |
|
152 | 152 | for (pos in $commitCheckboxes){ |
|
153 | 153 | if($commitCheckboxes[pos].checked){ |
|
154 | 154 | selectedCheckboxes.push($commitCheckboxes[pos]); |
|
155 | 155 | } |
|
156 | 156 | } |
|
157 | 157 | var open_new_pull_request = $('#open_new_pull_request'); |
|
158 | 158 | if(open_new_pull_request){ |
|
159 | 159 | var selected_changes = selectedCheckboxes.length; |
|
160 |
if (selected_changes > 1 || selected_changes == 1 && templateContext.repo_type |
|
|
160 | if (selected_changes > 1 || selected_changes == 1 && templateContext.repo_type == 'svn') { | |
|
161 | 161 | open_new_pull_request.hide(); |
|
162 | 162 | } else { |
|
163 | 163 | if (selected_changes == 1) { |
|
164 | 164 | open_new_pull_request.html(_gettext('Open new pull request for selected commit')); |
|
165 | 165 | } else if (selected_changes == 0) { |
|
166 | 166 | open_new_pull_request.html(_gettext('Open new pull request')); |
|
167 | 167 | } |
|
168 | 168 | open_new_pull_request.show(); |
|
169 | 169 | } |
|
170 | 170 | } |
|
171 | 171 | |
|
172 | 172 | if (selectedCheckboxes.length>0){ |
|
173 | 173 | var revEnd = selectedCheckboxes[0].name; |
|
174 | 174 | var revStart = selectedCheckboxes[selectedCheckboxes.length-1].name; |
|
175 | 175 | var url = pyroutes.url('repo_commit', |
|
176 | 176 | {'repo_name': '${c.repo_name}', |
|
177 | 177 | 'commit_id': revStart+'...'+revEnd}); |
|
178 | 178 | |
|
179 | 179 | var link = (revStart == revEnd) |
|
180 | 180 | ? _gettext('Show selected commit __S') |
|
181 | 181 | : _gettext('Show selected commits __S ... __E'); |
|
182 | 182 | |
|
183 | 183 | link = link.replace('__S', revStart.substr(0,6)); |
|
184 | 184 | link = link.replace('__E', revEnd.substr(0,6)); |
|
185 | 185 | |
|
186 | 186 | $commitRangeContainer |
|
187 | 187 | .attr('href',url) |
|
188 | 188 | .html(link) |
|
189 | 189 | .show(); |
|
190 | 190 | |
|
191 | 191 | $commitRangeClear.show(); |
|
192 | 192 | var _url = pyroutes.url('pullrequest_new', |
|
193 | 193 | {'repo_name': '${c.repo_name}', |
|
194 | 194 | 'commit': revEnd}); |
|
195 | 195 | open_new_pull_request.attr('href', _url); |
|
196 | 196 | $('#compare_fork_button').hide(); |
|
197 | 197 | } else { |
|
198 | 198 | $commitRangeContainer.hide(); |
|
199 | 199 | $commitRangeClear.hide(); |
|
200 | 200 | |
|
201 | 201 | %if c.branch_name: |
|
202 | 202 | var _url = pyroutes.url('pullrequest_new', |
|
203 | 203 | {'repo_name': '${c.repo_name}', |
|
204 | 204 | 'branch':'${c.branch_name}'}); |
|
205 | 205 | open_new_pull_request.attr('href', _url); |
|
206 | 206 | %else: |
|
207 | 207 | var _url = pyroutes.url('pullrequest_new', |
|
208 | 208 | {'repo_name': '${c.repo_name}'}); |
|
209 | 209 | open_new_pull_request.attr('href', _url); |
|
210 | 210 | %endif |
|
211 | 211 | $('#compare_fork_button').show(); |
|
212 | 212 | } |
|
213 | 213 | }; |
|
214 | 214 | |
|
215 | 215 | $commitCheckboxes.on('click', checkboxRangeSelector); |
|
216 | 216 | |
|
217 | 217 | $commitRangeClear.on('click',function(e) { |
|
218 | 218 | $commitCheckboxes.attr('checked', false); |
|
219 | 219 | checkboxRangeSelector(); |
|
220 | 220 | e.preventDefault(); |
|
221 | 221 | }); |
|
222 | 222 | |
|
223 | 223 | // make sure the buttons are consistent when navigate back and forth |
|
224 | 224 | checkboxRangeSelector(); |
|
225 | 225 | |
|
226 | 226 | var msgs = $('.message'); |
|
227 | 227 | // get first element height |
|
228 | 228 | var el = $('#graph_content .container')[0]; |
|
229 | 229 | var row_h = el.clientHeight; |
|
230 | 230 | for (var i=0; i < msgs.length; i++) { |
|
231 | 231 | var m = msgs[i]; |
|
232 | 232 | |
|
233 | 233 | var h = m.clientHeight; |
|
234 | 234 | var pad = $(m).css('padding'); |
|
235 | 235 | if (h > row_h) { |
|
236 | 236 | var offset = row_h - (h+12); |
|
237 | 237 | $(m.nextElementSibling).css('display','block'); |
|
238 | 238 | $(m.nextElementSibling).css('margin-top',offset+'px'); |
|
239 | 239 | } |
|
240 | 240 | } |
|
241 | 241 | |
|
242 | 242 | $("#clear_filter").on("click", function() { |
|
243 | 243 | var filter = {'repo_name': '${c.repo_name}'}; |
|
244 | 244 | window.location = pyroutes.url('repo_changelog', filter); |
|
245 | 245 | }); |
|
246 | 246 | |
|
247 | 247 | $("#branch_filter").select2({ |
|
248 | 248 | 'dropdownAutoWidth': true, |
|
249 | 249 | 'width': 'resolve', |
|
250 | 250 | 'placeholder': "${c.selected_name or _('Filter changelog')}", |
|
251 | 251 | containerCssClass: "drop-menu", |
|
252 | 252 | dropdownCssClass: "drop-menu-dropdown", |
|
253 | 253 | query: function(query){ |
|
254 | 254 | var key = 'cache'; |
|
255 | 255 | var cached = cache[key] ; |
|
256 | 256 | if(cached) { |
|
257 | 257 | var data = {results: []}; |
|
258 | 258 | //filter results |
|
259 | 259 | $.each(cached.results, function(){ |
|
260 | 260 | var section = this.text; |
|
261 | 261 | var children = []; |
|
262 | 262 | $.each(this.children, function(){ |
|
263 | 263 | if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){ |
|
264 | 264 | children.push({'id': this.id, 'text': this.text, 'type': this.type}) |
|
265 | 265 | } |
|
266 | 266 | }); |
|
267 | 267 | data.results.push({'text': section, 'children': children}); |
|
268 | 268 | query.callback({results: data.results}); |
|
269 | 269 | }); |
|
270 | 270 | }else{ |
|
271 | 271 | $.ajax({ |
|
272 | 272 | url: pyroutes.url('repo_refs_changelog_data', {'repo_name': '${c.repo_name}'}), |
|
273 | 273 | data: {}, |
|
274 | 274 | dataType: 'json', |
|
275 | 275 | type: 'GET', |
|
276 | 276 | success: function(data) { |
|
277 | 277 | cache[key] = data; |
|
278 | 278 | query.callback({results: data.results}); |
|
279 | 279 | } |
|
280 | 280 | }) |
|
281 | 281 | } |
|
282 | 282 | } |
|
283 | 283 | }); |
|
284 | 284 | $('#branch_filter').on('change', function(e){ |
|
285 | 285 | var data = $('#branch_filter').select2('data'); |
|
286 | 286 | //type: branch_closed |
|
287 | 287 | var selected = data.text; |
|
288 | 288 | var filter = {'repo_name': '${c.repo_name}'}; |
|
289 | 289 | if(data.type == 'branch' || data.type == 'branch_closed'){ |
|
290 | 290 | filter["branch"] = selected; |
|
291 | 291 | if (data.type == 'branch_closed') { |
|
292 | 292 | filter["evolve"] = '1'; |
|
293 | 293 | } |
|
294 | 294 | } |
|
295 | 295 | else if (data.type == 'book'){ |
|
296 | 296 | filter["bookmark"] = selected; |
|
297 | 297 | } |
|
298 | 298 | window.location = pyroutes.url('repo_changelog', filter); |
|
299 | 299 | }); |
|
300 | 300 | |
|
301 | 301 | commitsController = new CommitsController(); |
|
302 | 302 | % if not c.changelog_for_path: |
|
303 | 303 | commitsController.reloadGraph(); |
|
304 | 304 | % endif |
|
305 | 305 | |
|
306 | 306 | }); |
|
307 | 307 | |
|
308 | 308 | </script> |
|
309 | 309 | </div> |
|
310 | 310 | % else: |
|
311 | 311 | ${_('There are no changes yet')} |
|
312 | 312 | % endif |
|
313 | 313 | </div> |
|
314 | 314 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now