##// END OF EJS Templates
commits/ux: use similar as in files expand/collapse toggle.
marcink -
r4126:9f1311d3 default
parent child Browse files
Show More
@@ -82,7 +82,7 b' class TestSideBySideDiff(object):'
82
82
83 compare_page = ComparePage(response)
83 compare_page = ComparePage(response)
84 compare_page.contains_change_summary(*file_changes)
84 compare_page.contains_change_summary(*file_changes)
85 response.mustcontain('Expand 1 commit')
85 response.mustcontain('Collapse 1 commit')
86
86
87 def test_diff_sidebyside_two_commits(self, app, backend):
87 def test_diff_sidebyside_two_commits(self, app, backend):
88 commit_id_range = {
88 commit_id_range = {
@@ -122,7 +122,33 b' class TestSideBySideDiff(object):'
122 compare_page = ComparePage(response)
122 compare_page = ComparePage(response)
123 compare_page.contains_change_summary(*file_changes)
123 compare_page.contains_change_summary(*file_changes)
124
124
125 response.mustcontain('Expand 2 commits')
125 response.mustcontain('Collapse 2 commits')
126
127 def test_diff_sidebyside_collapsed_commits(self, app, backend_svn):
128 commit_id_range = {
129
130 'svn': {
131 'commits': ['330',
132 '337'],
133
134 },
135 }
136
137 commit_info = commit_id_range['svn']
138 commit2, commit1 = commit_info['commits']
139
140 response = self.app.get(route_path(
141 'repo_compare',
142 repo_name=backend_svn.repo_name,
143 source_ref_type='rev',
144 source_ref=commit2,
145 target_repo=backend_svn.repo_name,
146 target_ref_type='rev',
147 target_ref=commit1,
148 params=dict(target_repo=backend_svn.repo_name, diffmode='sidebyside')
149 ))
150
151 response.mustcontain('Expand 7 commits')
126
152
127 @pytest.mark.xfail(reason='GIT does not handle empty commit compare correct (missing 1 commit)')
153 @pytest.mark.xfail(reason='GIT does not handle empty commit compare correct (missing 1 commit)')
128 def test_diff_side_by_side_from_0_commit(self, app, backend, backend_stub):
154 def test_diff_side_by_side_from_0_commit(self, app, backend, backend_stub):
@@ -149,7 +175,7 b' class TestSideBySideDiff(object):'
149 params=dict(diffmode='sidebyside')
175 params=dict(diffmode='sidebyside')
150 ))
176 ))
151
177
152 response.mustcontain('Expand 2 commits')
178 response.mustcontain('Collapse 2 commits')
153 response.mustcontain('123 file changed')
179 response.mustcontain('123 file changed')
154
180
155 response.mustcontain(
181 response.mustcontain(
@@ -183,7 +209,7 b' class TestSideBySideDiff(object):'
183 params=dict(f_path=f_path, target_repo=repo.repo_name, diffmode='sidebyside')
209 params=dict(f_path=f_path, target_repo=repo.repo_name, diffmode='sidebyside')
184 ))
210 ))
185
211
186 response.mustcontain('Expand 2 commits')
212 response.mustcontain('Collapse 2 commits')
187 response.mustcontain('1 file changed')
213 response.mustcontain('1 file changed')
188
214
189 response.mustcontain(
215 response.mustcontain(
@@ -215,7 +241,7 b' class TestSideBySideDiff(object):'
215 params=dict(f_path=f_path, target_repo=repo.repo_name, diffmode='sidebyside')
241 params=dict(f_path=f_path, target_repo=repo.repo_name, diffmode='sidebyside')
216 ))
242 ))
217
243
218 response.mustcontain('Expand 2 commits')
244 response.mustcontain('Collapse 2 commits')
219 response.mustcontain('1 file changed')
245 response.mustcontain('1 file changed')
220
246
221 response.mustcontain(
247 response.mustcontain(
@@ -259,7 +285,7 b' class TestSideBySideDiff(object):'
259 params=dict(f_path=f_path, target_repo=backend.repo_name, diffmode='sidebyside')
285 params=dict(f_path=f_path, target_repo=backend.repo_name, diffmode='sidebyside')
260 ))
286 ))
261
287
262 response.mustcontain('Expand 2 commits')
288 response.mustcontain('Collapse 2 commits')
263
289
264 compare_page = ComparePage(response)
290 compare_page = ComparePage(response)
265 compare_page.contains_change_summary(*file_changes)
291 compare_page.contains_change_summary(*file_changes)
@@ -617,7 +617,7 b' class TestFilesDiff(object):'
617 })
617 })
618 # use redirect since this is OLD view redirecting to compare page
618 # use redirect since this is OLD view redirecting to compare page
619 response = response.follow()
619 response = response.follow()
620 response.mustcontain('Expand 1 commit')
620 response.mustcontain('Collapse 1 commit')
621 file_changes = (1, 0, 0)
621 file_changes = (1, 0, 0)
622
622
623 compare_page = ComparePage(response)
623 compare_page = ComparePage(response)
@@ -83,17 +83,14 b''
83 <div id="changeset_compare_view_content">
83 <div id="changeset_compare_view_content">
84 <div class="pull-left">
84 <div class="pull-left">
85 <div class="btn-group">
85 <div class="btn-group">
86 <a
86 <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)} >
87 class="btn"
87 % if c.collapse_all_commits:
88 href="#"
88 <i class="icon-plus-squared-alt icon-no-margin"></i>
89 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
89 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
90 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
90 % else:
91 </a>
91 <i class="icon-minus-squared-alt icon-no-margin"></i>
92 <a
92 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
93 class="btn"
93 % endif
94 href="#"
95 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
96 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
97 </a>
94 </a>
98 </div>
95 </div>
99 </div>
96 </div>
@@ -1140,6 +1140,32 b' def get_comments_for(diff_type, comments'
1140 updateSticky()
1140 updateSticky()
1141 };
1141 };
1142
1142
1143 toggleCommitExpand = function (el) {
1144 var $el = $(el);
1145 var commits = $el.data('toggleCommitsCnt');
1146 var collapseMsg = _ngettext('Collapse {0} commit', 'Collapse {0} commits', commits).format(commits);
1147 var expandMsg = _ngettext('Expand {0} commit', 'Expand {0} commits', commits).format(commits);
1148
1149 if ($el.hasClass('collapsed')) {
1150 $('.compare_select').show();
1151 $('.compare_select_hidden').hide();
1152
1153 $el.removeClass('collapsed');
1154 $el.html(
1155 '<i class="icon-minus-squared-alt icon-no-margin"></i>' +
1156 collapseMsg);
1157 }
1158 else {
1159 $('.compare_select').hide();
1160 $('.compare_select_hidden').show();
1161 $el.addClass('collapsed');
1162 $el.html(
1163 '<i class="icon-plus-squared-alt icon-no-margin"></i>' +
1164 expandMsg);
1165 }
1166 updateSticky();
1167 };
1168
1143 // get stored diff mode and pre-enable it
1169 // get stored diff mode and pre-enable it
1144 if (templateContext.session_attrs.wide_diff_mode === "true") {
1170 if (templateContext.session_attrs.wide_diff_mode === "true") {
1145 Rhodecode.comments.toggleWideMode(null);
1171 Rhodecode.comments.toggleWideMode(null);
@@ -55,10 +55,9 b''
55 </td>
55 </td>
56 </tr>
56 </tr>
57 %endfor
57 %endfor
58 <tr class="compare_select_hidden" style="${'' if c.collapse_all_commits else 'display: none'}">
58 <tr class="compare_select_hidden" style="${('' if c.collapse_all_commits else 'display: none')}">
59 <td colspan="5">
59 <td colspan="5">
60 ${_ungettext('%s commit hidden','%s commits hidden', len(c.commit_ranges)) % len(c.commit_ranges)},
60 ${_ungettext('{} commit hidden, click expand to show them.', '{} commits hidden, click expand to show them.', len(c.commit_ranges)).format(len(c.commit_ranges))}
61 <a href="#" onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">${_ungettext('show it','show them', len(c.commit_ranges))}</a>
62 </td>
61 </td>
63 </tr>
62 </tr>
64 % if not c.commit_ranges:
63 % if not c.commit_ranges:
@@ -283,17 +283,14 b''
283 <div id="changeset_compare_view_content">
283 <div id="changeset_compare_view_content">
284 <div class="pull-left">
284 <div class="pull-left">
285 <div class="btn-group">
285 <div class="btn-group">
286 <a
286 <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)} >
287 class="btn"
287 % if c.collapse_all_commits:
288 href="#"
288 <i class="icon-plus-squared-alt icon-no-margin"></i>
289 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
289 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
290 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
290 % else:
291 </a>
291 <i class="icon-minus-squared-alt icon-no-margin"></i>
292 <a
292 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
293 class="btn"
293 % endif
294 href="#"
295 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
296 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
297 </a>
294 </a>
298 </div>
295 </div>
299 </div>
296 </div>
@@ -400,17 +400,14 b''
400
400
401 <div class="pull-left">
401 <div class="pull-left">
402 <div class="btn-group">
402 <div class="btn-group">
403 <a
403 <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)} >
404 class="btn"
404 % if c.collapse_all_commits:
405 href="#"
405 <i class="icon-plus-squared-alt icon-no-margin"></i>
406 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
406 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
407 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
407 % else:
408 </a>
408 <i class="icon-minus-squared-alt icon-no-margin"></i>
409 <a
409 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
410 class="btn"
410 % endif
411 href="#"
412 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
413 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
414 </a>
411 </a>
415 </div>
412 </div>
416 </div>
413 </div>
General Comments 0
You need to be logged in to leave comments. Login now