Show More
@@ -1,922 +1,920 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 | ${_('{} Pull Request !{}').format(c.repo_name, c.pull_request.pull_request_id)} |
|
6 | ${_('{} Pull Request !{}').format(c.repo_name, c.pull_request.pull_request_id)} | |
7 | %if c.rhodecode_name: |
|
7 | %if c.rhodecode_name: | |
8 | · ${h.branding(c.rhodecode_name)} |
|
8 | · ${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 |
|
13 | |||
14 | </%def> |
|
14 | </%def> | |
15 |
|
15 | |||
16 | <%def name="menu_bar_nav()"> |
|
16 | <%def name="menu_bar_nav()"> | |
17 | ${self.menu_items(active='repositories')} |
|
17 | ${self.menu_items(active='repositories')} | |
18 | </%def> |
|
18 | </%def> | |
19 |
|
19 | |||
20 | <%def name="menu_bar_subnav()"> |
|
20 | <%def name="menu_bar_subnav()"> | |
21 | ${self.repo_menu(active='showpullrequest')} |
|
21 | ${self.repo_menu(active='showpullrequest')} | |
22 | </%def> |
|
22 | </%def> | |
23 |
|
23 | |||
24 | <%def name="main()"> |
|
24 | <%def name="main()"> | |
25 |
|
25 | |||
26 | <script type="text/javascript"> |
|
26 | <script type="text/javascript"> | |
27 | // TODO: marcink switch this to pyroutes |
|
27 | // TODO: marcink switch this to pyroutes | |
28 | 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__')}"; |
|
28 | 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__')}"; | |
29 | templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id}; |
|
29 | templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id}; | |
30 | </script> |
|
30 | </script> | |
31 |
|
31 | |||
32 | <div class="box"> |
|
32 | <div class="box"> | |
33 |
|
33 | |||
34 | <div class="box pr-summary"> |
|
34 | <div class="box pr-summary"> | |
35 |
|
35 | |||
36 | <div class="summary-details block-left"> |
|
36 | <div class="summary-details block-left"> | |
37 | <div id="pr-title"> |
|
37 | <div id="pr-title"> | |
38 | % if c.pull_request.is_closed(): |
|
38 | % if c.pull_request.is_closed(): | |
39 | <span class="pr-title-closed-tag tag">${_('Closed')}</span> |
|
39 | <span class="pr-title-closed-tag tag">${_('Closed')}</span> | |
40 | % endif |
|
40 | % endif | |
41 | <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}"> |
|
41 | <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}"> | |
42 | </div> |
|
42 | </div> | |
43 | <div id="pr-title-edit" class="input" style="display: none;"> |
|
43 | <div id="pr-title-edit" class="input" style="display: none;"> | |
44 | <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}"> |
|
44 | <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}"> | |
45 | </div> |
|
45 | </div> | |
46 |
|
46 | |||
47 | <% summary = lambda n:{False:'summary-short'}.get(n) %> |
|
47 | <% summary = lambda n:{False:'summary-short'}.get(n) %> | |
48 | <div class="pr-details-title"> |
|
48 | <div class="pr-details-title"> | |
49 | <div class="pull-left"> |
|
49 | <div class="pull-left"> | |
50 | <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request !{}').format(c.pull_request.pull_request_id)}</a> |
|
50 | <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request !{}').format(c.pull_request.pull_request_id)}</a> | |
51 | ${_('Created on')} |
|
51 | ${_('Created on')} | |
52 | <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span> |
|
52 | <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span> | |
53 | <span class="pr-details-title-author-pref">${_('by')}</span> |
|
53 | <span class="pr-details-title-author-pref">${_('by')}</span> | |
54 | </div> |
|
54 | </div> | |
55 |
|
55 | |||
56 | <div class="pull-left"> |
|
56 | <div class="pull-left"> | |
57 | ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)} |
|
57 | ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)} | |
58 | </div> |
|
58 | </div> | |
59 |
|
59 | |||
60 | %if c.allowed_to_update: |
|
60 | %if c.allowed_to_update: | |
61 | <div class="pull-right"> |
|
61 | <div class="pull-right"> | |
62 | <div id="edit_pull_request" class="action_button pr-save" style="display: none;">${_('Update title & description')}</div> |
|
62 | <div id="edit_pull_request" class="action_button pr-save" style="display: none;">${_('Update title & description')}</div> | |
63 | <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;"> |
|
63 | <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;"> | |
64 | % if c.allowed_to_delete: |
|
64 | % if c.allowed_to_delete: | |
65 | ${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)} |
|
65 | ${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)} | |
66 | <input class="btn btn-link btn-danger no-margin" id="remove_${c.pull_request.pull_request_id}" name="remove_${c.pull_request.pull_request_id}" |
|
66 | <input class="btn btn-link btn-danger no-margin" id="remove_${c.pull_request.pull_request_id}" name="remove_${c.pull_request.pull_request_id}" | |
67 | onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')" |
|
67 | onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')" | |
68 | type="submit" value="${_('Delete pull request')}"> |
|
68 | type="submit" value="${_('Delete pull request')}"> | |
69 | ${h.end_form()} |
|
69 | ${h.end_form()} | |
70 | % else: |
|
70 | % else: | |
71 | <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span> |
|
71 | <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span> | |
72 | % endif |
|
72 | % endif | |
73 | </div> |
|
73 | </div> | |
74 | <div id="open_edit_pullrequest" class="action_button">${_('Edit')}</div> |
|
74 | <div id="open_edit_pullrequest" class="action_button">${_('Edit')}</div> | |
75 | <div id="close_edit_pullrequest" class="action_button" style="display: none;">${_('Cancel')}</div> |
|
75 | <div id="close_edit_pullrequest" class="action_button" style="display: none;">${_('Cancel')}</div> | |
76 | </div> |
|
76 | </div> | |
77 |
|
77 | |||
78 | %endif |
|
78 | %endif | |
79 | </div> |
|
79 | </div> | |
80 |
|
80 | |||
81 | <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}"> |
|
81 | <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}"> | |
82 | ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name)} |
|
82 | ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name)} | |
83 | </div> |
|
83 | </div> | |
84 |
|
84 | |||
85 | <div id="pr-desc-edit" class="input textarea" style="display: none;"> |
|
85 | <div id="pr-desc-edit" class="input textarea" style="display: none;"> | |
86 | <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}"> |
|
86 | <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}"> | |
87 | ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)} |
|
87 | ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)} | |
88 | </div> |
|
88 | </div> | |
89 |
|
89 | |||
90 | <div id="summary" class="fields pr-details-content"> |
|
90 | <div id="summary" class="fields pr-details-content"> | |
91 |
|
91 | |||
92 | ## review |
|
92 | ## review | |
93 | <div class="field"> |
|
93 | <div class="field"> | |
94 | <div class="label-pr-detail"> |
|
94 | <div class="label-pr-detail"> | |
95 | <label>${_('Review status')}:</label> |
|
95 | <label>${_('Review status')}:</label> | |
96 | </div> |
|
96 | </div> | |
97 | <div class="input"> |
|
97 | <div class="input"> | |
98 | %if c.pull_request_review_status: |
|
98 | %if c.pull_request_review_status: | |
99 | <div class="tag status-tag-${c.pull_request_review_status}"> |
|
99 | <div class="tag status-tag-${c.pull_request_review_status}"> | |
100 | <i class="icon-circle review-status-${c.pull_request_review_status}"></i> |
|
100 | <i class="icon-circle review-status-${c.pull_request_review_status}"></i> | |
101 | <span class="changeset-status-lbl"> |
|
101 | <span class="changeset-status-lbl"> | |
102 | %if c.pull_request.is_closed(): |
|
102 | %if c.pull_request.is_closed(): | |
103 | ${_('Closed')}, |
|
103 | ${_('Closed')}, | |
104 | %endif |
|
104 | %endif | |
105 |
|
105 | |||
106 | ${h.commit_status_lbl(c.pull_request_review_status)} |
|
106 | ${h.commit_status_lbl(c.pull_request_review_status)} | |
107 |
|
107 | |||
108 | </span> |
|
108 | </span> | |
109 | </div> |
|
109 | </div> | |
110 | - ${_ungettext('calculated based on {} reviewer vote', 'calculated based on {} reviewers votes', len(c.pull_request_reviewers)).format(len(c.pull_request_reviewers))} |
|
110 | - ${_ungettext('calculated based on {} reviewer vote', 'calculated based on {} reviewers votes', len(c.pull_request_reviewers)).format(len(c.pull_request_reviewers))} | |
111 | %endif |
|
111 | %endif | |
112 | </div> |
|
112 | </div> | |
113 | </div> |
|
113 | </div> | |
114 |
|
114 | |||
115 | ## source |
|
115 | ## source | |
116 | <div class="field"> |
|
116 | <div class="field"> | |
117 | <div class="label-pr-detail"> |
|
117 | <div class="label-pr-detail"> | |
118 | <label>${_('Commit flow')}:</label> |
|
118 | <label>${_('Commit flow')}:</label> | |
119 | </div> |
|
119 | </div> | |
120 | <div class="input"> |
|
120 | <div class="input"> | |
121 | <div class="pr-commit-flow"> |
|
121 | <div class="pr-commit-flow"> | |
122 | ## Source |
|
122 | ## Source | |
123 | %if c.pull_request.source_ref_parts.type == 'branch': |
|
123 | %if c.pull_request.source_ref_parts.type == 'branch': | |
124 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}"><code class="pr-source-info">${c.pull_request.source_ref_parts.type}:${c.pull_request.source_ref_parts.name}</code></a> |
|
124 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}"><code class="pr-source-info">${c.pull_request.source_ref_parts.type}:${c.pull_request.source_ref_parts.name}</code></a> | |
125 | %else: |
|
125 | %else: | |
126 | <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code> |
|
126 | <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code> | |
127 | %endif |
|
127 | %endif | |
128 | ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.repo_name}</a> |
|
128 | ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.repo_name}</a> | |
129 | → |
|
129 | → | |
130 | ## Target |
|
130 | ## Target | |
131 | %if c.pull_request.target_ref_parts.type == 'branch': |
|
131 | %if c.pull_request.target_ref_parts.type == 'branch': | |
132 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}"><code class="pr-target-info">${c.pull_request.target_ref_parts.type}:${c.pull_request.target_ref_parts.name}</code></a> |
|
132 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}"><code class="pr-target-info">${c.pull_request.target_ref_parts.type}:${c.pull_request.target_ref_parts.name}</code></a> | |
133 | %else: |
|
133 | %else: | |
134 | <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code> |
|
134 | <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code> | |
135 | %endif |
|
135 | %endif | |
136 |
|
136 | |||
137 | ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.repo_name}</a> |
|
137 | ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.repo_name}</a> | |
138 |
|
138 | |||
139 | <a class="source-details-action" href="#expand-source-details" onclick="return versionController.toggleElement(this, '.source-details')" data-toggle-on='<i class="icon-angle-down">more details</i>' data-toggle-off='<i class="icon-angle-up">less details</i>'> |
|
139 | <a class="source-details-action" href="#expand-source-details" onclick="return versionController.toggleElement(this, '.source-details')" data-toggle-on='<i class="icon-angle-down">more details</i>' data-toggle-off='<i class="icon-angle-up">less details</i>'> | |
140 | <i class="icon-angle-down">more details</i> |
|
140 | <i class="icon-angle-down">more details</i> | |
141 | </a> |
|
141 | </a> | |
142 |
|
142 | |||
143 | </div> |
|
143 | </div> | |
144 |
|
144 | |||
145 | <div class="source-details" style="display: none"> |
|
145 | <div class="source-details" style="display: none"> | |
146 |
|
146 | |||
147 | <ul> |
|
147 | <ul> | |
148 |
|
148 | |||
149 | ## common ancestor |
|
149 | ## common ancestor | |
150 | <li> |
|
150 | <li> | |
151 | ${_('Common ancestor')}: |
|
151 | ${_('Common ancestor')}: | |
152 | % if c.ancestor_commit: |
|
152 | % if c.ancestor_commit: | |
153 | <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> |
|
153 | <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> | |
154 | % else: |
|
154 | % else: | |
155 | ${_('not available')} |
|
155 | ${_('not available')} | |
156 | % endif |
|
156 | % endif | |
157 | </li> |
|
157 | </li> | |
158 |
|
158 | |||
159 | ## pull url |
|
159 | ## pull url | |
160 | <li> |
|
160 | <li> | |
161 | %if h.is_hg(c.pull_request.source_repo): |
|
161 | %if h.is_hg(c.pull_request.source_repo): | |
162 | <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %> |
|
162 | <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %> | |
163 | %elif h.is_git(c.pull_request.source_repo): |
|
163 | %elif h.is_git(c.pull_request.source_repo): | |
164 | <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %> |
|
164 | <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %> | |
165 | %endif |
|
165 | %endif | |
166 |
|
166 | |||
167 | <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly"> |
|
167 | <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly"> | |
168 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i> |
|
168 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i> | |
169 | </li> |
|
169 | </li> | |
170 |
|
170 | |||
171 | ## Shadow repo |
|
171 | ## Shadow repo | |
172 | <li> |
|
172 | <li> | |
173 | % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref: |
|
173 | % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref: | |
174 | %if h.is_hg(c.pull_request.target_repo): |
|
174 | %if h.is_hg(c.pull_request.target_repo): | |
175 | <% 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) %> |
|
175 | <% 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) %> | |
176 | %elif h.is_git(c.pull_request.target_repo): |
|
176 | %elif h.is_git(c.pull_request.target_repo): | |
177 | <% 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) %> |
|
177 | <% 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) %> | |
178 | %endif |
|
178 | %endif | |
179 |
|
179 | |||
180 | <span class="tooltip" title="${_('Clone repository in its merged state using shadow repository')}">${_('Clone from shadow repository')}</span>: <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly"> |
|
180 | <span class="tooltip" title="${_('Clone repository in its merged state using shadow repository')}">${_('Clone from shadow repository')}</span>: <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly"> | |
181 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i> |
|
181 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i> | |
182 |
|
182 | |||
183 | % else: |
|
183 | % else: | |
184 | <div class=""> |
|
184 | <div class=""> | |
185 | ${_('Shadow repository data not available')}. |
|
185 | ${_('Shadow repository data not available')}. | |
186 | </div> |
|
186 | </div> | |
187 | % endif |
|
187 | % endif | |
188 | </li> |
|
188 | </li> | |
189 |
|
189 | |||
190 | </ul> |
|
190 | </ul> | |
191 |
|
191 | |||
192 | </div> |
|
192 | </div> | |
193 |
|
193 | |||
194 | </div> |
|
194 | </div> | |
195 |
|
195 | |||
196 | </div> |
|
196 | </div> | |
197 |
|
197 | |||
198 | ## versions |
|
198 | ## versions | |
199 | <div class="field"> |
|
199 | <div class="field"> | |
200 | <div class="label-pr-detail"> |
|
200 | <div class="label-pr-detail"> | |
201 | <label>${_('Versions')}:</label> |
|
201 | <label>${_('Versions')}:</label> | |
202 | </div> |
|
202 | </div> | |
203 |
|
203 | |||
204 | <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %> |
|
204 | <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %> | |
205 | <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %> |
|
205 | <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %> | |
206 |
|
206 | |||
207 | <div class="pr-versions"> |
|
207 | <div class="pr-versions"> | |
208 | % if c.show_version_changes: |
|
208 | % if c.show_version_changes: | |
209 | <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %> |
|
209 | <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %> | |
210 | <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %> |
|
210 | <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %> | |
211 | ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))} |
|
211 | ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))} | |
212 | <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions" |
|
212 | <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions" | |
213 | data-toggle-on="${_('show versions')}." |
|
213 | data-toggle-on="${_('show versions')}." | |
214 | data-toggle-off="${_('hide versions')}."> |
|
214 | data-toggle-off="${_('hide versions')}."> | |
215 | ${_('show versions')}. |
|
215 | ${_('show versions')}. | |
216 | </a> |
|
216 | </a> | |
217 | <table> |
|
217 | <table> | |
218 | ## SHOW ALL VERSIONS OF PR |
|
218 | ## SHOW ALL VERSIONS OF PR | |
219 | <% ver_pr = None %> |
|
219 | <% ver_pr = None %> | |
220 |
|
220 | |||
221 | % for data in reversed(list(enumerate(c.versions, 1))): |
|
221 | % for data in reversed(list(enumerate(c.versions, 1))): | |
222 | <% ver_pos = data[0] %> |
|
222 | <% ver_pos = data[0] %> | |
223 | <% ver = data[1] %> |
|
223 | <% ver = data[1] %> | |
224 | <% ver_pr = ver.pull_request_version_id %> |
|
224 | <% ver_pr = ver.pull_request_version_id %> | |
225 | <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %> |
|
225 | <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %> | |
226 |
|
226 | |||
227 | <tr class="version-pr" style="display: ${display_row}"> |
|
227 | <tr class="version-pr" style="display: ${display_row}"> | |
228 | <td> |
|
228 | <td> | |
229 | <code> |
|
229 | <code> | |
230 | <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a> |
|
230 | <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a> | |
231 | </code> |
|
231 | </code> | |
232 | </td> |
|
232 | </td> | |
233 | <td> |
|
233 | <td> | |
234 | <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}"/> |
|
234 | <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}"/> | |
235 | <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}"/> |
|
235 | <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}"/> | |
236 | </td> |
|
236 | </td> | |
237 | <td> |
|
237 | <td> | |
238 | <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %> |
|
238 | <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %> | |
239 | <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i> |
|
239 | <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i> | |
240 |
|
240 | |||
241 | </td> |
|
241 | </td> | |
242 | <td> |
|
242 | <td> | |
243 | % if c.at_version_num != ver_pr: |
|
243 | % if c.at_version_num != ver_pr: | |
244 | <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i> |
|
244 | <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i> | |
245 | <code> |
|
245 | <code> | |
246 | General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])} |
|
246 | General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])} | |
247 | </code> |
|
247 | </code> | |
248 | % endif |
|
248 | % endif | |
249 | </td> |
|
249 | </td> | |
250 | <td> |
|
250 | <td> | |
251 | ##<code>${ver.source_ref_parts.commit_id[:6]}</code> |
|
251 | ##<code>${ver.source_ref_parts.commit_id[:6]}</code> | |
252 | </td> |
|
252 | </td> | |
253 | <td> |
|
253 | <td> | |
254 | <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code> |
|
254 | <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code> | |
255 | </td> |
|
255 | </td> | |
256 | </tr> |
|
256 | </tr> | |
257 | % endfor |
|
257 | % endfor | |
258 |
|
258 | |||
259 | <tr> |
|
259 | <tr> | |
260 | <td colspan="6"> |
|
260 | <td colspan="6"> | |
261 | <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none" |
|
261 | <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none" | |
262 | data-label-text-locked="${_('select versions to show changes')}" |
|
262 | data-label-text-locked="${_('select versions to show changes')}" | |
263 | data-label-text-diff="${_('show changes between versions')}" |
|
263 | data-label-text-diff="${_('show changes between versions')}" | |
264 | data-label-text-show="${_('show pull request for this version')}" |
|
264 | data-label-text-show="${_('show pull request for this version')}" | |
265 | > |
|
265 | > | |
266 | ${_('select versions to show changes')} |
|
266 | ${_('select versions to show changes')} | |
267 | </button> |
|
267 | </button> | |
268 | </td> |
|
268 | </td> | |
269 | </tr> |
|
269 | </tr> | |
270 | </table> |
|
270 | </table> | |
271 | % else: |
|
271 | % else: | |
272 | <div> |
|
272 | <div> | |
273 | ${_('Pull request versions not available')}. |
|
273 | ${_('Pull request versions not available')}. | |
274 | </div> |
|
274 | </div> | |
275 | % endif |
|
275 | % endif | |
276 | </div> |
|
276 | </div> | |
277 | </div> |
|
277 | </div> | |
278 |
|
278 | |||
279 | </div> |
|
279 | </div> | |
280 |
|
280 | |||
281 | </div> |
|
281 | </div> | |
282 |
|
282 | |||
283 | ## REVIEW RULES |
|
283 | ## REVIEW RULES | |
284 | <div id="review_rules" style="display: none" class="reviewers-title block-right"> |
|
284 | <div id="review_rules" style="display: none" class="reviewers-title block-right"> | |
285 | <div class="pr-details-title"> |
|
285 | <div class="pr-details-title"> | |
286 | ${_('Reviewer rules')} |
|
286 | ${_('Reviewer rules')} | |
287 | %if c.allowed_to_update: |
|
287 | %if c.allowed_to_update: | |
288 | <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span> |
|
288 | <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span> | |
289 | %endif |
|
289 | %endif | |
290 | </div> |
|
290 | </div> | |
291 | <div class="pr-reviewer-rules"> |
|
291 | <div class="pr-reviewer-rules"> | |
292 | ## review rules will be appended here, by default reviewers logic |
|
292 | ## review rules will be appended here, by default reviewers logic | |
293 | </div> |
|
293 | </div> | |
294 | <input id="review_data" type="hidden" name="review_data" value=""> |
|
294 | <input id="review_data" type="hidden" name="review_data" value=""> | |
295 | </div> |
|
295 | </div> | |
296 |
|
296 | |||
297 | ## REVIEWERS |
|
297 | ## REVIEWERS | |
298 | <div class="reviewers-title first-panel block-right"> |
|
298 | <div class="reviewers-title first-panel block-right"> | |
299 | <div class="pr-details-title"> |
|
299 | <div class="pr-details-title"> | |
300 | ${_('Pull request reviewers')} |
|
300 | ${_('Pull request reviewers')} | |
301 | %if c.allowed_to_update: |
|
301 | %if c.allowed_to_update: | |
302 | <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span> |
|
302 | <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span> | |
303 | %endif |
|
303 | %endif | |
304 | </div> |
|
304 | </div> | |
305 | </div> |
|
305 | </div> | |
306 | <div id="reviewers" class="block-right pr-details-content reviewers"> |
|
306 | <div id="reviewers" class="block-right pr-details-content reviewers"> | |
307 |
|
307 | |||
308 | ## members redering block |
|
308 | ## members redering block | |
309 | <input type="hidden" name="__start__" value="review_members:sequence"> |
|
309 | <input type="hidden" name="__start__" value="review_members:sequence"> | |
310 | <ul id="review_members" class="group_members"> |
|
310 | <ul id="review_members" class="group_members"> | |
311 |
|
311 | |||
312 | % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers: |
|
312 | % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers: | |
313 | <script> |
|
313 | <script> | |
314 | var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n}; |
|
314 | var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n}; | |
315 | var status = "${(status[0][1].status if status else 'not_reviewed')}"; |
|
315 | var status = "${(status[0][1].status if status else 'not_reviewed')}"; | |
316 | var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}"; |
|
316 | var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}"; | |
317 | var allowed_to_update = ${h.json.dumps(c.allowed_to_update)}; |
|
317 | var allowed_to_update = ${h.json.dumps(c.allowed_to_update)}; | |
318 |
|
318 | |||
319 | var entry = renderTemplate('reviewMemberEntry', { |
|
319 | var entry = renderTemplate('reviewMemberEntry', { | |
320 | 'member': member, |
|
320 | 'member': member, | |
321 | 'mandatory': member.mandatory, |
|
321 | 'mandatory': member.mandatory, | |
322 | 'reasons': member.reasons, |
|
322 | 'reasons': member.reasons, | |
323 | 'allowed_to_update': allowed_to_update, |
|
323 | 'allowed_to_update': allowed_to_update, | |
324 | 'review_status': status, |
|
324 | 'review_status': status, | |
325 | 'review_status_label': status_lbl, |
|
325 | 'review_status_label': status_lbl, | |
326 | 'user_group': member.user_group, |
|
326 | 'user_group': member.user_group, | |
327 | 'create': false |
|
327 | 'create': false | |
328 | }); |
|
328 | }); | |
329 | $('#review_members').append(entry) |
|
329 | $('#review_members').append(entry) | |
330 | </script> |
|
330 | </script> | |
331 |
|
331 | |||
332 | % endfor |
|
332 | % endfor | |
333 |
|
333 | |||
334 | </ul> |
|
334 | </ul> | |
335 |
|
335 | |||
336 | <input type="hidden" name="__end__" value="review_members:sequence"> |
|
336 | <input type="hidden" name="__end__" value="review_members:sequence"> | |
337 | ## end members redering block |
|
337 | ## end members redering block | |
338 |
|
338 | |||
339 | %if not c.pull_request.is_closed(): |
|
339 | %if not c.pull_request.is_closed(): | |
340 | <div id="add_reviewer" class="ac" style="display: none;"> |
|
340 | <div id="add_reviewer" class="ac" style="display: none;"> | |
341 | %if c.allowed_to_update: |
|
341 | %if c.allowed_to_update: | |
342 | % if not c.forbid_adding_reviewers: |
|
342 | % if not c.forbid_adding_reviewers: | |
343 | <div id="add_reviewer_input" class="reviewer_ac"> |
|
343 | <div id="add_reviewer_input" class="reviewer_ac"> | |
344 | ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))} |
|
344 | ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))} | |
345 | <div id="reviewers_container"></div> |
|
345 | <div id="reviewers_container"></div> | |
346 | </div> |
|
346 | </div> | |
347 | % endif |
|
347 | % endif | |
348 | <div class="pull-right"> |
|
348 | <div class="pull-right"> | |
349 | <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button> |
|
349 | <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button> | |
350 | </div> |
|
350 | </div> | |
351 | %endif |
|
351 | %endif | |
352 | </div> |
|
352 | </div> | |
353 | %endif |
|
353 | %endif | |
354 | </div> |
|
354 | </div> | |
355 |
|
355 | |||
356 | ## TODOs will be listed here |
|
356 | ## TODOs will be listed here | |
357 | <div class="reviewers-title block-right"> |
|
357 | <div class="reviewers-title block-right"> | |
358 | <div class="pr-details-title"> |
|
358 | <div class="pr-details-title"> | |
359 | ## Only show unresolved, that is only what matters |
|
359 | ## Only show unresolved, that is only what matters | |
360 | TODO Comments - ${len(c.unresolved_comments)} / ${(len(c.unresolved_comments) + len(c.resolved_comments))} |
|
360 | TODO Comments - ${len(c.unresolved_comments)} / ${(len(c.unresolved_comments) + len(c.resolved_comments))} | |
361 |
|
361 | |||
362 | % if not c.at_version: |
|
362 | % if not c.at_version: | |
363 | % if c.resolved_comments: |
|
363 | % if c.resolved_comments: | |
364 | <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return versionController.toggleElement(this, '.unresolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span> |
|
364 | <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return versionController.toggleElement(this, '.unresolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span> | |
365 | % else: |
|
365 | % else: | |
366 | <span class="block-right last-item noselect">Show resolved</span> |
|
366 | <span class="block-right last-item noselect">Show resolved</span> | |
367 | % endif |
|
367 | % endif | |
368 | % endif |
|
368 | % endif | |
369 | </div> |
|
369 | </div> | |
370 | </div> |
|
370 | </div> | |
371 | <div class="block-right pr-details-content reviewers"> |
|
371 | <div class="block-right pr-details-content reviewers"> | |
372 |
|
372 | |||
373 | <table class="todo-table"> |
|
373 | <table class="todo-table"> | |
374 | <% |
|
374 | <% | |
375 | def sorter(entry): |
|
375 | def sorter(entry): | |
376 | user_id = entry.author.user_id |
|
376 | user_id = entry.author.user_id | |
377 | resolved = '1' if entry.resolved else '0' |
|
377 | resolved = '1' if entry.resolved else '0' | |
378 | if user_id == c.rhodecode_user.user_id: |
|
378 | if user_id == c.rhodecode_user.user_id: | |
379 | # own comments first |
|
379 | # own comments first | |
380 | user_id = 0 |
|
380 | user_id = 0 | |
381 | return '{}_{}_{}'.format(resolved, user_id, str(entry.comment_id).zfill(100)) |
|
381 | return '{}_{}_{}'.format(resolved, user_id, str(entry.comment_id).zfill(100)) | |
382 | %> |
|
382 | %> | |
383 |
|
383 | |||
384 | % if c.at_version: |
|
384 | % if c.at_version: | |
385 | <tr> |
|
385 | <tr> | |
386 | <td class="unresolved-todo-text">${_('unresolved TODOs unavailable in this view')}.</td> |
|
386 | <td class="unresolved-todo-text">${_('unresolved TODOs unavailable in this view')}.</td> | |
387 | </tr> |
|
387 | </tr> | |
388 | % else: |
|
388 | % else: | |
389 | % for todo_comment in sorted(c.unresolved_comments + c.resolved_comments, key=sorter): |
|
389 | % for todo_comment in sorted(c.unresolved_comments + c.resolved_comments, key=sorter): | |
390 | <% resolved = todo_comment.resolved %> |
|
390 | <% resolved = todo_comment.resolved %> | |
391 | % if inline: |
|
391 | % if inline: | |
392 | <% outdated_at_ver = todo_comment.outdated_at_version(getattr(c, 'at_version_num', None)) %> |
|
392 | <% outdated_at_ver = todo_comment.outdated_at_version(getattr(c, 'at_version_num', None)) %> | |
393 | % else: |
|
393 | % else: | |
394 | <% outdated_at_ver = todo_comment.older_than_version(getattr(c, 'at_version_num', None)) %> |
|
394 | <% outdated_at_ver = todo_comment.older_than_version(getattr(c, 'at_version_num', None)) %> | |
395 | % endif |
|
395 | % endif | |
396 |
|
396 | |||
397 | <tr ${('class="unresolved-todo" style="display: none"' if resolved else '') |n}> |
|
397 | <tr ${('class="unresolved-todo" style="display: none"' if resolved else '') |n}> | |
398 |
|
398 | |||
399 | <td class="td-todo-number"> |
|
399 | <td class="td-todo-number"> | |
400 | % if resolved: |
|
400 | % if resolved: | |
401 | <a class="permalink todo-resolved tooltip" title="${_('Resolved by comment #{}').format(todo_comment.resolved.comment_id)}" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})"> |
|
401 | <a class="permalink todo-resolved tooltip" title="${_('Resolved by comment #{}').format(todo_comment.resolved.comment_id)}" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})"> | |
402 | <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a> |
|
402 | <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a> | |
403 | % else: |
|
403 | % else: | |
404 | <a class="permalink" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})"> |
|
404 | <a class="permalink" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})"> | |
405 | <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a> |
|
405 | <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a> | |
406 | % endif |
|
406 | % endif | |
407 | </td> |
|
407 | </td> | |
408 | <td class="td-todo-gravatar"> |
|
408 | <td class="td-todo-gravatar"> | |
409 | ${base.gravatar(todo_comment.author.email, 16, user=todo_comment.author, tooltip=True, extra_class=['no-margin'])} |
|
409 | ${base.gravatar(todo_comment.author.email, 16, user=todo_comment.author, tooltip=True, extra_class=['no-margin'])} | |
410 | </td> |
|
410 | </td> | |
411 | <td class="todo-comment-text-wrapper"> |
|
411 | <td class="todo-comment-text-wrapper"> | |
412 | <div class="todo-comment-text"> |
|
412 | <div class="todo-comment-text"> | |
413 | <code>${h.chop_at_smart(todo_comment.text, '\n', suffix_if_chopped='...')}</code> |
|
413 | <code>${h.chop_at_smart(todo_comment.text, '\n', suffix_if_chopped='...')}</code> | |
414 | </div> |
|
414 | </div> | |
415 | </td> |
|
415 | </td> | |
416 |
|
416 | |||
417 | </tr> |
|
417 | </tr> | |
418 | % endfor |
|
418 | % endfor | |
419 |
|
419 | |||
420 | % if len(c.unresolved_comments) == 0: |
|
420 | % if len(c.unresolved_comments) == 0: | |
421 | <tr> |
|
421 | <tr> | |
422 | <td class="unresolved-todo-text">${_('No unresolved TODOs')}.</td> |
|
422 | <td class="unresolved-todo-text">${_('No unresolved TODOs')}.</td> | |
423 | </tr> |
|
423 | </tr> | |
424 | % endif |
|
424 | % endif | |
425 |
|
425 | |||
426 | % endif |
|
426 | % endif | |
427 |
|
427 | |||
428 | </table> |
|
428 | </table> | |
429 |
|
429 | |||
430 | </div> |
|
430 | </div> | |
431 | </div> |
|
431 | </div> | |
432 |
|
432 | |||
433 | </div> |
|
433 | </div> | |
434 |
|
434 | |||
435 | <div class="box"> |
|
435 | <div class="box"> | |
436 |
|
436 | |||
437 | % if c.state_progressing: |
|
437 | % if c.state_progressing: | |
438 |
|
438 | |||
439 | <h2 style="text-align: center"> |
|
439 | <h2 style="text-align: center"> | |
440 | ${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span> |
|
440 | ${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span> | |
441 |
|
441 | |||
442 | % if c.is_super_admin: |
|
442 | % if c.is_super_admin: | |
443 | <br/> |
|
443 | <br/> | |
444 | If you think this is an error try <a href="${h.current_route_path(request, force_state='created')}">forced state reset</a> to <span class="tag tag-merge-state-created">created</span> state. |
|
444 | If you think this is an error try <a href="${h.current_route_path(request, force_state='created')}">forced state reset</a> to <span class="tag tag-merge-state-created">created</span> state. | |
445 | % endif |
|
445 | % endif | |
446 | </h2> |
|
446 | </h2> | |
447 |
|
447 | |||
448 | % else: |
|
448 | % else: | |
449 |
|
449 | |||
450 | ## Diffs rendered here |
|
450 | ## Diffs rendered here | |
451 | <div class="table" > |
|
451 | <div class="table" > | |
452 | <div id="changeset_compare_view_content"> |
|
452 | <div id="changeset_compare_view_content"> | |
453 | ##CS |
|
453 | ##CS | |
454 | % if c.missing_requirements: |
|
454 | % if c.missing_requirements: | |
455 | <div class="box"> |
|
455 | <div class="box"> | |
456 | <div class="alert alert-warning"> |
|
456 | <div class="alert alert-warning"> | |
457 | <div> |
|
457 | <div> | |
458 | <strong>${_('Missing requirements:')}</strong> |
|
458 | <strong>${_('Missing requirements:')}</strong> | |
459 | ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')} |
|
459 | ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')} | |
460 | </div> |
|
460 | </div> | |
461 | </div> |
|
461 | </div> | |
462 | </div> |
|
462 | </div> | |
463 | % elif c.missing_commits: |
|
463 | % elif c.missing_commits: | |
464 | <div class="box"> |
|
464 | <div class="box"> | |
465 | <div class="alert alert-warning"> |
|
465 | <div class="alert alert-warning"> | |
466 | <div> |
|
466 | <div> | |
467 | <strong>${_('Missing commits')}:</strong> |
|
467 | <strong>${_('Missing commits')}:</strong> | |
468 | ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')} |
|
468 | ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')} | |
469 | ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')} |
|
469 | ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')} | |
470 | ${_('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} |
|
470 | ${_('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} | |
471 | </div> |
|
471 | </div> | |
472 | </div> |
|
472 | </div> | |
473 | </div> |
|
473 | </div> | |
474 | % elif c.pr_merge_source_commit.changed: |
|
474 | % elif c.pr_merge_source_commit.changed and not c.pull_request.is_closed(): | |
475 | <div class="box"> |
|
475 | <div class="box"> | |
476 | <div class="alert alert-info"> |
|
476 | <div class="alert alert-info"> | |
477 | <div> |
|
477 | <div> | |
478 | % if c.pr_merge_source_commit.changed: |
|
|||
479 | <strong>${_('There are new changes for `{}:{}` in source repository, please consider updating this pull request.').format(c.pr_merge_source_commit.ref_spec.type, c.pr_merge_source_commit.ref_spec.name)}</strong> |
|
478 | <strong>${_('There are new changes for `{}:{}` in source repository, please consider updating this pull request.').format(c.pr_merge_source_commit.ref_spec.type, c.pr_merge_source_commit.ref_spec.name)}</strong> | |
480 | % endif |
|
|||
481 | </div> |
|
479 | </div> | |
482 | </div> |
|
480 | </div> | |
483 | </div> |
|
481 | </div> | |
484 | % endif |
|
482 | % endif | |
485 |
|
483 | |||
486 | <div class="compare_view_commits_title"> |
|
484 | <div class="compare_view_commits_title"> | |
487 | % if not c.compare_mode: |
|
485 | % if not c.compare_mode: | |
488 |
|
486 | |||
489 | % if c.at_version_pos: |
|
487 | % if c.at_version_pos: | |
490 | <h4> |
|
488 | <h4> | |
491 | ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos} |
|
489 | ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos} | |
492 | </h4> |
|
490 | </h4> | |
493 | % endif |
|
491 | % endif | |
494 |
|
492 | |||
495 | <div class="pull-left"> |
|
493 | <div class="pull-left"> | |
496 | <div class="btn-group"> |
|
494 | <div class="btn-group"> | |
497 | <a class="${('collapsed' if c.collapse_all_commits else '')}" href="#expand-commits" onclick="toggleCommitExpand(this); return false" data-toggle-commits-cnt=${len(c.commit_ranges)} > |
|
495 | <a class="${('collapsed' if c.collapse_all_commits else '')}" href="#expand-commits" onclick="toggleCommitExpand(this); return false" data-toggle-commits-cnt=${len(c.commit_ranges)} > | |
498 | % if c.collapse_all_commits: |
|
496 | % if c.collapse_all_commits: | |
499 | <i class="icon-plus-squared-alt icon-no-margin"></i> |
|
497 | <i class="icon-plus-squared-alt icon-no-margin"></i> | |
500 | ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))} |
|
498 | ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))} | |
501 | % else: |
|
499 | % else: | |
502 | <i class="icon-minus-squared-alt icon-no-margin"></i> |
|
500 | <i class="icon-minus-squared-alt icon-no-margin"></i> | |
503 | ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))} |
|
501 | ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))} | |
504 | % endif |
|
502 | % endif | |
505 | </a> |
|
503 | </a> | |
506 | </div> |
|
504 | </div> | |
507 | </div> |
|
505 | </div> | |
508 |
|
506 | |||
509 | <div class="pull-right"> |
|
507 | <div class="pull-right"> | |
510 | % if c.allowed_to_update and not c.pull_request.is_closed(): |
|
508 | % if c.allowed_to_update and not c.pull_request.is_closed(): | |
511 |
|
509 | |||
512 | <div class="btn-group btn-group-actions"> |
|
510 | <div class="btn-group btn-group-actions"> | |
513 | <a id="update_commits" class="btn btn-primary no-margin" onclick="updateController.updateCommits(this); return false"> |
|
511 | <a id="update_commits" class="btn btn-primary no-margin" onclick="updateController.updateCommits(this); return false"> | |
514 | ${_('Update commits')} |
|
512 | ${_('Update commits')} | |
515 | </a> |
|
513 | </a> | |
516 |
|
514 | |||
517 | <a id="update_commits_switcher" class="tooltip btn btn-primary" style="margin-left: -1px" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}"> |
|
515 | <a id="update_commits_switcher" class="tooltip btn btn-primary" style="margin-left: -1px" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}"> | |
518 | <i class="icon-down"></i> |
|
516 | <i class="icon-down"></i> | |
519 | </a> |
|
517 | </a> | |
520 |
|
518 | |||
521 | <div class="btn-action-switcher-container" id="update-commits-switcher"> |
|
519 | <div class="btn-action-switcher-container" id="update-commits-switcher"> | |
522 | <ul class="btn-action-switcher" role="menu"> |
|
520 | <ul class="btn-action-switcher" role="menu"> | |
523 | <li> |
|
521 | <li> | |
524 | <a href="#forceUpdate" onclick="updateController.forceUpdateCommits(this); return false"> |
|
522 | <a href="#forceUpdate" onclick="updateController.forceUpdateCommits(this); return false"> | |
525 | ${_('Force update commits')} |
|
523 | ${_('Force update commits')} | |
526 | </a> |
|
524 | </a> | |
527 | <div class="action-help-block"> |
|
525 | <div class="action-help-block"> | |
528 | ${_('Update commits and force refresh this pull request.')} |
|
526 | ${_('Update commits and force refresh this pull request.')} | |
529 | </div> |
|
527 | </div> | |
530 | </li> |
|
528 | </li> | |
531 | </ul> |
|
529 | </ul> | |
532 | </div> |
|
530 | </div> | |
533 | </div> |
|
531 | </div> | |
534 |
|
532 | |||
535 | % else: |
|
533 | % else: | |
536 | <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a> |
|
534 | <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a> | |
537 | % endif |
|
535 | % endif | |
538 |
|
536 | |||
539 | </div> |
|
537 | </div> | |
540 | % endif |
|
538 | % endif | |
541 | </div> |
|
539 | </div> | |
542 |
|
540 | |||
543 | % if not c.missing_commits: |
|
541 | % if not c.missing_commits: | |
544 | % if c.compare_mode: |
|
542 | % if c.compare_mode: | |
545 | % if c.at_version: |
|
543 | % if c.at_version: | |
546 | <h4> |
|
544 | <h4> | |
547 | ${_('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')}: |
|
545 | ${_('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')}: | |
548 | </h4> |
|
546 | </h4> | |
549 |
|
547 | |||
550 | <div class="subtitle-compare"> |
|
548 | <div class="subtitle-compare"> | |
551 | ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))} |
|
549 | ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))} | |
552 | </div> |
|
550 | </div> | |
553 |
|
551 | |||
554 | <div class="container"> |
|
552 | <div class="container"> | |
555 | <table class="rctable compare_view_commits"> |
|
553 | <table class="rctable compare_view_commits"> | |
556 | <tr> |
|
554 | <tr> | |
557 | <th></th> |
|
555 | <th></th> | |
558 | <th>${_('Time')}</th> |
|
556 | <th>${_('Time')}</th> | |
559 | <th>${_('Author')}</th> |
|
557 | <th>${_('Author')}</th> | |
560 | <th>${_('Commit')}</th> |
|
558 | <th>${_('Commit')}</th> | |
561 | <th></th> |
|
559 | <th></th> | |
562 | <th>${_('Description')}</th> |
|
560 | <th>${_('Description')}</th> | |
563 | </tr> |
|
561 | </tr> | |
564 |
|
562 | |||
565 | % for c_type, commit in c.commit_changes: |
|
563 | % for c_type, commit in c.commit_changes: | |
566 | % if c_type in ['a', 'r']: |
|
564 | % if c_type in ['a', 'r']: | |
567 | <% |
|
565 | <% | |
568 | if c_type == 'a': |
|
566 | if c_type == 'a': | |
569 | cc_title = _('Commit added in displayed changes') |
|
567 | cc_title = _('Commit added in displayed changes') | |
570 | elif c_type == 'r': |
|
568 | elif c_type == 'r': | |
571 | cc_title = _('Commit removed in displayed changes') |
|
569 | cc_title = _('Commit removed in displayed changes') | |
572 | else: |
|
570 | else: | |
573 | cc_title = '' |
|
571 | cc_title = '' | |
574 | %> |
|
572 | %> | |
575 | <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select"> |
|
573 | <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select"> | |
576 | <td> |
|
574 | <td> | |
577 | <div class="commit-change-indicator color-${c_type}-border"> |
|
575 | <div class="commit-change-indicator color-${c_type}-border"> | |
578 | <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}"> |
|
576 | <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}"> | |
579 | ${c_type.upper()} |
|
577 | ${c_type.upper()} | |
580 | </div> |
|
578 | </div> | |
581 | </div> |
|
579 | </div> | |
582 | </td> |
|
580 | </td> | |
583 | <td class="td-time"> |
|
581 | <td class="td-time"> | |
584 | ${h.age_component(commit.date)} |
|
582 | ${h.age_component(commit.date)} | |
585 | </td> |
|
583 | </td> | |
586 | <td class="td-user"> |
|
584 | <td class="td-user"> | |
587 | ${base.gravatar_with_user(commit.author, 16, tooltip=True)} |
|
585 | ${base.gravatar_with_user(commit.author, 16, tooltip=True)} | |
588 | </td> |
|
586 | </td> | |
589 | <td class="td-hash"> |
|
587 | <td class="td-hash"> | |
590 | <code> |
|
588 | <code> | |
591 | <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}"> |
|
589 | <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}"> | |
592 | r${commit.idx}:${h.short_id(commit.raw_id)} |
|
590 | r${commit.idx}:${h.short_id(commit.raw_id)} | |
593 | </a> |
|
591 | </a> | |
594 | ${h.hidden('revisions', commit.raw_id)} |
|
592 | ${h.hidden('revisions', commit.raw_id)} | |
595 | </code> |
|
593 | </code> | |
596 | </td> |
|
594 | </td> | |
597 | <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false"> |
|
595 | <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false"> | |
598 | <i class="icon-expand-linked"></i> |
|
596 | <i class="icon-expand-linked"></i> | |
599 | </td> |
|
597 | </td> | |
600 | <td class="mid td-description"> |
|
598 | <td class="mid td-description"> | |
601 | <div class="log-container truncate-wrap"> |
|
599 | <div class="log-container truncate-wrap"> | |
602 | <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name)}</div> |
|
600 | <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name)}</div> | |
603 | </div> |
|
601 | </div> | |
604 | </td> |
|
602 | </td> | |
605 | </tr> |
|
603 | </tr> | |
606 | % endif |
|
604 | % endif | |
607 | % endfor |
|
605 | % endfor | |
608 | </table> |
|
606 | </table> | |
609 | </div> |
|
607 | </div> | |
610 |
|
608 | |||
611 | % endif |
|
609 | % endif | |
612 |
|
610 | |||
613 | % else: |
|
611 | % else: | |
614 | <%include file="/compare/compare_commits.mako" /> |
|
612 | <%include file="/compare/compare_commits.mako" /> | |
615 | % endif |
|
613 | % endif | |
616 |
|
614 | |||
617 | <div class="cs_files"> |
|
615 | <div class="cs_files"> | |
618 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> |
|
616 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> | |
619 | % if c.at_version: |
|
617 | % if c.at_version: | |
620 | <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['display']) %> |
|
618 | <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['display']) %> | |
621 | <% c.comments = c.comment_versions[c.at_version_num]['display'] %> |
|
619 | <% c.comments = c.comment_versions[c.at_version_num]['display'] %> | |
622 | % else: |
|
620 | % else: | |
623 | <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['until']) %> |
|
621 | <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['until']) %> | |
624 | <% c.comments = c.comment_versions[c.at_version_num]['until'] %> |
|
622 | <% c.comments = c.comment_versions[c.at_version_num]['until'] %> | |
625 | % endif |
|
623 | % endif | |
626 |
|
624 | |||
627 | <% |
|
625 | <% | |
628 | pr_menu_data = { |
|
626 | pr_menu_data = { | |
629 | 'outdated_comm_count_ver': outdated_comm_count_ver |
|
627 | 'outdated_comm_count_ver': outdated_comm_count_ver | |
630 | } |
|
628 | } | |
631 | %> |
|
629 | %> | |
632 |
|
630 | |||
633 | ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on)} |
|
631 | ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on)} | |
634 |
|
632 | |||
635 | % if c.range_diff_on: |
|
633 | % if c.range_diff_on: | |
636 | % for commit in c.commit_ranges: |
|
634 | % for commit in c.commit_ranges: | |
637 | ${cbdiffs.render_diffset( |
|
635 | ${cbdiffs.render_diffset( | |
638 | c.changes[commit.raw_id], |
|
636 | c.changes[commit.raw_id], | |
639 | commit=commit, use_comments=True, |
|
637 | commit=commit, use_comments=True, | |
640 | collapse_when_files_over=5, |
|
638 | collapse_when_files_over=5, | |
641 | disable_new_comments=True, |
|
639 | disable_new_comments=True, | |
642 | deleted_files_comments=c.deleted_files_comments, |
|
640 | deleted_files_comments=c.deleted_files_comments, | |
643 | inline_comments=c.inline_comments, |
|
641 | inline_comments=c.inline_comments, | |
644 | pull_request_menu=pr_menu_data, show_todos=False)} |
|
642 | pull_request_menu=pr_menu_data, show_todos=False)} | |
645 | % endfor |
|
643 | % endfor | |
646 | % else: |
|
644 | % else: | |
647 | ${cbdiffs.render_diffset( |
|
645 | ${cbdiffs.render_diffset( | |
648 | c.diffset, use_comments=True, |
|
646 | c.diffset, use_comments=True, | |
649 | collapse_when_files_over=30, |
|
647 | collapse_when_files_over=30, | |
650 | disable_new_comments=not c.allowed_to_comment, |
|
648 | disable_new_comments=not c.allowed_to_comment, | |
651 | deleted_files_comments=c.deleted_files_comments, |
|
649 | deleted_files_comments=c.deleted_files_comments, | |
652 | inline_comments=c.inline_comments, |
|
650 | inline_comments=c.inline_comments, | |
653 | pull_request_menu=pr_menu_data, show_todos=False)} |
|
651 | pull_request_menu=pr_menu_data, show_todos=False)} | |
654 | % endif |
|
652 | % endif | |
655 |
|
653 | |||
656 | </div> |
|
654 | </div> | |
657 | % else: |
|
655 | % else: | |
658 | ## skipping commits we need to clear the view for missing commits |
|
656 | ## skipping commits we need to clear the view for missing commits | |
659 | <div style="clear:both;"></div> |
|
657 | <div style="clear:both;"></div> | |
660 | % endif |
|
658 | % endif | |
661 |
|
659 | |||
662 | </div> |
|
660 | </div> | |
663 | </div> |
|
661 | </div> | |
664 |
|
662 | |||
665 | ## template for inline comment form |
|
663 | ## template for inline comment form | |
666 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
664 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> | |
667 |
|
665 | |||
668 | ## comments heading with count |
|
666 | ## comments heading with count | |
669 | <div class="comments-heading"> |
|
667 | <div class="comments-heading"> | |
670 | <i class="icon-comment"></i> |
|
668 | <i class="icon-comment"></i> | |
671 | ${_('Comments')} ${len(c.comments)} |
|
669 | ${_('Comments')} ${len(c.comments)} | |
672 | </div> |
|
670 | </div> | |
673 |
|
671 | |||
674 | ## render general comments |
|
672 | ## render general comments | |
675 | <div id="comment-tr-show"> |
|
673 | <div id="comment-tr-show"> | |
676 | % if general_outdated_comm_count_ver: |
|
674 | % if general_outdated_comm_count_ver: | |
677 | <div class="info-box"> |
|
675 | <div class="info-box"> | |
678 | % if general_outdated_comm_count_ver == 1: |
|
676 | % if general_outdated_comm_count_ver == 1: | |
679 | ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)}, |
|
677 | ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)}, | |
680 | <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a> |
|
678 | <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a> | |
681 | % else: |
|
679 | % else: | |
682 | ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)}, |
|
680 | ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)}, | |
683 | <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a> |
|
681 | <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a> | |
684 | % endif |
|
682 | % endif | |
685 | </div> |
|
683 | </div> | |
686 | % endif |
|
684 | % endif | |
687 | </div> |
|
685 | </div> | |
688 |
|
686 | |||
689 | ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)} |
|
687 | ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)} | |
690 |
|
688 | |||
691 | % if not c.pull_request.is_closed(): |
|
689 | % if not c.pull_request.is_closed(): | |
692 | ## main comment form and it status |
|
690 | ## main comment form and it status | |
693 | ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name, |
|
691 | ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name, | |
694 | pull_request_id=c.pull_request.pull_request_id), |
|
692 | pull_request_id=c.pull_request.pull_request_id), | |
695 | c.pull_request_review_status, |
|
693 | c.pull_request_review_status, | |
696 | is_pull_request=True, change_status=c.allowed_to_change_status)} |
|
694 | is_pull_request=True, change_status=c.allowed_to_change_status)} | |
697 |
|
695 | |||
698 | ## merge status, and merge action |
|
696 | ## merge status, and merge action | |
699 | <div class="pull-request-merge"> |
|
697 | <div class="pull-request-merge"> | |
700 | <%include file="/pullrequests/pullrequest_merge_checks.mako"/> |
|
698 | <%include file="/pullrequests/pullrequest_merge_checks.mako"/> | |
701 | </div> |
|
699 | </div> | |
702 |
|
700 | |||
703 | %endif |
|
701 | %endif | |
704 |
|
702 | |||
705 | % endif |
|
703 | % endif | |
706 | </div> |
|
704 | </div> | |
707 |
|
705 | |||
708 | <script type="text/javascript"> |
|
706 | <script type="text/javascript"> | |
709 |
|
707 | |||
710 | versionController = new VersionController(); |
|
708 | versionController = new VersionController(); | |
711 | versionController.init(); |
|
709 | versionController.init(); | |
712 |
|
710 | |||
713 | reviewersController = new ReviewersController(); |
|
711 | reviewersController = new ReviewersController(); | |
714 | commitsController = new CommitsController(); |
|
712 | commitsController = new CommitsController(); | |
715 |
|
713 | |||
716 | updateController = new UpdatePrController(); |
|
714 | updateController = new UpdatePrController(); | |
717 |
|
715 | |||
718 | $(function () { |
|
716 | $(function () { | |
719 |
|
717 | |||
720 | // custom code mirror |
|
718 | // custom code mirror | |
721 | var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm; |
|
719 | var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm; | |
722 |
|
720 | |||
723 | var PRDetails = { |
|
721 | var PRDetails = { | |
724 | editButton: $('#open_edit_pullrequest'), |
|
722 | editButton: $('#open_edit_pullrequest'), | |
725 | closeButton: $('#close_edit_pullrequest'), |
|
723 | closeButton: $('#close_edit_pullrequest'), | |
726 | deleteButton: $('#delete_pullrequest'), |
|
724 | deleteButton: $('#delete_pullrequest'), | |
727 | viewFields: $('#pr-desc, #pr-title'), |
|
725 | viewFields: $('#pr-desc, #pr-title'), | |
728 | editFields: $('#pr-desc-edit, #pr-title-edit, .pr-save'), |
|
726 | editFields: $('#pr-desc-edit, #pr-title-edit, .pr-save'), | |
729 |
|
727 | |||
730 | init: function () { |
|
728 | init: function () { | |
731 | var that = this; |
|
729 | var that = this; | |
732 | this.editButton.on('click', function (e) { |
|
730 | this.editButton.on('click', function (e) { | |
733 | that.edit(); |
|
731 | that.edit(); | |
734 | }); |
|
732 | }); | |
735 | this.closeButton.on('click', function (e) { |
|
733 | this.closeButton.on('click', function (e) { | |
736 | that.view(); |
|
734 | that.view(); | |
737 | }); |
|
735 | }); | |
738 | }, |
|
736 | }, | |
739 |
|
737 | |||
740 | edit: function (event) { |
|
738 | edit: function (event) { | |
741 | this.viewFields.hide(); |
|
739 | this.viewFields.hide(); | |
742 | this.editButton.hide(); |
|
740 | this.editButton.hide(); | |
743 | this.deleteButton.hide(); |
|
741 | this.deleteButton.hide(); | |
744 | this.closeButton.show(); |
|
742 | this.closeButton.show(); | |
745 | this.editFields.show(); |
|
743 | this.editFields.show(); | |
746 | codeMirrorInstance.refresh(); |
|
744 | codeMirrorInstance.refresh(); | |
747 | }, |
|
745 | }, | |
748 |
|
746 | |||
749 | view: function (event) { |
|
747 | view: function (event) { | |
750 | this.editButton.show(); |
|
748 | this.editButton.show(); | |
751 | this.deleteButton.show(); |
|
749 | this.deleteButton.show(); | |
752 | this.editFields.hide(); |
|
750 | this.editFields.hide(); | |
753 | this.closeButton.hide(); |
|
751 | this.closeButton.hide(); | |
754 | this.viewFields.show(); |
|
752 | this.viewFields.show(); | |
755 | } |
|
753 | } | |
756 | }; |
|
754 | }; | |
757 |
|
755 | |||
758 | var ReviewersPanel = { |
|
756 | var ReviewersPanel = { | |
759 | editButton: $('#open_edit_reviewers'), |
|
757 | editButton: $('#open_edit_reviewers'), | |
760 | closeButton: $('#close_edit_reviewers'), |
|
758 | closeButton: $('#close_edit_reviewers'), | |
761 | addButton: $('#add_reviewer'), |
|
759 | addButton: $('#add_reviewer'), | |
762 | removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'), |
|
760 | removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'), | |
763 |
|
761 | |||
764 | init: function () { |
|
762 | init: function () { | |
765 | var self = this; |
|
763 | var self = this; | |
766 | this.editButton.on('click', function (e) { |
|
764 | this.editButton.on('click', function (e) { | |
767 | self.edit(); |
|
765 | self.edit(); | |
768 | }); |
|
766 | }); | |
769 | this.closeButton.on('click', function (e) { |
|
767 | this.closeButton.on('click', function (e) { | |
770 | self.close(); |
|
768 | self.close(); | |
771 | }); |
|
769 | }); | |
772 | }, |
|
770 | }, | |
773 |
|
771 | |||
774 | edit: function (event) { |
|
772 | edit: function (event) { | |
775 | this.editButton.hide(); |
|
773 | this.editButton.hide(); | |
776 | this.closeButton.show(); |
|
774 | this.closeButton.show(); | |
777 | this.addButton.show(); |
|
775 | this.addButton.show(); | |
778 | this.removeButtons.css('visibility', 'visible'); |
|
776 | this.removeButtons.css('visibility', 'visible'); | |
779 | // review rules |
|
777 | // review rules | |
780 | reviewersController.loadReviewRules( |
|
778 | reviewersController.loadReviewRules( | |
781 | ${c.pull_request.reviewer_data_json | n}); |
|
779 | ${c.pull_request.reviewer_data_json | n}); | |
782 | }, |
|
780 | }, | |
783 |
|
781 | |||
784 | close: function (event) { |
|
782 | close: function (event) { | |
785 | this.editButton.show(); |
|
783 | this.editButton.show(); | |
786 | this.closeButton.hide(); |
|
784 | this.closeButton.hide(); | |
787 | this.addButton.hide(); |
|
785 | this.addButton.hide(); | |
788 | this.removeButtons.css('visibility', 'hidden'); |
|
786 | this.removeButtons.css('visibility', 'hidden'); | |
789 | // hide review rules |
|
787 | // hide review rules | |
790 | reviewersController.hideReviewRules() |
|
788 | reviewersController.hideReviewRules() | |
791 | } |
|
789 | } | |
792 | }; |
|
790 | }; | |
793 |
|
791 | |||
794 | PRDetails.init(); |
|
792 | PRDetails.init(); | |
795 | ReviewersPanel.init(); |
|
793 | ReviewersPanel.init(); | |
796 |
|
794 | |||
797 | showOutdated = function (self) { |
|
795 | showOutdated = function (self) { | |
798 | $('.comment-inline.comment-outdated').show(); |
|
796 | $('.comment-inline.comment-outdated').show(); | |
799 | $('.filediff-outdated').show(); |
|
797 | $('.filediff-outdated').show(); | |
800 | $('.showOutdatedComments').hide(); |
|
798 | $('.showOutdatedComments').hide(); | |
801 | $('.hideOutdatedComments').show(); |
|
799 | $('.hideOutdatedComments').show(); | |
802 | }; |
|
800 | }; | |
803 |
|
801 | |||
804 | hideOutdated = function (self) { |
|
802 | hideOutdated = function (self) { | |
805 | $('.comment-inline.comment-outdated').hide(); |
|
803 | $('.comment-inline.comment-outdated').hide(); | |
806 | $('.filediff-outdated').hide(); |
|
804 | $('.filediff-outdated').hide(); | |
807 | $('.hideOutdatedComments').hide(); |
|
805 | $('.hideOutdatedComments').hide(); | |
808 | $('.showOutdatedComments').show(); |
|
806 | $('.showOutdatedComments').show(); | |
809 | }; |
|
807 | }; | |
810 |
|
808 | |||
811 | refreshMergeChecks = function () { |
|
809 | refreshMergeChecks = function () { | |
812 | var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}"; |
|
810 | var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}"; | |
813 | $('.pull-request-merge').css('opacity', 0.3); |
|
811 | $('.pull-request-merge').css('opacity', 0.3); | |
814 | $('.action-buttons-extra').css('opacity', 0.3); |
|
812 | $('.action-buttons-extra').css('opacity', 0.3); | |
815 |
|
813 | |||
816 | $('.pull-request-merge').load( |
|
814 | $('.pull-request-merge').load( | |
817 | loadUrl, function () { |
|
815 | loadUrl, function () { | |
818 | $('.pull-request-merge').css('opacity', 1); |
|
816 | $('.pull-request-merge').css('opacity', 1); | |
819 |
|
817 | |||
820 | $('.action-buttons-extra').css('opacity', 1); |
|
818 | $('.action-buttons-extra').css('opacity', 1); | |
821 | } |
|
819 | } | |
822 | ); |
|
820 | ); | |
823 | }; |
|
821 | }; | |
824 |
|
822 | |||
825 | closePullRequest = function (status) { |
|
823 | closePullRequest = function (status) { | |
826 | if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) { |
|
824 | if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) { | |
827 | return false; |
|
825 | return false; | |
828 | } |
|
826 | } | |
829 | // inject closing flag |
|
827 | // inject closing flag | |
830 | $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">'); |
|
828 | $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">'); | |
831 | $(generalCommentForm.statusChange).select2("val", status).trigger('change'); |
|
829 | $(generalCommentForm.statusChange).select2("val", status).trigger('change'); | |
832 | $(generalCommentForm.submitForm).submit(); |
|
830 | $(generalCommentForm.submitForm).submit(); | |
833 | }; |
|
831 | }; | |
834 |
|
832 | |||
835 | $('#show-outdated-comments').on('click', function (e) { |
|
833 | $('#show-outdated-comments').on('click', function (e) { | |
836 | var button = $(this); |
|
834 | var button = $(this); | |
837 | var outdated = $('.comment-outdated'); |
|
835 | var outdated = $('.comment-outdated'); | |
838 |
|
836 | |||
839 | if (button.html() === "(Show)") { |
|
837 | if (button.html() === "(Show)") { | |
840 | button.html("(Hide)"); |
|
838 | button.html("(Hide)"); | |
841 | outdated.show(); |
|
839 | outdated.show(); | |
842 | } else { |
|
840 | } else { | |
843 | button.html("(Show)"); |
|
841 | button.html("(Show)"); | |
844 | outdated.hide(); |
|
842 | outdated.hide(); | |
845 | } |
|
843 | } | |
846 | }); |
|
844 | }); | |
847 |
|
845 | |||
848 | $('.show-inline-comments').on('change', function (e) { |
|
846 | $('.show-inline-comments').on('change', function (e) { | |
849 | var show = 'none'; |
|
847 | var show = 'none'; | |
850 | var target = e.currentTarget; |
|
848 | var target = e.currentTarget; | |
851 | if (target.checked) { |
|
849 | if (target.checked) { | |
852 | show = '' |
|
850 | show = '' | |
853 | } |
|
851 | } | |
854 | var boxid = $(target).attr('id_for'); |
|
852 | var boxid = $(target).attr('id_for'); | |
855 | var comments = $('#{0} .inline-comments'.format(boxid)); |
|
853 | var comments = $('#{0} .inline-comments'.format(boxid)); | |
856 | var fn_display = function (idx) { |
|
854 | var fn_display = function (idx) { | |
857 | $(this).css('display', show); |
|
855 | $(this).css('display', show); | |
858 | }; |
|
856 | }; | |
859 | $(comments).each(fn_display); |
|
857 | $(comments).each(fn_display); | |
860 | var btns = $('#{0} .inline-comments-button'.format(boxid)); |
|
858 | var btns = $('#{0} .inline-comments-button'.format(boxid)); | |
861 | $(btns).each(fn_display); |
|
859 | $(btns).each(fn_display); | |
862 | }); |
|
860 | }); | |
863 |
|
861 | |||
864 | $('#merge_pull_request_form').submit(function () { |
|
862 | $('#merge_pull_request_form').submit(function () { | |
865 | if (!$('#merge_pull_request').attr('disabled')) { |
|
863 | if (!$('#merge_pull_request').attr('disabled')) { | |
866 | $('#merge_pull_request').attr('disabled', 'disabled'); |
|
864 | $('#merge_pull_request').attr('disabled', 'disabled'); | |
867 | } |
|
865 | } | |
868 | return true; |
|
866 | return true; | |
869 | }); |
|
867 | }); | |
870 |
|
868 | |||
871 | $('#edit_pull_request').on('click', function (e) { |
|
869 | $('#edit_pull_request').on('click', function (e) { | |
872 | var title = $('#pr-title-input').val(); |
|
870 | var title = $('#pr-title-input').val(); | |
873 | var description = codeMirrorInstance.getValue(); |
|
871 | var description = codeMirrorInstance.getValue(); | |
874 | var renderer = $('#pr-renderer-input').val(); |
|
872 | var renderer = $('#pr-renderer-input').val(); | |
875 | editPullRequest( |
|
873 | editPullRequest( | |
876 | "${c.repo_name}", "${c.pull_request.pull_request_id}", |
|
874 | "${c.repo_name}", "${c.pull_request.pull_request_id}", | |
877 | title, description, renderer); |
|
875 | title, description, renderer); | |
878 | }); |
|
876 | }); | |
879 |
|
877 | |||
880 | $('#update_pull_request').on('click', function (e) { |
|
878 | $('#update_pull_request').on('click', function (e) { | |
881 | $(this).attr('disabled', 'disabled'); |
|
879 | $(this).attr('disabled', 'disabled'); | |
882 | $(this).addClass('disabled'); |
|
880 | $(this).addClass('disabled'); | |
883 | $(this).html(_gettext('Saving...')); |
|
881 | $(this).html(_gettext('Saving...')); | |
884 | reviewersController.updateReviewers( |
|
882 | reviewersController.updateReviewers( | |
885 | "${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
883 | "${c.repo_name}", "${c.pull_request.pull_request_id}"); | |
886 | }); |
|
884 | }); | |
887 |
|
885 | |||
888 |
|
886 | |||
889 | // fixing issue with caches on firefox |
|
887 | // fixing issue with caches on firefox | |
890 | $('#update_commits').removeAttr("disabled"); |
|
888 | $('#update_commits').removeAttr("disabled"); | |
891 |
|
889 | |||
892 | $('.show-inline-comments').on('click', function (e) { |
|
890 | $('.show-inline-comments').on('click', function (e) { | |
893 | var boxid = $(this).attr('data-comment-id'); |
|
891 | var boxid = $(this).attr('data-comment-id'); | |
894 | var button = $(this); |
|
892 | var button = $(this); | |
895 |
|
893 | |||
896 | if (button.hasClass("comments-visible")) { |
|
894 | if (button.hasClass("comments-visible")) { | |
897 | $('#{0} .inline-comments'.format(boxid)).each(function (index) { |
|
895 | $('#{0} .inline-comments'.format(boxid)).each(function (index) { | |
898 | $(this).hide(); |
|
896 | $(this).hide(); | |
899 | }); |
|
897 | }); | |
900 | button.removeClass("comments-visible"); |
|
898 | button.removeClass("comments-visible"); | |
901 | } else { |
|
899 | } else { | |
902 | $('#{0} .inline-comments'.format(boxid)).each(function (index) { |
|
900 | $('#{0} .inline-comments'.format(boxid)).each(function (index) { | |
903 | $(this).show(); |
|
901 | $(this).show(); | |
904 | }); |
|
902 | }); | |
905 | button.addClass("comments-visible"); |
|
903 | button.addClass("comments-visible"); | |
906 | } |
|
904 | } | |
907 | }); |
|
905 | }); | |
908 |
|
906 | |||
909 | // register submit callback on commentForm form to track TODOs |
|
907 | // register submit callback on commentForm form to track TODOs | |
910 | window.commentFormGlobalSubmitSuccessCallback = function () { |
|
908 | window.commentFormGlobalSubmitSuccessCallback = function () { | |
911 | refreshMergeChecks(); |
|
909 | refreshMergeChecks(); | |
912 | }; |
|
910 | }; | |
913 |
|
911 | |||
914 | ReviewerAutoComplete('#user'); |
|
912 | ReviewerAutoComplete('#user'); | |
915 |
|
913 | |||
916 | }) |
|
914 | }) | |
917 |
|
915 | |||
918 | </script> |
|
916 | </script> | |
919 |
|
917 | |||
920 | </div> |
|
918 | </div> | |
921 |
|
919 | |||
922 | </%def> |
|
920 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now