Show More
@@ -77,6 +77,7 b' class RepoCommitsView(RepoAppView):' | |||||
77 | _ = self.request.translate |
|
77 | _ = self.request.translate | |
78 | c = self.load_default_context() |
|
78 | c = self.load_default_context() | |
79 | c.fulldiff = self.request.GET.get('fulldiff') |
|
79 | c.fulldiff = self.request.GET.get('fulldiff') | |
|
80 | redirect_to_combined = str2bool(self.request.GET.get('redirect_combined')) | |||
80 |
|
81 | |||
81 | # fetch global flags of ignore ws or context lines |
|
82 | # fetch global flags of ignore ws or context lines | |
82 | diff_context = get_diff_context(self.request) |
|
83 | diff_context = get_diff_context(self.request) | |
@@ -117,6 +118,19 b' class RepoCommitsView(RepoAppView):' | |||||
117 | raise HTTPNotFound() |
|
118 | raise HTTPNotFound() | |
118 | single_commit = len(c.commit_ranges) == 1 |
|
119 | single_commit = len(c.commit_ranges) == 1 | |
119 |
|
120 | |||
|
121 | if redirect_to_combined and not single_commit: | |||
|
122 | source_ref = getattr(c.commit_ranges[0].parents[0] | |||
|
123 | if c.commit_ranges[0].parents else h.EmptyCommit(), 'raw_id') | |||
|
124 | target_ref = c.commit_ranges[-1].raw_id | |||
|
125 | next_url = h.route_path( | |||
|
126 | 'repo_compare', | |||
|
127 | repo_name=c.repo_name, | |||
|
128 | source_ref_type='rev', | |||
|
129 | source_ref=source_ref, | |||
|
130 | target_ref_type='rev', | |||
|
131 | target_ref=target_ref) | |||
|
132 | raise HTTPFound(next_url) | |||
|
133 | ||||
120 | c.changes = OrderedDict() |
|
134 | c.changes = OrderedDict() | |
121 | c.lines_added = 0 |
|
135 | c.lines_added = 0 | |
122 | c.lines_deleted = 0 |
|
136 | c.lines_deleted = 0 |
@@ -1140,9 +1140,8 b' label {' | |||||
1140 | margin-left: -15px; |
|
1140 | margin-left: -15px; | |
1141 | } |
|
1141 | } | |
1142 |
|
1142 | |||
1143 | #rev_range_container, #rev_range_clear, #rev_range_more { |
|
1143 | #rev_range_action { | |
1144 |
|
|
1144 | margin-bottom: -8px; | |
1145 | margin-bottom: -5px; |
|
|||
1146 | } |
|
1145 | } | |
1147 |
|
1146 | |||
1148 | #filter_changelog { |
|
1147 | #filter_changelog { |
@@ -108,7 +108,26 b'' | |||||
108 | <i class="icon-cancel-circled2"></i> |
|
108 | <i class="icon-cancel-circled2"></i> | |
109 | </div> |
|
109 | </div> | |
110 | <div class="btn btn-sm disabled" disabled="disabled" id="rev_range_more" style="display:none;">${_('Select second commit')}</div> |
|
110 | <div class="btn btn-sm disabled" disabled="disabled" id="rev_range_more" style="display:none;">${_('Select second commit')}</div> | |
111 | <a href="#" class="btn btn-success btn-sm" id="rev_range_container" style="display:none;"></a> |
|
111 | ||
|
112 | <div id="rev_range_action" class="btn-group btn-group-actions" style="display:none;"> | |||
|
113 | <a href="#" class="btn btn-success btn-sm" id="rev_range_container" style="display:none;"></a> | |||
|
114 | ||||
|
115 | <a class="btn btn-success btn-sm btn-more-option" data-toggle="dropdown" aria-pressed="false" role="button"> | |||
|
116 | <i class="icon-down"></i> | |||
|
117 | </a> | |||
|
118 | ||||
|
119 | <div class="btn-action-switcher-container right-align"> | |||
|
120 | <ul class="btn-action-switcher" role="menu" style="min-width: 220px; width: max-content"> | |||
|
121 | <li> | |||
|
122 | ## JS fills the URL | |||
|
123 | <a id="rev_range_combined_url" class="btn btn-primary btn-sm" href=""> | |||
|
124 | ${_('Show combined diff')} | |||
|
125 | </a> | |||
|
126 | </li> | |||
|
127 | </ul> | |||
|
128 | </div> | |||
|
129 | </div> | |||
|
130 | ||||
112 | </th> |
|
131 | </th> | |
113 |
|
132 | |||
114 | ## commit message expand arrow |
|
133 | ## commit message expand arrow | |
@@ -147,6 +166,9 b'' | |||||
147 | var $commitRangeMore = $('#rev_range_more'); |
|
166 | var $commitRangeMore = $('#rev_range_more'); | |
148 | var $commitRangeContainer = $('#rev_range_container'); |
|
167 | var $commitRangeContainer = $('#rev_range_container'); | |
149 | var $commitRangeClear = $('#rev_range_clear'); |
|
168 | var $commitRangeClear = $('#rev_range_clear'); | |
|
169 | var $commitRangeAction = $('#rev_range_action'); | |||
|
170 | var $commitRangeCombinedUrl = $('#rev_range_combined_url'); | |||
|
171 | var $compareFork = $('#compare_fork_button'); | |||
150 |
|
172 | |||
151 | var checkboxRangeSelector = function(e){ |
|
173 | var checkboxRangeSelector = function(e){ | |
152 | var selectedCheckboxes = []; |
|
174 | var selectedCheckboxes = []; | |
@@ -169,9 +191,8 b'' | |||||
169 | } |
|
191 | } | |
170 |
|
192 | |||
171 | if (selectedCheckboxes.length > 0) { |
|
193 | if (selectedCheckboxes.length > 0) { | |
172 |
$ |
|
194 | $compareFork.hide(); | |
173 | var commitStart = $(selectedCheckboxes[selectedCheckboxes.length-1]).data(); |
|
195 | var commitStart = $(selectedCheckboxes[selectedCheckboxes.length-1]).data(); | |
174 |
|
||||
175 | var revStart = commitStart.commitId; |
|
196 | var revStart = commitStart.commitId; | |
176 |
|
197 | |||
177 | var commitEnd = $(selectedCheckboxes[0]).data(); |
|
198 | var commitEnd = $(selectedCheckboxes[0]).data(); | |
@@ -181,7 +202,9 b'' | |||||
181 | var lbl_end = '{0}'.format(commitEnd.commitIdx, commitEnd.shortId); |
|
202 | var lbl_end = '{0}'.format(commitEnd.commitIdx, commitEnd.shortId); | |
182 |
|
203 | |||
183 | var url = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}', 'commit_id': revStart+'...'+revEnd}); |
|
204 | var url = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}', 'commit_id': revStart+'...'+revEnd}); | |
184 | var link = _gettext('Show commit range {0} ... {1}').format(lbl_start, lbl_end); |
|
205 | var urlCombined = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}', 'commit_id': revStart+'...'+revEnd, 'redirect_combined': '1'}); | |
|
206 | ||||
|
207 | var link = _gettext('Show commit range {0}<i class="icon-angle-right"></i>{1}').format(lbl_start, lbl_end); | |||
185 |
|
208 | |||
186 | if (selectedCheckboxes.length > 1) { |
|
209 | if (selectedCheckboxes.length > 1) { | |
187 | $commitRangeClear.show(); |
|
210 | $commitRangeClear.show(); | |
@@ -192,9 +215,12 b'' | |||||
192 | .html(link) |
|
215 | .html(link) | |
193 | .show(); |
|
216 | .show(); | |
194 |
|
217 | |||
|
218 | $commitRangeCombinedUrl.attr('href', urlCombined); | |||
|
219 | $commitRangeAction.show(); | |||
195 |
|
220 | |||
196 | } else { |
|
221 | } else { | |
197 | $commitRangeContainer.hide(); |
|
222 | $commitRangeContainer.hide(); | |
|
223 | $commitRangeAction.hide(); | |||
198 | $commitRangeClear.show(); |
|
224 | $commitRangeClear.show(); | |
199 | $commitRangeMore.show(); |
|
225 | $commitRangeMore.show(); | |
200 | } |
|
226 | } | |
@@ -212,6 +238,7 b'' | |||||
212 | $commitRangeContainer.hide(); |
|
238 | $commitRangeContainer.hide(); | |
213 | $commitRangeClear.hide(); |
|
239 | $commitRangeClear.hide(); | |
214 | $commitRangeMore.hide(); |
|
240 | $commitRangeMore.hide(); | |
|
241 | $commitRangeAction.hide(); | |||
215 |
|
242 | |||
216 | %if c.branch_name: |
|
243 | %if c.branch_name: | |
217 | var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}', 'branch':'${c.branch_name}'}); |
|
244 | var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}', 'branch':'${c.branch_name}'}); | |
@@ -220,7 +247,7 b'' | |||||
220 | var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}'}); |
|
247 | var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}'}); | |
221 | open_new_pull_request.attr('href', _url); |
|
248 | open_new_pull_request.attr('href', _url); | |
222 | %endif |
|
249 | %endif | |
223 |
$ |
|
250 | $compareFork.show(); | |
224 | } |
|
251 | } | |
225 | }; |
|
252 | }; | |
226 |
|
253 |
General Comments 0
You need to be logged in to leave comments.
Login now