##// END OF EJS Templates
core: stop using deprecated .revision
marcink -
r3105:a07a1322 default
parent child Browse files
Show More
@@ -1,92 +1,92 b''
1 <%def name="render_line(line_num, tokens,
1 <%def name="render_line(line_num, tokens,
2 annotation=None,
2 annotation=None,
3 bgcolor=None, show_annotation=None)">
3 bgcolor=None, show_annotation=None)">
4 <%
4 <%
5 from rhodecode.lib.codeblocks import render_tokenstream
5 from rhodecode.lib.codeblocks import render_tokenstream
6 # avoid module lookup for performance
6 # avoid module lookup for performance
7 html_escape = h.html_escape
7 html_escape = h.html_escape
8 tooltip = h.tooltip
8 tooltip = h.tooltip
9 %>
9 %>
10 <tr class="cb-line cb-line-fresh ${'cb-annotate' if show_annotation else ''}"
10 <tr class="cb-line cb-line-fresh ${'cb-annotate' if show_annotation else ''}"
11 %if annotation:
11 %if annotation:
12 data-revision="${annotation.revision}"
12 data-revision="${annotation.idx}"
13 %endif
13 %endif
14 >
14 >
15
15
16 % if annotation:
16 % if annotation:
17 % if show_annotation:
17 % if show_annotation:
18 <td class="cb-annotate-info tooltip"
18 <td class="cb-annotate-info tooltip"
19 title="Author: ${tooltip(annotation.author) | entity}<br>Date: ${annotation.date}<br>Message: ${annotation.message | entity}"
19 title="Author: ${tooltip(annotation.author) | entity}<br>Date: ${annotation.date}<br>Message: ${annotation.message | entity}"
20 >
20 >
21 ${h.gravatar_with_user(request, annotation.author, 16) | n}
21 ${h.gravatar_with_user(request, annotation.author, 16) | n}
22 <div class="cb-annotate-message truncate-wrap">${h.chop_at_smart(annotation.message, '\n', suffix_if_chopped='...')}</div>
22 <div class="cb-annotate-message truncate-wrap">${h.chop_at_smart(annotation.message, '\n', suffix_if_chopped='...')}</div>
23 </td>
23 </td>
24 <td class="cb-annotate-message-spacer">
24 <td class="cb-annotate-message-spacer">
25 <a class="tooltip" href="#show-previous-annotation" onclick="return annotationController.previousAnnotation('${annotation.raw_id}', '${c.f_path}', ${line_num})" title="${tooltip(_('view annotation from before this change'))}">
25 <a class="tooltip" href="#show-previous-annotation" onclick="return annotationController.previousAnnotation('${annotation.raw_id}', '${c.f_path}', ${line_num})" title="${tooltip(_('view annotation from before this change'))}">
26 <i class="icon-left"></i>
26 <i class="icon-left"></i>
27 </a>
27 </a>
28 </td>
28 </td>
29 <td
29 <td
30 class="cb-annotate-revision"
30 class="cb-annotate-revision"
31 data-revision="${annotation.revision}"
31 data-revision="${annotation.idx}"
32 onclick="$('[data-revision=${annotation.revision}]').toggleClass('cb-line-fresh')"
32 onclick="$('[data-revision=${annotation.idx}]').toggleClass('cb-line-fresh')"
33 style="background: ${bgcolor}">
33 style="background: ${bgcolor}">
34 <a class="cb-annotate" href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=annotation.raw_id)}">
34 <a class="cb-annotate" href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=annotation.raw_id)}">
35 r${annotation.revision}
35 r${annotation.idx}
36 </a>
36 </a>
37 </td>
37 </td>
38 % else:
38 % else:
39 <td></td>
39 <td></td>
40 <td class="cb-annotate-message-spacer"></td>
40 <td class="cb-annotate-message-spacer"></td>
41 <td
41 <td
42 class="cb-annotate-revision"
42 class="cb-annotate-revision"
43 data-revision="${annotation.revision}"
43 data-revision="${annotation.idx}"
44 onclick="$('[data-revision=${annotation.revision}]').toggleClass('cb-line-fresh')"
44 onclick="$('[data-revision=${annotation.idx}]').toggleClass('cb-line-fresh')"
45 style="background: ${bgcolor}">
45 style="background: ${bgcolor}">
46 </td>
46 </td>
47 % endif
47 % endif
48 % else:
48 % else:
49 <td colspan="3"></td>
49 <td colspan="3"></td>
50 % endif
50 % endif
51
51
52
52
53 <td class="cb-lineno" id="L${line_num}">
53 <td class="cb-lineno" id="L${line_num}">
54 <a data-line-no="${line_num}" href="#L${line_num}"></a>
54 <a data-line-no="${line_num}" href="#L${line_num}"></a>
55 </td>
55 </td>
56 <td class="cb-content cb-content-fresh"
56 <td class="cb-content cb-content-fresh"
57 %if bgcolor:
57 %if bgcolor:
58 style="background: ${bgcolor}"
58 style="background: ${bgcolor}"
59 %endif
59 %endif
60 >
60 >
61 ## newline at end is necessary for highlight to work when line is empty
61 ## newline at end is necessary for highlight to work when line is empty
62 ## and for copy pasting code to work as expected
62 ## and for copy pasting code to work as expected
63 <span class="cb-code">${render_tokenstream(tokens)|n}${'\n'}</span>
63 <span class="cb-code">${render_tokenstream(tokens)|n}${'\n'}</span>
64 </td>
64 </td>
65 </tr>
65 </tr>
66 </%def>
66 </%def>
67
67
68 <%def name="render_annotation_lines(annotation, lines, color_hasher)">
68 <%def name="render_annotation_lines(annotation, lines, color_hasher)">
69 % for line_num, tokens in lines:
69 % for line_num, tokens in lines:
70 ${render_line(line_num, tokens,
70 ${render_line(line_num, tokens,
71 bgcolor=color_hasher(annotation and annotation.raw_id or ''),
71 bgcolor=color_hasher(annotation and annotation.raw_id or ''),
72 annotation=annotation, show_annotation=loop.first
72 annotation=annotation, show_annotation=loop.first
73 )}
73 )}
74 % endfor
74 % endfor
75 <script>
75 <script>
76 var AnnotationController = function() {
76 var AnnotationController = function() {
77 var self = this;
77 var self = this;
78
78
79 this.previousAnnotation = function(commitId, fPath, lineNo) {
79 this.previousAnnotation = function(commitId, fPath, lineNo) {
80 var params = {
80 var params = {
81 'repo_name': templateContext.repo_name,
81 'repo_name': templateContext.repo_name,
82 'commit_id': commitId,
82 'commit_id': commitId,
83 'f_path': fPath,
83 'f_path': fPath,
84 'line_anchor': lineNo
84 'line_anchor': lineNo
85 };
85 };
86 window.location = pyroutes.url('repo_files:annotated_previous', params);
86 window.location = pyroutes.url('repo_files:annotated_previous', params);
87 return false;
87 return false;
88 };
88 };
89 };
89 };
90 var annotationController = new AnnotationController();
90 var annotationController = new AnnotationController();
91 </script>
91 </script>
92 </%def>
92 </%def>
@@ -1,333 +1,333 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
3 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
4
4
5 <%def name="title()">
5 <%def name="title()">
6 %if c.compare_home:
6 %if c.compare_home:
7 ${_('%s Compare') % c.repo_name}
7 ${_('%s Compare') % c.repo_name}
8 %else:
8 %else:
9 ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.source_repo.repo_name, c.source_ref)} &gt; ${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}
9 ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.source_repo.repo_name, c.source_ref)} &gt; ${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}
10 %endif
10 %endif
11 %if c.rhodecode_name:
11 %if c.rhodecode_name:
12 &middot; ${h.branding(c.rhodecode_name)}
12 &middot; ${h.branding(c.rhodecode_name)}
13 %endif
13 %endif
14 </%def>
14 </%def>
15
15
16 <%def name="breadcrumbs_links()">
16 <%def name="breadcrumbs_links()">
17 ${_ungettext('%s commit','%s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
17 ${_ungettext('%s commit','%s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
18 </%def>
18 </%def>
19
19
20 <%def name="menu_bar_nav()">
20 <%def name="menu_bar_nav()">
21 ${self.menu_items(active='repositories')}
21 ${self.menu_items(active='repositories')}
22 </%def>
22 </%def>
23
23
24 <%def name="menu_bar_subnav()">
24 <%def name="menu_bar_subnav()">
25 ${self.repo_menu(active='compare')}
25 ${self.repo_menu(active='compare')}
26 </%def>
26 </%def>
27
27
28 <%def name="main()">
28 <%def name="main()">
29 <script type="text/javascript">
29 <script type="text/javascript">
30 // set fake commitId on this commit-range page
30 // set fake commitId on this commit-range page
31 templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}";
31 templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}";
32 </script>
32 </script>
33
33
34 <div class="box">
34 <div class="box">
35 <div class="title">
35 <div class="title">
36 ${self.repo_page_title(c.rhodecode_db_repo)}
36 ${self.repo_page_title(c.rhodecode_db_repo)}
37 </div>
37 </div>
38
38
39 <div class="summary changeset">
39 <div class="summary changeset">
40 <div class="summary-detail">
40 <div class="summary-detail">
41 <div class="summary-detail-header">
41 <div class="summary-detail-header">
42 <span class="breadcrumbs files_location">
42 <span class="breadcrumbs files_location">
43 <h4>
43 <h4>
44 ${_('Compare Commits')}
44 ${_('Compare Commits')}
45 % if c.file_path:
45 % if c.file_path:
46 ${_('for file')} <a href="#${'a_' + h.FID('',c.file_path)}">${c.file_path}</a>
46 ${_('for file')} <a href="#${'a_' + h.FID('',c.file_path)}">${c.file_path}</a>
47 % endif
47 % endif
48
48
49 % if c.commit_ranges:
49 % if c.commit_ranges:
50 <code>
50 <code>
51 r${c.source_commit.revision}:${h.short_id(c.source_commit.raw_id)}...r${c.target_commit.revision}:${h.short_id(c.target_commit.raw_id)}
51 r${c.source_commit.idx}:${h.short_id(c.source_commit.raw_id)}...r${c.target_commit.idx}:${h.short_id(c.target_commit.raw_id)}
52 </code>
52 </code>
53 % endif
53 % endif
54 </h4>
54 </h4>
55 </span>
55 </span>
56 </div>
56 </div>
57
57
58 <div class="fieldset">
58 <div class="fieldset">
59 <div class="left-label">
59 <div class="left-label">
60 ${_('Target')}:
60 ${_('Target')}:
61 </div>
61 </div>
62 <div class="right-content">
62 <div class="right-content">
63 <div>
63 <div>
64 <div class="code-header" >
64 <div class="code-header" >
65 <div class="compare_header">
65 <div class="compare_header">
66 ## The hidden elements are replaced with a select2 widget
66 ## The hidden elements are replaced with a select2 widget
67 ${h.hidden('compare_source')}
67 ${h.hidden('compare_source')}
68 </div>
68 </div>
69 </div>
69 </div>
70 </div>
70 </div>
71 </div>
71 </div>
72 </div>
72 </div>
73
73
74 <div class="fieldset">
74 <div class="fieldset">
75 <div class="left-label">
75 <div class="left-label">
76 ${_('Source')}:
76 ${_('Source')}:
77 </div>
77 </div>
78 <div class="right-content">
78 <div class="right-content">
79 <div>
79 <div>
80 <div class="code-header" >
80 <div class="code-header" >
81 <div class="compare_header">
81 <div class="compare_header">
82 ## The hidden elements are replaced with a select2 widget
82 ## The hidden elements are replaced with a select2 widget
83 ${h.hidden('compare_target')}
83 ${h.hidden('compare_target')}
84 </div>
84 </div>
85 </div>
85 </div>
86 </div>
86 </div>
87 </div>
87 </div>
88 </div>
88 </div>
89
89
90 <div class="fieldset">
90 <div class="fieldset">
91 <div class="left-label">
91 <div class="left-label">
92 ${_('Actions')}:
92 ${_('Actions')}:
93 </div>
93 </div>
94 <div class="right-content">
94 <div class="right-content">
95 <div>
95 <div>
96 <div class="code-header" >
96 <div class="code-header" >
97 <div class="compare_header">
97 <div class="compare_header">
98
98
99 <div class="compare-buttons">
99 <div class="compare-buttons">
100 % if c.compare_home:
100 % if c.compare_home:
101 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
101 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
102
102
103 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
103 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
104 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
104 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
105 <div id="changeset_compare_view_content">
105 <div id="changeset_compare_view_content">
106 <div class="help-block">${_('Compare commits, branches, bookmarks or tags.')}</div>
106 <div class="help-block">${_('Compare commits, branches, bookmarks or tags.')}</div>
107 </div>
107 </div>
108
108
109 % elif c.preview_mode:
109 % elif c.preview_mode:
110 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Compare Commits')}</a>
110 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Compare Commits')}</a>
111 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
111 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
112 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
112 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
113
113
114 % else:
114 % else:
115 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
115 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
116 <a id="btn-swap" class="btn btn-primary" href="${c.swap_url}">${_('Swap')}</a>
116 <a id="btn-swap" class="btn btn-primary" href="${c.swap_url}">${_('Swap')}</a>
117
117
118 ## allow comment only if there are commits to comment on
118 ## allow comment only if there are commits to comment on
119 % if c.diffset and c.diffset.files and c.commit_ranges:
119 % if c.diffset and c.diffset.files and c.commit_ranges:
120 <a id="compare_changeset_status_toggle" class="btn btn-primary">${_('Comment')}</a>
120 <a id="compare_changeset_status_toggle" class="btn btn-primary">${_('Comment')}</a>
121 % else:
121 % else:
122 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
122 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
123 % endif
123 % endif
124 % endif
124 % endif
125 </div>
125 </div>
126 </div>
126 </div>
127 </div>
127 </div>
128 </div>
128 </div>
129 </div>
129 </div>
130 </div>
130 </div>
131
131
132 <%doc>
132 <%doc>
133 ##TODO(marcink): implement this and diff menus
133 ##TODO(marcink): implement this and diff menus
134 <div class="fieldset">
134 <div class="fieldset">
135 <div class="left-label">
135 <div class="left-label">
136 ${_('Diff options')}:
136 ${_('Diff options')}:
137 </div>
137 </div>
138 <div class="right-content">
138 <div class="right-content">
139 <div class="diff-actions">
139 <div class="diff-actions">
140 <a href="${h.route_path('repo_commit_raw',repo_name=c.repo_name,commit_id='?')}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
140 <a href="${h.route_path('repo_commit_raw',repo_name=c.repo_name,commit_id='?')}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
141 ${_('Raw Diff')}
141 ${_('Raw Diff')}
142 </a>
142 </a>
143 |
143 |
144 <a href="${h.route_path('repo_commit_patch',repo_name=c.repo_name,commit_id='?')}" class="tooltip" title="${h.tooltip(_('Patch diff'))}">
144 <a href="${h.route_path('repo_commit_patch',repo_name=c.repo_name,commit_id='?')}" class="tooltip" title="${h.tooltip(_('Patch diff'))}">
145 ${_('Patch Diff')}
145 ${_('Patch Diff')}
146 </a>
146 </a>
147 |
147 |
148 <a href="${h.route_path('repo_commit_download',repo_name=c.repo_name,commit_id='?',_query=dict(diff='download'))}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
148 <a href="${h.route_path('repo_commit_download',repo_name=c.repo_name,commit_id='?',_query=dict(diff='download'))}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
149 ${_('Download Diff')}
149 ${_('Download Diff')}
150 </a>
150 </a>
151 </div>
151 </div>
152 </div>
152 </div>
153 </div>
153 </div>
154 </%doc>
154 </%doc>
155
155
156 ## commit status form
156 ## commit status form
157 <div class="fieldset" id="compare_changeset_status" style="display: none; margin-bottom: -80px;">
157 <div class="fieldset" id="compare_changeset_status" style="display: none; margin-bottom: -80px;">
158 <div class="left-label">
158 <div class="left-label">
159 ${_('Commit status')}:
159 ${_('Commit status')}:
160 </div>
160 </div>
161 <div class="right-content">
161 <div class="right-content">
162 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
162 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
163 ## main comment form and it status
163 ## main comment form and it status
164 <%
164 <%
165 def revs(_revs):
165 def revs(_revs):
166 form_inputs = []
166 form_inputs = []
167 for cs in _revs:
167 for cs in _revs:
168 tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id}
168 tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id}
169 form_inputs.append(tmpl)
169 form_inputs.append(tmpl)
170 return form_inputs
170 return form_inputs
171 %>
171 %>
172 <div>
172 <div>
173 ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))}
173 ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))}
174 </div>
174 </div>
175 </div>
175 </div>
176 </div>
176 </div>
177
177
178 </div> <!-- end summary-detail -->
178 </div> <!-- end summary-detail -->
179 </div> <!-- end summary -->
179 </div> <!-- end summary -->
180
180
181 ## use JS script to load it quickly before potentially large diffs render long time
181 ## use JS script to load it quickly before potentially large diffs render long time
182 ## this prevents from situation when large diffs block rendering of select2 fields
182 ## this prevents from situation when large diffs block rendering of select2 fields
183 <script type="text/javascript">
183 <script type="text/javascript">
184
184
185 var cache = {};
185 var cache = {};
186
186
187 var formatSelection = function(repoName){
187 var formatSelection = function(repoName){
188 return function(data, container, escapeMarkup) {
188 return function(data, container, escapeMarkup) {
189 var selection = data ? this.text(data) : "";
189 var selection = data ? this.text(data) : "";
190 return escapeMarkup('{0}@{1}'.format(repoName, selection));
190 return escapeMarkup('{0}@{1}'.format(repoName, selection));
191 }
191 }
192 };
192 };
193
193
194 var feedCompareData = function(query, cachedValue){
194 var feedCompareData = function(query, cachedValue){
195 var data = {results: []};
195 var data = {results: []};
196 //filter results
196 //filter results
197 $.each(cachedValue.results, function() {
197 $.each(cachedValue.results, function() {
198 var section = this.text;
198 var section = this.text;
199 var children = [];
199 var children = [];
200 $.each(this.children, function() {
200 $.each(this.children, function() {
201 if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
201 if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
202 children.push({
202 children.push({
203 'id': this.id,
203 'id': this.id,
204 'text': this.text,
204 'text': this.text,
205 'type': this.type
205 'type': this.type
206 })
206 })
207 }
207 }
208 });
208 });
209 data.results.push({
209 data.results.push({
210 'text': section,
210 'text': section,
211 'children': children
211 'children': children
212 })
212 })
213 });
213 });
214 //push the typed in changeset
214 //push the typed in changeset
215 data.results.push({
215 data.results.push({
216 'text': _gettext('specify commit'),
216 'text': _gettext('specify commit'),
217 'children': [{
217 'children': [{
218 'id': query.term,
218 'id': query.term,
219 'text': query.term,
219 'text': query.term,
220 'type': 'rev'
220 'type': 'rev'
221 }]
221 }]
222 });
222 });
223 query.callback(data);
223 query.callback(data);
224 };
224 };
225
225
226 var loadCompareData = function(repoName, query, cache){
226 var loadCompareData = function(repoName, query, cache){
227 $.ajax({
227 $.ajax({
228 url: pyroutes.url('repo_refs_data', {'repo_name': repoName}),
228 url: pyroutes.url('repo_refs_data', {'repo_name': repoName}),
229 data: {},
229 data: {},
230 dataType: 'json',
230 dataType: 'json',
231 type: 'GET',
231 type: 'GET',
232 success: function(data) {
232 success: function(data) {
233 cache[repoName] = data;
233 cache[repoName] = data;
234 query.callback({results: data.results});
234 query.callback({results: data.results});
235 }
235 }
236 })
236 })
237 };
237 };
238
238
239 var enable_fields = ${"false" if c.preview_mode else "true"};
239 var enable_fields = ${"false" if c.preview_mode else "true"};
240 $("#compare_source").select2({
240 $("#compare_source").select2({
241 placeholder: "${'%s@%s' % (c.source_repo.repo_name, c.source_ref)}",
241 placeholder: "${'%s@%s' % (c.source_repo.repo_name, c.source_ref)}",
242 containerCssClass: "drop-menu",
242 containerCssClass: "drop-menu",
243 dropdownCssClass: "drop-menu-dropdown",
243 dropdownCssClass: "drop-menu-dropdown",
244 formatSelection: formatSelection("${c.source_repo.repo_name}"),
244 formatSelection: formatSelection("${c.source_repo.repo_name}"),
245 dropdownAutoWidth: true,
245 dropdownAutoWidth: true,
246 query: function(query) {
246 query: function(query) {
247 var repoName = '${c.source_repo.repo_name}';
247 var repoName = '${c.source_repo.repo_name}';
248 var cachedValue = cache[repoName];
248 var cachedValue = cache[repoName];
249
249
250 if (cachedValue){
250 if (cachedValue){
251 feedCompareData(query, cachedValue);
251 feedCompareData(query, cachedValue);
252 }
252 }
253 else {
253 else {
254 loadCompareData(repoName, query, cache);
254 loadCompareData(repoName, query, cache);
255 }
255 }
256 }
256 }
257 }).select2("enable", enable_fields);
257 }).select2("enable", enable_fields);
258
258
259 $("#compare_target").select2({
259 $("#compare_target").select2({
260 placeholder: "${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}",
260 placeholder: "${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}",
261 dropdownAutoWidth: true,
261 dropdownAutoWidth: true,
262 containerCssClass: "drop-menu",
262 containerCssClass: "drop-menu",
263 dropdownCssClass: "drop-menu-dropdown",
263 dropdownCssClass: "drop-menu-dropdown",
264 formatSelection: formatSelection("${c.target_repo.repo_name}"),
264 formatSelection: formatSelection("${c.target_repo.repo_name}"),
265 query: function(query) {
265 query: function(query) {
266 var repoName = '${c.target_repo.repo_name}';
266 var repoName = '${c.target_repo.repo_name}';
267 var cachedValue = cache[repoName];
267 var cachedValue = cache[repoName];
268
268
269 if (cachedValue){
269 if (cachedValue){
270 feedCompareData(query, cachedValue);
270 feedCompareData(query, cachedValue);
271 }
271 }
272 else {
272 else {
273 loadCompareData(repoName, query, cache);
273 loadCompareData(repoName, query, cache);
274 }
274 }
275 }
275 }
276 }).select2("enable", enable_fields);
276 }).select2("enable", enable_fields);
277 var initial_compare_source = {id: "${c.source_ref}", type:"${c.source_ref_type}"};
277 var initial_compare_source = {id: "${c.source_ref}", type:"${c.source_ref_type}"};
278 var initial_compare_target = {id: "${c.target_ref}", type:"${c.target_ref_type}"};
278 var initial_compare_target = {id: "${c.target_ref}", type:"${c.target_ref_type}"};
279
279
280 $('#compare_revs').on('click', function(e) {
280 $('#compare_revs').on('click', function(e) {
281 var source = $('#compare_source').select2('data') || initial_compare_source;
281 var source = $('#compare_source').select2('data') || initial_compare_source;
282 var target = $('#compare_target').select2('data') || initial_compare_target;
282 var target = $('#compare_target').select2('data') || initial_compare_target;
283 if (source && target) {
283 if (source && target) {
284 var url_data = {
284 var url_data = {
285 repo_name: "${c.repo_name}",
285 repo_name: "${c.repo_name}",
286 source_ref: source.id,
286 source_ref: source.id,
287 source_ref_type: source.type,
287 source_ref_type: source.type,
288 target_ref: target.id,
288 target_ref: target.id,
289 target_ref_type: target.type
289 target_ref_type: target.type
290 };
290 };
291 window.location = pyroutes.url('repo_compare', url_data);
291 window.location = pyroutes.url('repo_compare', url_data);
292 }
292 }
293 });
293 });
294 $('#compare_changeset_status_toggle').on('click', function(e) {
294 $('#compare_changeset_status_toggle').on('click', function(e) {
295 $('#compare_changeset_status').toggle();
295 $('#compare_changeset_status').toggle();
296 });
296 });
297
297
298 </script>
298 </script>
299
299
300 ## table diff data
300 ## table diff data
301 <div class="table">
301 <div class="table">
302
302
303
303
304 % if not c.compare_home:
304 % if not c.compare_home:
305 <div id="changeset_compare_view_content">
305 <div id="changeset_compare_view_content">
306 <div class="pull-left">
306 <div class="pull-left">
307 <div class="btn-group">
307 <div class="btn-group">
308 <a
308 <a
309 class="btn"
309 class="btn"
310 href="#"
310 href="#"
311 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
311 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
312 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
312 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
313 </a>
313 </a>
314 <a
314 <a
315 class="btn"
315 class="btn"
316 href="#"
316 href="#"
317 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
317 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
318 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
318 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
319 </a>
319 </a>
320 </div>
320 </div>
321 </div>
321 </div>
322 <div style="padding:0 10px 10px 0px" class="pull-left"></div>
322 <div style="padding:0 10px 10px 0px" class="pull-left"></div>
323 ## commit compare generated below
323 ## commit compare generated below
324 <%include file="compare_commits.mako"/>
324 <%include file="compare_commits.mako"/>
325 ${cbdiffs.render_diffset_menu(c.diffset)}
325 ${cbdiffs.render_diffset_menu(c.diffset)}
326 ${cbdiffs.render_diffset(c.diffset)}
326 ${cbdiffs.render_diffset(c.diffset)}
327 </div>
327 </div>
328 % endif
328 % endif
329
329
330 </div>
330 </div>
331 </div>
331 </div>
332
332
333 </%def>
333 </%def>
@@ -1,49 +1,49 b''
1
1
2 <div id="codeblock" class="browserblock">
2 <div id="codeblock" class="browserblock">
3 <div class="browser-header">
3 <div class="browser-header">
4 <div class="browser-nav">
4 <div class="browser-nav">
5 ${h.form(h.current_route_path(request), method='GET', id='at_rev_form')}
5 ${h.form(h.current_route_path(request), method='GET', id='at_rev_form')}
6 <div class="info_box">
6 <div class="info_box">
7 ${h.hidden('refs_filter')}
7 ${h.hidden('refs_filter')}
8 <div class="info_box_elem previous">
8 <div class="info_box_elem previous">
9 <a id="prev_commit_link" data-commit-id="${c.prev_commit.raw_id}" class="pjax-link ${'disabled' if c.url_prev == '#' else ''}" href="${c.url_prev}" title="${_('Previous commit')}"><i class="icon-left"></i></a>
9 <a id="prev_commit_link" data-commit-id="${c.prev_commit.raw_id}" class="pjax-link ${'disabled' if c.url_prev == '#' else ''}" href="${c.url_prev}" title="${_('Previous commit')}"><i class="icon-left"></i></a>
10 </div>
10 </div>
11 <div class="info_box_elem">${h.text('at_rev',value=c.commit.revision)}</div>
11 <div class="info_box_elem">${h.text('at_rev',value=c.commit.idx)}</div>
12 <div class="info_box_elem next">
12 <div class="info_box_elem next">
13 <a id="next_commit_link" data-commit-id="${c.next_commit.raw_id}" class="pjax-link ${'disabled' if c.url_next == '#' else ''}" href="${c.url_next}" title="${_('Next commit')}"><i class="icon-right"></i></a>
13 <a id="next_commit_link" data-commit-id="${c.next_commit.raw_id}" class="pjax-link ${'disabled' if c.url_next == '#' else ''}" href="${c.url_next}" title="${_('Next commit')}"><i class="icon-right"></i></a>
14 </div>
14 </div>
15 </div>
15 </div>
16 ${h.end_form()}
16 ${h.end_form()}
17
17
18 <div id="search_activate_id" class="search_activate">
18 <div id="search_activate_id" class="search_activate">
19 <a class="btn btn-default" id="filter_activate" href="javascript:void(0)">${_('Search File List')}</a>
19 <a class="btn btn-default" id="filter_activate" href="javascript:void(0)">${_('Search File List')}</a>
20 </div>
20 </div>
21 <div id="search_deactivate_id" class="search_activate hidden">
21 <div id="search_deactivate_id" class="search_activate hidden">
22 <a class="btn btn-default" id="filter_deactivate" href="javascript:void(0)">${_('Close File List')}</a>
22 <a class="btn btn-default" id="filter_deactivate" href="javascript:void(0)">${_('Close File List')}</a>
23 </div>
23 </div>
24 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
24 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
25 <div title="${_('Add New File')}" class="btn btn-primary new-file">
25 <div title="${_('Add New File')}" class="btn btn-primary new-file">
26 <a href="${h.route_path('repo_files_add_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _anchor='edit')}">
26 <a href="${h.route_path('repo_files_add_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _anchor='edit')}">
27 ${_('Add File')}</a>
27 ${_('Add File')}</a>
28 </div>
28 </div>
29 % endif
29 % endif
30 </div>
30 </div>
31
31
32 <div class="browser-search">
32 <div class="browser-search">
33 <div class="node-filter">
33 <div class="node-filter">
34 <div class="node_filter_box hidden" id="node_filter_box_loading" >${_('Loading file list...')}</div>
34 <div class="node_filter_box hidden" id="node_filter_box_loading" >${_('Loading file list...')}</div>
35 <div class="node_filter_box hidden" id="node_filter_box" >
35 <div class="node_filter_box hidden" id="node_filter_box" >
36 <div class="node-filter-path">${h.get_last_path_part(c.file)}/</div>
36 <div class="node-filter-path">${h.get_last_path_part(c.file)}/</div>
37 <div class="node-filter-input">
37 <div class="node-filter-input">
38 <input class="init" type="text" name="filter" size="25" id="node_filter" autocomplete="off">
38 <input class="init" type="text" name="filter" size="25" id="node_filter" autocomplete="off">
39 </div>
39 </div>
40 </div>
40 </div>
41 </div>
41 </div>
42 </div>
42 </div>
43 </div>
43 </div>
44 ## file tree is computed from caches, and filled in
44 ## file tree is computed from caches, and filled in
45 <div id="file-tree">
45 <div id="file-tree">
46 ${c.file_tree |n}
46 ${c.file_tree |n}
47 </div>
47 </div>
48
48
49 </div>
49 </div>
@@ -1,82 +1,82 b''
1 <div id="file-tree-wrapper" class="browser-body ${'full-load' if c.full_load else ''}">
1 <div id="file-tree-wrapper" class="browser-body ${'full-load' if c.full_load else ''}">
2 <table class="code-browser rctable">
2 <table class="code-browser rctable">
3 <thead>
3 <thead>
4 <tr>
4 <tr>
5 <th>${_('Name')}</th>
5 <th>${_('Name')}</th>
6 <th>${_('Size')}</th>
6 <th>${_('Size')}</th>
7 <th>${_('Modified')}</th>
7 <th>${_('Modified')}</th>
8 <th>${_('Last Commit')}</th>
8 <th>${_('Last Commit')}</th>
9 <th>${_('Author')}</th>
9 <th>${_('Author')}</th>
10 </tr>
10 </tr>
11 </thead>
11 </thead>
12
12
13 <tbody id="tbody">
13 <tbody id="tbody">
14 %if c.file.parent:
14 %if c.file.parent:
15 <tr class="parity0">
15 <tr class="parity0">
16 <td class="td-componentname">
16 <td class="td-componentname">
17 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.file.parent.path)}" class="pjax-link">
17 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.file.parent.path)}" class="pjax-link">
18 <i class="icon-directory"></i>..
18 <i class="icon-directory"></i>..
19 </a>
19 </a>
20 </td>
20 </td>
21 <td></td>
21 <td></td>
22 <td></td>
22 <td></td>
23 <td></td>
23 <td></td>
24 <td></td>
24 <td></td>
25 </tr>
25 </tr>
26 %endif
26 %endif
27 %for cnt,node in enumerate(c.file):
27 %for cnt,node in enumerate(c.file):
28 <tr class="parity${cnt%2}">
28 <tr class="parity${cnt%2}">
29 <td class="td-componentname">
29 <td class="td-componentname">
30 % if node.is_submodule():
30 % if node.is_submodule():
31 <span class="submodule-dir">
31 <span class="submodule-dir">
32 % if node.url.startswith('http://') or node.url.startswith('https://'):
32 % if node.url.startswith('http://') or node.url.startswith('https://'):
33 <a href="${node.url}">
33 <a href="${node.url}">
34 <i class="icon-directory browser-dir"></i>${node.name}
34 <i class="icon-directory browser-dir"></i>${node.name}
35 </a>
35 </a>
36 % else:
36 % else:
37 <i class="icon-directory browser-dir"></i>${node.name}
37 <i class="icon-directory browser-dir"></i>${node.name}
38 % endif
38 % endif
39 </span>
39 </span>
40 % else:
40 % else:
41 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=h.safe_unicode(node.path))}" class="pjax-link">
41 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=h.safe_unicode(node.path))}" class="pjax-link">
42 <i class="${'icon-file-text browser-file' if node.is_file() else 'icon-directory browser-dir'}"></i>${node.name}
42 <i class="${'icon-file-text browser-file' if node.is_file() else 'icon-directory browser-dir'}"></i>${node.name}
43 </a>
43 </a>
44 % endif
44 % endif
45 </td>
45 </td>
46 %if node.is_file():
46 %if node.is_file():
47 <td class="td-size" data-attr-name="size">
47 <td class="td-size" data-attr-name="size">
48 % if c.full_load:
48 % if c.full_load:
49 <span data-size="${node.size}">${h.format_byte_size_binary(node.size)}</span>
49 <span data-size="${node.size}">${h.format_byte_size_binary(node.size)}</span>
50 % else:
50 % else:
51 ${_('Loading ...')}
51 ${_('Loading ...')}
52 % endif
52 % endif
53 </td>
53 </td>
54 <td class="td-time" data-attr-name="modified_at">
54 <td class="td-time" data-attr-name="modified_at">
55 % if c.full_load:
55 % if c.full_load:
56 <span data-date="${node.last_commit.date}">${h.age_component(node.last_commit.date)}</span>
56 <span data-date="${node.last_commit.date}">${h.age_component(node.last_commit.date)}</span>
57 % endif
57 % endif
58 </td>
58 </td>
59 <td class="td-hash" data-attr-name="commit_id">
59 <td class="td-hash" data-attr-name="commit_id">
60 % if c.full_load:
60 % if c.full_load:
61 <div class="tooltip" title="${h.tooltip(node.last_commit.message)}">
61 <div class="tooltip" title="${h.tooltip(node.last_commit.message)}">
62 <pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit.revision}:${node.last_commit.short_id}</pre>
62 <pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit.idx}:${node.last_commit.short_id}</pre>
63 </div>
63 </div>
64 % endif
64 % endif
65 </td>
65 </td>
66 <td class="td-user" data-attr-name="author">
66 <td class="td-user" data-attr-name="author">
67 % if c.full_load:
67 % if c.full_load:
68 <span data-author="${node.last_commit.author}" title="${h.tooltip(node.last_commit.author)}">${h.gravatar_with_user(request, node.last_commit.author)|n}</span>
68 <span data-author="${node.last_commit.author}" title="${h.tooltip(node.last_commit.author)}">${h.gravatar_with_user(request, node.last_commit.author)|n}</span>
69 % endif
69 % endif
70 </td>
70 </td>
71 %else:
71 %else:
72 <td></td>
72 <td></td>
73 <td></td>
73 <td></td>
74 <td></td>
74 <td></td>
75 <td></td>
75 <td></td>
76 %endif
76 %endif
77 </tr>
77 </tr>
78 %endfor
78 %endfor
79 </tbody>
79 </tbody>
80 <tbody id="tbody_filtered"></tbody>
80 <tbody id="tbody_filtered"></tbody>
81 </table>
81 </table>
82 </div>
82 </div>
@@ -1,859 +1,859 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
3 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
3 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
4
4
5 <%def name="title()">
5 <%def name="title()">
6 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
6 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
7 %if c.rhodecode_name:
7 %if c.rhodecode_name:
8 &middot; ${h.branding(c.rhodecode_name)}
8 &middot; ${h.branding(c.rhodecode_name)}
9 %endif
9 %endif
10 </%def>
10 </%def>
11
11
12 <%def name="breadcrumbs_links()">
12 <%def name="breadcrumbs_links()">
13 <span id="pr-title">
13 <span id="pr-title">
14 ${c.pull_request.title}
14 ${c.pull_request.title}
15 %if c.pull_request.is_closed():
15 %if c.pull_request.is_closed():
16 (${_('Closed')})
16 (${_('Closed')})
17 %endif
17 %endif
18 </span>
18 </span>
19 <div id="pr-title-edit" class="input" style="display: none;">
19 <div id="pr-title-edit" class="input" style="display: none;">
20 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
20 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
21 </div>
21 </div>
22 </%def>
22 </%def>
23
23
24 <%def name="menu_bar_nav()">
24 <%def name="menu_bar_nav()">
25 ${self.menu_items(active='repositories')}
25 ${self.menu_items(active='repositories')}
26 </%def>
26 </%def>
27
27
28 <%def name="menu_bar_subnav()">
28 <%def name="menu_bar_subnav()">
29 ${self.repo_menu(active='showpullrequest')}
29 ${self.repo_menu(active='showpullrequest')}
30 </%def>
30 </%def>
31
31
32 <%def name="main()">
32 <%def name="main()">
33
33
34 <script type="text/javascript">
34 <script type="text/javascript">
35 // TODO: marcink switch this to pyroutes
35 // TODO: marcink switch this to pyroutes
36 AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}";
36 AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}";
37 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
37 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
38 </script>
38 </script>
39 <div class="box">
39 <div class="box">
40
40
41 <div class="title">
41 <div class="title">
42 ${self.repo_page_title(c.rhodecode_db_repo)}
42 ${self.repo_page_title(c.rhodecode_db_repo)}
43 </div>
43 </div>
44
44
45 ${self.breadcrumbs()}
45 ${self.breadcrumbs()}
46
46
47 <div class="box pr-summary">
47 <div class="box pr-summary">
48
48
49 <div class="summary-details block-left">
49 <div class="summary-details block-left">
50 <% summary = lambda n:{False:'summary-short'}.get(n) %>
50 <% summary = lambda n:{False:'summary-short'}.get(n) %>
51 <div class="pr-details-title">
51 <div class="pr-details-title">
52 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)}
52 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)}
53 %if c.allowed_to_update:
53 %if c.allowed_to_update:
54 <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0">
54 <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0">
55 % if c.allowed_to_delete:
55 % if c.allowed_to_delete:
56 ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)}
56 ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)}
57 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'),
57 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'),
58 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
58 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
59 ${h.end_form()}
59 ${h.end_form()}
60 % else:
60 % else:
61 ${_('Delete')}
61 ${_('Delete')}
62 % endif
62 % endif
63 </div>
63 </div>
64 <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div>
64 <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div>
65 <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div>
65 <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div>
66 %endif
66 %endif
67 </div>
67 </div>
68
68
69 <div id="summary" class="fields pr-details-content">
69 <div id="summary" class="fields pr-details-content">
70 <div class="field">
70 <div class="field">
71 <div class="label-summary">
71 <div class="label-summary">
72 <label>${_('Source')}:</label>
72 <label>${_('Source')}:</label>
73 </div>
73 </div>
74 <div class="input">
74 <div class="input">
75 <div class="pr-origininfo">
75 <div class="pr-origininfo">
76 ## branch link is only valid if it is a branch
76 ## branch link is only valid if it is a branch
77 <span class="tag">
77 <span class="tag">
78 %if c.pull_request.source_ref_parts.type == 'branch':
78 %if c.pull_request.source_ref_parts.type == 'branch':
79 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
79 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
80 %else:
80 %else:
81 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
81 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
82 %endif
82 %endif
83 </span>
83 </span>
84 <span class="clone-url">
84 <span class="clone-url">
85 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
85 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
86 </span>
86 </span>
87 <br/>
87 <br/>
88 % if c.ancestor_commit:
88 % if c.ancestor_commit:
89 ${_('Common ancestor')}:
89 ${_('Common ancestor')}:
90 <code><a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a></code>
90 <code><a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a></code>
91 % endif
91 % endif
92 </div>
92 </div>
93 %if h.is_hg(c.pull_request.source_repo):
93 %if h.is_hg(c.pull_request.source_repo):
94 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
94 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
95 %elif h.is_git(c.pull_request.source_repo):
95 %elif h.is_git(c.pull_request.source_repo):
96 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
96 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
97 %endif
97 %endif
98
98
99 <div class="">
99 <div class="">
100 <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
100 <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
101 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
101 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
102 </div>
102 </div>
103
103
104 </div>
104 </div>
105 </div>
105 </div>
106 <div class="field">
106 <div class="field">
107 <div class="label-summary">
107 <div class="label-summary">
108 <label>${_('Target')}:</label>
108 <label>${_('Target')}:</label>
109 </div>
109 </div>
110 <div class="input">
110 <div class="input">
111 <div class="pr-targetinfo">
111 <div class="pr-targetinfo">
112 ## branch link is only valid if it is a branch
112 ## branch link is only valid if it is a branch
113 <span class="tag">
113 <span class="tag">
114 %if c.pull_request.target_ref_parts.type == 'branch':
114 %if c.pull_request.target_ref_parts.type == 'branch':
115 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
115 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
116 %else:
116 %else:
117 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
117 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
118 %endif
118 %endif
119 </span>
119 </span>
120 <span class="clone-url">
120 <span class="clone-url">
121 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
121 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
122 </span>
122 </span>
123 </div>
123 </div>
124 </div>
124 </div>
125 </div>
125 </div>
126
126
127 ## Link to the shadow repository.
127 ## Link to the shadow repository.
128 <div class="field">
128 <div class="field">
129 <div class="label-summary">
129 <div class="label-summary">
130 <label>${_('Merge')}:</label>
130 <label>${_('Merge')}:</label>
131 </div>
131 </div>
132 <div class="input">
132 <div class="input">
133 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
133 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
134 %if h.is_hg(c.pull_request.target_repo):
134 %if h.is_hg(c.pull_request.target_repo):
135 <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
135 <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
136 %elif h.is_git(c.pull_request.target_repo):
136 %elif h.is_git(c.pull_request.target_repo):
137 <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
137 <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
138 %endif
138 %endif
139 <div class="">
139 <div class="">
140 <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
140 <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
141 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
141 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
142 </div>
142 </div>
143 % else:
143 % else:
144 <div class="">
144 <div class="">
145 ${_('Shadow repository data not available')}.
145 ${_('Shadow repository data not available')}.
146 </div>
146 </div>
147 % endif
147 % endif
148 </div>
148 </div>
149 </div>
149 </div>
150
150
151 <div class="field">
151 <div class="field">
152 <div class="label-summary">
152 <div class="label-summary">
153 <label>${_('Review')}:</label>
153 <label>${_('Review')}:</label>
154 </div>
154 </div>
155 <div class="input">
155 <div class="input">
156 %if c.pull_request_review_status:
156 %if c.pull_request_review_status:
157 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
157 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
158 <span class="changeset-status-lbl tooltip">
158 <span class="changeset-status-lbl tooltip">
159 %if c.pull_request.is_closed():
159 %if c.pull_request.is_closed():
160 ${_('Closed')},
160 ${_('Closed')},
161 %endif
161 %endif
162 ${h.commit_status_lbl(c.pull_request_review_status)}
162 ${h.commit_status_lbl(c.pull_request_review_status)}
163 </span>
163 </span>
164 - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
164 - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
165 %endif
165 %endif
166 </div>
166 </div>
167 </div>
167 </div>
168 <div class="field">
168 <div class="field">
169 <div class="pr-description-label label-summary" title="${_('Rendered using {} renderer').format(c.renderer)}">
169 <div class="pr-description-label label-summary" title="${_('Rendered using {} renderer').format(c.renderer)}">
170 <label>${_('Description')}:</label>
170 <label>${_('Description')}:</label>
171 </div>
171 </div>
172 <div id="pr-desc" class="input">
172 <div id="pr-desc" class="input">
173 <div class="pr-description">${h.render(c.pull_request.description, renderer=c.renderer)}</div>
173 <div class="pr-description">${h.render(c.pull_request.description, renderer=c.renderer)}</div>
174 </div>
174 </div>
175 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
175 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
176 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
176 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
177 ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)}
177 ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)}
178 </div>
178 </div>
179 </div>
179 </div>
180
180
181 <div class="field">
181 <div class="field">
182 <div class="label-summary">
182 <div class="label-summary">
183 <label>${_('Versions')}:</label>
183 <label>${_('Versions')}:</label>
184 </div>
184 </div>
185
185
186 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
186 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
187 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
187 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
188
188
189 <div class="pr-versions">
189 <div class="pr-versions">
190 % if c.show_version_changes:
190 % if c.show_version_changes:
191 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
191 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
192 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
192 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
193 <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
193 <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
194 data-toggle-on="${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}"
194 data-toggle-on="${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}"
195 data-toggle-off="${_('Hide all versions of this pull request')}">
195 data-toggle-off="${_('Hide all versions of this pull request')}">
196 ${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}
196 ${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}
197 </a>
197 </a>
198 <table>
198 <table>
199 ## SHOW ALL VERSIONS OF PR
199 ## SHOW ALL VERSIONS OF PR
200 <% ver_pr = None %>
200 <% ver_pr = None %>
201
201
202 % for data in reversed(list(enumerate(c.versions, 1))):
202 % for data in reversed(list(enumerate(c.versions, 1))):
203 <% ver_pos = data[0] %>
203 <% ver_pos = data[0] %>
204 <% ver = data[1] %>
204 <% ver = data[1] %>
205 <% ver_pr = ver.pull_request_version_id %>
205 <% ver_pr = ver.pull_request_version_id %>
206 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
206 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
207
207
208 <tr class="version-pr" style="display: ${display_row}">
208 <tr class="version-pr" style="display: ${display_row}">
209 <td>
209 <td>
210 <code>
210 <code>
211 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
211 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
212 </code>
212 </code>
213 </td>
213 </td>
214 <td>
214 <td>
215 <input ${'checked="checked"' if c.from_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
215 <input ${'checked="checked"' if c.from_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
216 <input ${'checked="checked"' if c.at_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
216 <input ${'checked="checked"' if c.at_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
217 </td>
217 </td>
218 <td>
218 <td>
219 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
219 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
220 <div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}">
220 <div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}">
221 </div>
221 </div>
222 </td>
222 </td>
223 <td>
223 <td>
224 % if c.at_version_num != ver_pr:
224 % if c.at_version_num != ver_pr:
225 <i class="icon-comment"></i>
225 <i class="icon-comment"></i>
226 <code class="tooltip" title="${_('Comment from pull request version v{0}, general:{1} inline:{2}').format(ver_pos, len(c.comment_versions[ver_pr]['at']), len(c.inline_versions[ver_pr]['at']))}">
226 <code class="tooltip" title="${_('Comment from pull request version v{0}, general:{1} inline:{2}').format(ver_pos, len(c.comment_versions[ver_pr]['at']), len(c.inline_versions[ver_pr]['at']))}">
227 G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])}
227 G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])}
228 </code>
228 </code>
229 % endif
229 % endif
230 </td>
230 </td>
231 <td>
231 <td>
232 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
232 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
233 </td>
233 </td>
234 <td>
234 <td>
235 ${h.age_component(ver.updated_on, time_is_local=True)}
235 ${h.age_component(ver.updated_on, time_is_local=True)}
236 </td>
236 </td>
237 </tr>
237 </tr>
238 % endfor
238 % endfor
239
239
240 <tr>
240 <tr>
241 <td colspan="6">
241 <td colspan="6">
242 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
242 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
243 data-label-text-locked="${_('select versions to show changes')}"
243 data-label-text-locked="${_('select versions to show changes')}"
244 data-label-text-diff="${_('show changes between versions')}"
244 data-label-text-diff="${_('show changes between versions')}"
245 data-label-text-show="${_('show pull request for this version')}"
245 data-label-text-show="${_('show pull request for this version')}"
246 >
246 >
247 ${_('select versions to show changes')}
247 ${_('select versions to show changes')}
248 </button>
248 </button>
249 </td>
249 </td>
250 </tr>
250 </tr>
251
251
252 ## show comment/inline comments summary
252 ## show comment/inline comments summary
253 <%def name="comments_summary()">
253 <%def name="comments_summary()">
254 <tr>
254 <tr>
255 <td colspan="6" class="comments-summary-td">
255 <td colspan="6" class="comments-summary-td">
256
256
257 % if c.at_version:
257 % if c.at_version:
258 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %>
258 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %>
259 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %>
259 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %>
260 ${_('Comments at this version')}:
260 ${_('Comments at this version')}:
261 % else:
261 % else:
262 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %>
262 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %>
263 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %>
263 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %>
264 ${_('Comments for this pull request')}:
264 ${_('Comments for this pull request')}:
265 % endif
265 % endif
266
266
267
267
268 %if general_comm_count_ver:
268 %if general_comm_count_ver:
269 <a href="#comments">${_("%d General ") % general_comm_count_ver}</a>
269 <a href="#comments">${_("%d General ") % general_comm_count_ver}</a>
270 %else:
270 %else:
271 ${_("%d General ") % general_comm_count_ver}
271 ${_("%d General ") % general_comm_count_ver}
272 %endif
272 %endif
273
273
274 %if inline_comm_count_ver:
274 %if inline_comm_count_ver:
275 , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a>
275 , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a>
276 %else:
276 %else:
277 , ${_("%d Inline") % inline_comm_count_ver}
277 , ${_("%d Inline") % inline_comm_count_ver}
278 %endif
278 %endif
279
279
280 %if outdated_comm_count_ver:
280 %if outdated_comm_count_ver:
281 , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a>
281 , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a>
282 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a>
282 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a>
283 <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a>
283 <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a>
284 %else:
284 %else:
285 , ${_("%d Outdated") % outdated_comm_count_ver}
285 , ${_("%d Outdated") % outdated_comm_count_ver}
286 %endif
286 %endif
287 </td>
287 </td>
288 </tr>
288 </tr>
289 </%def>
289 </%def>
290 ${comments_summary()}
290 ${comments_summary()}
291 </table>
291 </table>
292 % else:
292 % else:
293 <div class="input">
293 <div class="input">
294 ${_('Pull request versions not available')}.
294 ${_('Pull request versions not available')}.
295 </div>
295 </div>
296 <div>
296 <div>
297 <table>
297 <table>
298 ${comments_summary()}
298 ${comments_summary()}
299 </table>
299 </table>
300 </div>
300 </div>
301 % endif
301 % endif
302 </div>
302 </div>
303 </div>
303 </div>
304
304
305 <div id="pr-save" class="field" style="display: none;">
305 <div id="pr-save" class="field" style="display: none;">
306 <div class="label-summary"></div>
306 <div class="label-summary"></div>
307 <div class="input">
307 <div class="input">
308 <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span>
308 <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span>
309 </div>
309 </div>
310 </div>
310 </div>
311 </div>
311 </div>
312 </div>
312 </div>
313 <div>
313 <div>
314 ## AUTHOR
314 ## AUTHOR
315 <div class="reviewers-title block-right">
315 <div class="reviewers-title block-right">
316 <div class="pr-details-title">
316 <div class="pr-details-title">
317 ${_('Author of this pull request')}
317 ${_('Author of this pull request')}
318 </div>
318 </div>
319 </div>
319 </div>
320 <div class="block-right pr-details-content reviewers">
320 <div class="block-right pr-details-content reviewers">
321 <ul class="group_members">
321 <ul class="group_members">
322 <li>
322 <li>
323 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
323 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
324 </li>
324 </li>
325 </ul>
325 </ul>
326 </div>
326 </div>
327
327
328 ## REVIEW RULES
328 ## REVIEW RULES
329 <div id="review_rules" style="display: none" class="reviewers-title block-right">
329 <div id="review_rules" style="display: none" class="reviewers-title block-right">
330 <div class="pr-details-title">
330 <div class="pr-details-title">
331 ${_('Reviewer rules')}
331 ${_('Reviewer rules')}
332 %if c.allowed_to_update:
332 %if c.allowed_to_update:
333 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
333 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
334 %endif
334 %endif
335 </div>
335 </div>
336 <div class="pr-reviewer-rules">
336 <div class="pr-reviewer-rules">
337 ## review rules will be appended here, by default reviewers logic
337 ## review rules will be appended here, by default reviewers logic
338 </div>
338 </div>
339 <input id="review_data" type="hidden" name="review_data" value="">
339 <input id="review_data" type="hidden" name="review_data" value="">
340 </div>
340 </div>
341
341
342 ## REVIEWERS
342 ## REVIEWERS
343 <div class="reviewers-title block-right">
343 <div class="reviewers-title block-right">
344 <div class="pr-details-title">
344 <div class="pr-details-title">
345 ${_('Pull request reviewers')}
345 ${_('Pull request reviewers')}
346 %if c.allowed_to_update:
346 %if c.allowed_to_update:
347 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
347 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
348 %endif
348 %endif
349 </div>
349 </div>
350 </div>
350 </div>
351 <div id="reviewers" class="block-right pr-details-content reviewers">
351 <div id="reviewers" class="block-right pr-details-content reviewers">
352
352
353 ## members redering block
353 ## members redering block
354 <input type="hidden" name="__start__" value="review_members:sequence">
354 <input type="hidden" name="__start__" value="review_members:sequence">
355 <ul id="review_members" class="group_members">
355 <ul id="review_members" class="group_members">
356
356
357 % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers:
357 % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers:
358 <script>
358 <script>
359 var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n};
359 var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n};
360 var status = "${(status[0][1].status if status else 'not_reviewed')}";
360 var status = "${(status[0][1].status if status else 'not_reviewed')}";
361 var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}";
361 var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}";
362 var allowed_to_update = ${h.json.dumps(c.allowed_to_update)};
362 var allowed_to_update = ${h.json.dumps(c.allowed_to_update)};
363
363
364 var entry = renderTemplate('reviewMemberEntry', {
364 var entry = renderTemplate('reviewMemberEntry', {
365 'member': member,
365 'member': member,
366 'mandatory': member.mandatory,
366 'mandatory': member.mandatory,
367 'reasons': member.reasons,
367 'reasons': member.reasons,
368 'allowed_to_update': allowed_to_update,
368 'allowed_to_update': allowed_to_update,
369 'review_status': status,
369 'review_status': status,
370 'review_status_label': status_lbl,
370 'review_status_label': status_lbl,
371 'user_group': member.user_group,
371 'user_group': member.user_group,
372 'create': false
372 'create': false
373 });
373 });
374 $('#review_members').append(entry)
374 $('#review_members').append(entry)
375 </script>
375 </script>
376
376
377 % endfor
377 % endfor
378
378
379 </ul>
379 </ul>
380 <input type="hidden" name="__end__" value="review_members:sequence">
380 <input type="hidden" name="__end__" value="review_members:sequence">
381 ## end members redering block
381 ## end members redering block
382
382
383 %if not c.pull_request.is_closed():
383 %if not c.pull_request.is_closed():
384 <div id="add_reviewer" class="ac" style="display: none;">
384 <div id="add_reviewer" class="ac" style="display: none;">
385 %if c.allowed_to_update:
385 %if c.allowed_to_update:
386 % if not c.forbid_adding_reviewers:
386 % if not c.forbid_adding_reviewers:
387 <div id="add_reviewer_input" class="reviewer_ac">
387 <div id="add_reviewer_input" class="reviewer_ac">
388 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
388 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
389 <div id="reviewers_container"></div>
389 <div id="reviewers_container"></div>
390 </div>
390 </div>
391 % endif
391 % endif
392 <div class="pull-right">
392 <div class="pull-right">
393 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
393 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
394 </div>
394 </div>
395 %endif
395 %endif
396 </div>
396 </div>
397 %endif
397 %endif
398 </div>
398 </div>
399 </div>
399 </div>
400 </div>
400 </div>
401 <div class="box">
401 <div class="box">
402 ##DIFF
402 ##DIFF
403 <div class="table" >
403 <div class="table" >
404 <div id="changeset_compare_view_content">
404 <div id="changeset_compare_view_content">
405 ##CS
405 ##CS
406 % if c.missing_requirements:
406 % if c.missing_requirements:
407 <div class="box">
407 <div class="box">
408 <div class="alert alert-warning">
408 <div class="alert alert-warning">
409 <div>
409 <div>
410 <strong>${_('Missing requirements:')}</strong>
410 <strong>${_('Missing requirements:')}</strong>
411 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
411 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
412 </div>
412 </div>
413 </div>
413 </div>
414 </div>
414 </div>
415 % elif c.missing_commits:
415 % elif c.missing_commits:
416 <div class="box">
416 <div class="box">
417 <div class="alert alert-warning">
417 <div class="alert alert-warning">
418 <div>
418 <div>
419 <strong>${_('Missing commits')}:</strong>
419 <strong>${_('Missing commits')}:</strong>
420 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
420 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
421 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
421 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
422 ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n}
422 ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n}
423 </div>
423 </div>
424 </div>
424 </div>
425 </div>
425 </div>
426 % endif
426 % endif
427
427
428 <div class="compare_view_commits_title">
428 <div class="compare_view_commits_title">
429 % if not c.compare_mode:
429 % if not c.compare_mode:
430
430
431 % if c.at_version_pos:
431 % if c.at_version_pos:
432 <h4>
432 <h4>
433 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
433 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
434 </h4>
434 </h4>
435 % endif
435 % endif
436
436
437 <div class="pull-left">
437 <div class="pull-left">
438 <div class="btn-group">
438 <div class="btn-group">
439 <a
439 <a
440 class="btn"
440 class="btn"
441 href="#"
441 href="#"
442 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
442 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
443 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
443 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
444 </a>
444 </a>
445 <a
445 <a
446 class="btn"
446 class="btn"
447 href="#"
447 href="#"
448 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
448 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
449 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
449 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
450 </a>
450 </a>
451 </div>
451 </div>
452 </div>
452 </div>
453
453
454 <div class="pull-right">
454 <div class="pull-right">
455 % if c.allowed_to_update and not c.pull_request.is_closed():
455 % if c.allowed_to_update and not c.pull_request.is_closed():
456 <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a>
456 <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a>
457 % else:
457 % else:
458 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
458 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
459 % endif
459 % endif
460
460
461 </div>
461 </div>
462 % endif
462 % endif
463 </div>
463 </div>
464
464
465 % if not c.missing_commits:
465 % if not c.missing_commits:
466 % if c.compare_mode:
466 % if c.compare_mode:
467 % if c.at_version:
467 % if c.at_version:
468 <h4>
468 <h4>
469 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}:
469 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}:
470 </h4>
470 </h4>
471
471
472 <div class="subtitle-compare">
472 <div class="subtitle-compare">
473 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
473 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
474 </div>
474 </div>
475
475
476 <div class="container">
476 <div class="container">
477 <table class="rctable compare_view_commits">
477 <table class="rctable compare_view_commits">
478 <tr>
478 <tr>
479 <th></th>
479 <th></th>
480 <th>${_('Time')}</th>
480 <th>${_('Time')}</th>
481 <th>${_('Author')}</th>
481 <th>${_('Author')}</th>
482 <th>${_('Commit')}</th>
482 <th>${_('Commit')}</th>
483 <th></th>
483 <th></th>
484 <th>${_('Description')}</th>
484 <th>${_('Description')}</th>
485 </tr>
485 </tr>
486
486
487 % for c_type, commit in c.commit_changes:
487 % for c_type, commit in c.commit_changes:
488 % if c_type in ['a', 'r']:
488 % if c_type in ['a', 'r']:
489 <%
489 <%
490 if c_type == 'a':
490 if c_type == 'a':
491 cc_title = _('Commit added in displayed changes')
491 cc_title = _('Commit added in displayed changes')
492 elif c_type == 'r':
492 elif c_type == 'r':
493 cc_title = _('Commit removed in displayed changes')
493 cc_title = _('Commit removed in displayed changes')
494 else:
494 else:
495 cc_title = ''
495 cc_title = ''
496 %>
496 %>
497 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
497 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
498 <td>
498 <td>
499 <div class="commit-change-indicator color-${c_type}-border">
499 <div class="commit-change-indicator color-${c_type}-border">
500 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
500 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
501 ${c_type.upper()}
501 ${c_type.upper()}
502 </div>
502 </div>
503 </div>
503 </div>
504 </td>
504 </td>
505 <td class="td-time">
505 <td class="td-time">
506 ${h.age_component(commit.date)}
506 ${h.age_component(commit.date)}
507 </td>
507 </td>
508 <td class="td-user">
508 <td class="td-user">
509 ${base.gravatar_with_user(commit.author, 16)}
509 ${base.gravatar_with_user(commit.author, 16)}
510 </td>
510 </td>
511 <td class="td-hash">
511 <td class="td-hash">
512 <code>
512 <code>
513 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
513 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
514 r${commit.revision}:${h.short_id(commit.raw_id)}
514 r${commit.idx}:${h.short_id(commit.raw_id)}
515 </a>
515 </a>
516 ${h.hidden('revisions', commit.raw_id)}
516 ${h.hidden('revisions', commit.raw_id)}
517 </code>
517 </code>
518 </td>
518 </td>
519 <td class="expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}">
519 <td class="expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}">
520 <div class="show_more_col">
520 <div class="show_more_col">
521 <i class="show_more"></i>
521 <i class="show_more"></i>
522 </div>
522 </div>
523 </td>
523 </td>
524 <td class="mid td-description">
524 <td class="mid td-description">
525 <div class="log-container truncate-wrap">
525 <div class="log-container truncate-wrap">
526 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">
526 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">
527 ${h.urlify_commit_message(commit.message, c.repo_name)}
527 ${h.urlify_commit_message(commit.message, c.repo_name)}
528 </div>
528 </div>
529 </div>
529 </div>
530 </td>
530 </td>
531 </tr>
531 </tr>
532 % endif
532 % endif
533 % endfor
533 % endfor
534 </table>
534 </table>
535 </div>
535 </div>
536
536
537 <script>
537 <script>
538 $('.expand_commit').on('click',function(e){
538 $('.expand_commit').on('click',function(e){
539 var target_expand = $(this);
539 var target_expand = $(this);
540 var cid = target_expand.data('commitId');
540 var cid = target_expand.data('commitId');
541
541
542 if (target_expand.hasClass('open')){
542 if (target_expand.hasClass('open')){
543 $('#c-'+cid).css({
543 $('#c-'+cid).css({
544 'height': '1.5em',
544 'height': '1.5em',
545 'white-space': 'nowrap',
545 'white-space': 'nowrap',
546 'text-overflow': 'ellipsis',
546 'text-overflow': 'ellipsis',
547 'overflow':'hidden'
547 'overflow':'hidden'
548 });
548 });
549 target_expand.removeClass('open');
549 target_expand.removeClass('open');
550 }
550 }
551 else {
551 else {
552 $('#c-'+cid).css({
552 $('#c-'+cid).css({
553 'height': 'auto',
553 'height': 'auto',
554 'white-space': 'pre-line',
554 'white-space': 'pre-line',
555 'text-overflow': 'initial',
555 'text-overflow': 'initial',
556 'overflow':'visible'
556 'overflow':'visible'
557 });
557 });
558 target_expand.addClass('open');
558 target_expand.addClass('open');
559 }
559 }
560 });
560 });
561 </script>
561 </script>
562
562
563 % endif
563 % endif
564
564
565 % else:
565 % else:
566 <%include file="/compare/compare_commits.mako" />
566 <%include file="/compare/compare_commits.mako" />
567 % endif
567 % endif
568
568
569 <div class="cs_files">
569 <div class="cs_files">
570 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
570 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
571 ${cbdiffs.render_diffset_menu(c.diffset)}
571 ${cbdiffs.render_diffset_menu(c.diffset)}
572 ${cbdiffs.render_diffset(
572 ${cbdiffs.render_diffset(
573 c.diffset, use_comments=True,
573 c.diffset, use_comments=True,
574 collapse_when_files_over=30,
574 collapse_when_files_over=30,
575 disable_new_comments=not c.allowed_to_comment,
575 disable_new_comments=not c.allowed_to_comment,
576 deleted_files_comments=c.deleted_files_comments,
576 deleted_files_comments=c.deleted_files_comments,
577 inline_comments=c.inline_comments)}
577 inline_comments=c.inline_comments)}
578 </div>
578 </div>
579 % else:
579 % else:
580 ## skipping commits we need to clear the view for missing commits
580 ## skipping commits we need to clear the view for missing commits
581 <div style="clear:both;"></div>
581 <div style="clear:both;"></div>
582 % endif
582 % endif
583
583
584 </div>
584 </div>
585 </div>
585 </div>
586
586
587 ## template for inline comment form
587 ## template for inline comment form
588 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
588 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
589
589
590 ## render general comments
590 ## render general comments
591
591
592 <div id="comment-tr-show">
592 <div id="comment-tr-show">
593 <div class="comment">
593 <div class="comment">
594 % if general_outdated_comm_count_ver:
594 % if general_outdated_comm_count_ver:
595 <div class="meta">
595 <div class="meta">
596 % if general_outdated_comm_count_ver == 1:
596 % if general_outdated_comm_count_ver == 1:
597 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
597 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
598 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
598 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
599 % else:
599 % else:
600 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
600 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
601 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
601 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
602 % endif
602 % endif
603 </div>
603 </div>
604 % endif
604 % endif
605 </div>
605 </div>
606 </div>
606 </div>
607
607
608 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
608 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
609
609
610 % if not c.pull_request.is_closed():
610 % if not c.pull_request.is_closed():
611 ## merge status, and merge action
611 ## merge status, and merge action
612 <div class="pull-request-merge">
612 <div class="pull-request-merge">
613 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
613 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
614 </div>
614 </div>
615
615
616 ## main comment form and it status
616 ## main comment form and it status
617 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
617 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
618 pull_request_id=c.pull_request.pull_request_id),
618 pull_request_id=c.pull_request.pull_request_id),
619 c.pull_request_review_status,
619 c.pull_request_review_status,
620 is_pull_request=True, change_status=c.allowed_to_change_status)}
620 is_pull_request=True, change_status=c.allowed_to_change_status)}
621 %endif
621 %endif
622
622
623 <script type="text/javascript">
623 <script type="text/javascript">
624 if (location.hash) {
624 if (location.hash) {
625 var result = splitDelimitedHash(location.hash);
625 var result = splitDelimitedHash(location.hash);
626 var line = $('html').find(result.loc);
626 var line = $('html').find(result.loc);
627 // show hidden comments if we use location.hash
627 // show hidden comments if we use location.hash
628 if (line.hasClass('comment-general')) {
628 if (line.hasClass('comment-general')) {
629 $(line).show();
629 $(line).show();
630 } else if (line.hasClass('comment-inline')) {
630 } else if (line.hasClass('comment-inline')) {
631 $(line).show();
631 $(line).show();
632 var $cb = $(line).closest('.cb');
632 var $cb = $(line).closest('.cb');
633 $cb.removeClass('cb-collapsed')
633 $cb.removeClass('cb-collapsed')
634 }
634 }
635 if (line.length > 0){
635 if (line.length > 0){
636 offsetScroll(line, 70);
636 offsetScroll(line, 70);
637 }
637 }
638 }
638 }
639
639
640 versionController = new VersionController();
640 versionController = new VersionController();
641 versionController.init();
641 versionController.init();
642
642
643 reviewersController = new ReviewersController();
643 reviewersController = new ReviewersController();
644
644
645 $(function(){
645 $(function(){
646
646
647 // custom code mirror
647 // custom code mirror
648 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
648 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
649
649
650 var PRDetails = {
650 var PRDetails = {
651 editButton: $('#open_edit_pullrequest'),
651 editButton: $('#open_edit_pullrequest'),
652 closeButton: $('#close_edit_pullrequest'),
652 closeButton: $('#close_edit_pullrequest'),
653 deleteButton: $('#delete_pullrequest'),
653 deleteButton: $('#delete_pullrequest'),
654 viewFields: $('#pr-desc, #pr-title'),
654 viewFields: $('#pr-desc, #pr-title'),
655 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
655 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
656
656
657 init: function() {
657 init: function() {
658 var that = this;
658 var that = this;
659 this.editButton.on('click', function(e) { that.edit(); });
659 this.editButton.on('click', function(e) { that.edit(); });
660 this.closeButton.on('click', function(e) { that.view(); });
660 this.closeButton.on('click', function(e) { that.view(); });
661 },
661 },
662
662
663 edit: function(event) {
663 edit: function(event) {
664 this.viewFields.hide();
664 this.viewFields.hide();
665 this.editButton.hide();
665 this.editButton.hide();
666 this.deleteButton.hide();
666 this.deleteButton.hide();
667 this.closeButton.show();
667 this.closeButton.show();
668 this.editFields.show();
668 this.editFields.show();
669 codeMirrorInstance.refresh();
669 codeMirrorInstance.refresh();
670 },
670 },
671
671
672 view: function(event) {
672 view: function(event) {
673 this.editButton.show();
673 this.editButton.show();
674 this.deleteButton.show();
674 this.deleteButton.show();
675 this.editFields.hide();
675 this.editFields.hide();
676 this.closeButton.hide();
676 this.closeButton.hide();
677 this.viewFields.show();
677 this.viewFields.show();
678 }
678 }
679 };
679 };
680
680
681 var ReviewersPanel = {
681 var ReviewersPanel = {
682 editButton: $('#open_edit_reviewers'),
682 editButton: $('#open_edit_reviewers'),
683 closeButton: $('#close_edit_reviewers'),
683 closeButton: $('#close_edit_reviewers'),
684 addButton: $('#add_reviewer'),
684 addButton: $('#add_reviewer'),
685 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'),
685 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'),
686
686
687 init: function() {
687 init: function() {
688 var self = this;
688 var self = this;
689 this.editButton.on('click', function(e) { self.edit(); });
689 this.editButton.on('click', function(e) { self.edit(); });
690 this.closeButton.on('click', function(e) { self.close(); });
690 this.closeButton.on('click', function(e) { self.close(); });
691 },
691 },
692
692
693 edit: function(event) {
693 edit: function(event) {
694 this.editButton.hide();
694 this.editButton.hide();
695 this.closeButton.show();
695 this.closeButton.show();
696 this.addButton.show();
696 this.addButton.show();
697 this.removeButtons.css('visibility', 'visible');
697 this.removeButtons.css('visibility', 'visible');
698 // review rules
698 // review rules
699 reviewersController.loadReviewRules(
699 reviewersController.loadReviewRules(
700 ${c.pull_request.reviewer_data_json | n});
700 ${c.pull_request.reviewer_data_json | n});
701 },
701 },
702
702
703 close: function(event) {
703 close: function(event) {
704 this.editButton.show();
704 this.editButton.show();
705 this.closeButton.hide();
705 this.closeButton.hide();
706 this.addButton.hide();
706 this.addButton.hide();
707 this.removeButtons.css('visibility', 'hidden');
707 this.removeButtons.css('visibility', 'hidden');
708 // hide review rules
708 // hide review rules
709 reviewersController.hideReviewRules()
709 reviewersController.hideReviewRules()
710 }
710 }
711 };
711 };
712
712
713 PRDetails.init();
713 PRDetails.init();
714 ReviewersPanel.init();
714 ReviewersPanel.init();
715
715
716 showOutdated = function(self){
716 showOutdated = function(self){
717 $('.comment-inline.comment-outdated').show();
717 $('.comment-inline.comment-outdated').show();
718 $('.filediff-outdated').show();
718 $('.filediff-outdated').show();
719 $('.showOutdatedComments').hide();
719 $('.showOutdatedComments').hide();
720 $('.hideOutdatedComments').show();
720 $('.hideOutdatedComments').show();
721 };
721 };
722
722
723 hideOutdated = function(self){
723 hideOutdated = function(self){
724 $('.comment-inline.comment-outdated').hide();
724 $('.comment-inline.comment-outdated').hide();
725 $('.filediff-outdated').hide();
725 $('.filediff-outdated').hide();
726 $('.hideOutdatedComments').hide();
726 $('.hideOutdatedComments').hide();
727 $('.showOutdatedComments').show();
727 $('.showOutdatedComments').show();
728 };
728 };
729
729
730 refreshMergeChecks = function(){
730 refreshMergeChecks = function(){
731 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
731 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
732 $('.pull-request-merge').css('opacity', 0.3);
732 $('.pull-request-merge').css('opacity', 0.3);
733 $('.action-buttons-extra').css('opacity', 0.3);
733 $('.action-buttons-extra').css('opacity', 0.3);
734
734
735 $('.pull-request-merge').load(
735 $('.pull-request-merge').load(
736 loadUrl, function() {
736 loadUrl, function() {
737 $('.pull-request-merge').css('opacity', 1);
737 $('.pull-request-merge').css('opacity', 1);
738
738
739 $('.action-buttons-extra').css('opacity', 1);
739 $('.action-buttons-extra').css('opacity', 1);
740 injectCloseAction();
740 injectCloseAction();
741 }
741 }
742 );
742 );
743 };
743 };
744
744
745 injectCloseAction = function() {
745 injectCloseAction = function() {
746 var closeAction = $('#close-pull-request-action').html();
746 var closeAction = $('#close-pull-request-action').html();
747 var $actionButtons = $('.action-buttons-extra');
747 var $actionButtons = $('.action-buttons-extra');
748 // clear the action before
748 // clear the action before
749 $actionButtons.html("");
749 $actionButtons.html("");
750 $actionButtons.html(closeAction);
750 $actionButtons.html(closeAction);
751 };
751 };
752
752
753 closePullRequest = function (status) {
753 closePullRequest = function (status) {
754 // inject closing flag
754 // inject closing flag
755 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
755 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
756 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
756 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
757 $(generalCommentForm.submitForm).submit();
757 $(generalCommentForm.submitForm).submit();
758 };
758 };
759
759
760 $('#show-outdated-comments').on('click', function(e){
760 $('#show-outdated-comments').on('click', function(e){
761 var button = $(this);
761 var button = $(this);
762 var outdated = $('.comment-outdated');
762 var outdated = $('.comment-outdated');
763
763
764 if (button.html() === "(Show)") {
764 if (button.html() === "(Show)") {
765 button.html("(Hide)");
765 button.html("(Hide)");
766 outdated.show();
766 outdated.show();
767 } else {
767 } else {
768 button.html("(Show)");
768 button.html("(Show)");
769 outdated.hide();
769 outdated.hide();
770 }
770 }
771 });
771 });
772
772
773 $('.show-inline-comments').on('change', function(e){
773 $('.show-inline-comments').on('change', function(e){
774 var show = 'none';
774 var show = 'none';
775 var target = e.currentTarget;
775 var target = e.currentTarget;
776 if(target.checked){
776 if(target.checked){
777 show = ''
777 show = ''
778 }
778 }
779 var boxid = $(target).attr('id_for');
779 var boxid = $(target).attr('id_for');
780 var comments = $('#{0} .inline-comments'.format(boxid));
780 var comments = $('#{0} .inline-comments'.format(boxid));
781 var fn_display = function(idx){
781 var fn_display = function(idx){
782 $(this).css('display', show);
782 $(this).css('display', show);
783 };
783 };
784 $(comments).each(fn_display);
784 $(comments).each(fn_display);
785 var btns = $('#{0} .inline-comments-button'.format(boxid));
785 var btns = $('#{0} .inline-comments-button'.format(boxid));
786 $(btns).each(fn_display);
786 $(btns).each(fn_display);
787 });
787 });
788
788
789 $('#merge_pull_request_form').submit(function() {
789 $('#merge_pull_request_form').submit(function() {
790 if (!$('#merge_pull_request').attr('disabled')) {
790 if (!$('#merge_pull_request').attr('disabled')) {
791 $('#merge_pull_request').attr('disabled', 'disabled');
791 $('#merge_pull_request').attr('disabled', 'disabled');
792 }
792 }
793 return true;
793 return true;
794 });
794 });
795
795
796 $('#edit_pull_request').on('click', function(e){
796 $('#edit_pull_request').on('click', function(e){
797 var title = $('#pr-title-input').val();
797 var title = $('#pr-title-input').val();
798 var description = codeMirrorInstance.getValue();
798 var description = codeMirrorInstance.getValue();
799 var renderer = $('#pr-renderer-input').val();
799 var renderer = $('#pr-renderer-input').val();
800 editPullRequest(
800 editPullRequest(
801 "${c.repo_name}", "${c.pull_request.pull_request_id}",
801 "${c.repo_name}", "${c.pull_request.pull_request_id}",
802 title, description, renderer);
802 title, description, renderer);
803 });
803 });
804
804
805 $('#update_pull_request').on('click', function(e){
805 $('#update_pull_request').on('click', function(e){
806 $(this).attr('disabled', 'disabled');
806 $(this).attr('disabled', 'disabled');
807 $(this).addClass('disabled');
807 $(this).addClass('disabled');
808 $(this).html(_gettext('Saving...'));
808 $(this).html(_gettext('Saving...'));
809 reviewersController.updateReviewers(
809 reviewersController.updateReviewers(
810 "${c.repo_name}", "${c.pull_request.pull_request_id}");
810 "${c.repo_name}", "${c.pull_request.pull_request_id}");
811 });
811 });
812
812
813 $('#update_commits').on('click', function(e){
813 $('#update_commits').on('click', function(e){
814 var isDisabled = !$(e.currentTarget).attr('disabled');
814 var isDisabled = !$(e.currentTarget).attr('disabled');
815 $(e.currentTarget).attr('disabled', 'disabled');
815 $(e.currentTarget).attr('disabled', 'disabled');
816 $(e.currentTarget).addClass('disabled');
816 $(e.currentTarget).addClass('disabled');
817 $(e.currentTarget).removeClass('btn-primary');
817 $(e.currentTarget).removeClass('btn-primary');
818 $(e.currentTarget).text(_gettext('Updating...'));
818 $(e.currentTarget).text(_gettext('Updating...'));
819 if(isDisabled){
819 if(isDisabled){
820 updateCommits(
820 updateCommits(
821 "${c.repo_name}", "${c.pull_request.pull_request_id}");
821 "${c.repo_name}", "${c.pull_request.pull_request_id}");
822 }
822 }
823 });
823 });
824 // fixing issue with caches on firefox
824 // fixing issue with caches on firefox
825 $('#update_commits').removeAttr("disabled");
825 $('#update_commits').removeAttr("disabled");
826
826
827 $('.show-inline-comments').on('click', function(e){
827 $('.show-inline-comments').on('click', function(e){
828 var boxid = $(this).attr('data-comment-id');
828 var boxid = $(this).attr('data-comment-id');
829 var button = $(this);
829 var button = $(this);
830
830
831 if(button.hasClass("comments-visible")) {
831 if(button.hasClass("comments-visible")) {
832 $('#{0} .inline-comments'.format(boxid)).each(function(index){
832 $('#{0} .inline-comments'.format(boxid)).each(function(index){
833 $(this).hide();
833 $(this).hide();
834 });
834 });
835 button.removeClass("comments-visible");
835 button.removeClass("comments-visible");
836 } else {
836 } else {
837 $('#{0} .inline-comments'.format(boxid)).each(function(index){
837 $('#{0} .inline-comments'.format(boxid)).each(function(index){
838 $(this).show();
838 $(this).show();
839 });
839 });
840 button.addClass("comments-visible");
840 button.addClass("comments-visible");
841 }
841 }
842 });
842 });
843
843
844 // register submit callback on commentForm form to track TODOs
844 // register submit callback on commentForm form to track TODOs
845 window.commentFormGlobalSubmitSuccessCallback = function(){
845 window.commentFormGlobalSubmitSuccessCallback = function(){
846 refreshMergeChecks();
846 refreshMergeChecks();
847 };
847 };
848 // initial injection
848 // initial injection
849 injectCloseAction();
849 injectCloseAction();
850
850
851 ReviewerAutoComplete('#user');
851 ReviewerAutoComplete('#user');
852
852
853 })
853 })
854 </script>
854 </script>
855
855
856 </div>
856 </div>
857 </div>
857 </div>
858
858
859 </%def>
859 </%def>
General Comments 0
You need to be logged in to leave comments. Login now