##// 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 83 compare_page = ComparePage(response)
84 84 compare_page.contains_change_summary(*file_changes)
85 response.mustcontain('Expand 1 commit')
85 response.mustcontain('Collapse 1 commit')
86 86
87 87 def test_diff_sidebyside_two_commits(self, app, backend):
88 88 commit_id_range = {
@@ -122,7 +122,33 b' class TestSideBySideDiff(object):'
122 122 compare_page = ComparePage(response)
123 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 153 @pytest.mark.xfail(reason='GIT does not handle empty commit compare correct (missing 1 commit)')
128 154 def test_diff_side_by_side_from_0_commit(self, app, backend, backend_stub):
@@ -149,7 +175,7 b' class TestSideBySideDiff(object):'
149 175 params=dict(diffmode='sidebyside')
150 176 ))
151 177
152 response.mustcontain('Expand 2 commits')
178 response.mustcontain('Collapse 2 commits')
153 179 response.mustcontain('123 file changed')
154 180
155 181 response.mustcontain(
@@ -183,7 +209,7 b' class TestSideBySideDiff(object):'
183 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 213 response.mustcontain('1 file changed')
188 214
189 215 response.mustcontain(
@@ -215,7 +241,7 b' class TestSideBySideDiff(object):'
215 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 245 response.mustcontain('1 file changed')
220 246
221 247 response.mustcontain(
@@ -259,7 +285,7 b' class TestSideBySideDiff(object):'
259 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 290 compare_page = ComparePage(response)
265 291 compare_page.contains_change_summary(*file_changes)
@@ -617,7 +617,7 b' class TestFilesDiff(object):'
617 617 })
618 618 # use redirect since this is OLD view redirecting to compare page
619 619 response = response.follow()
620 response.mustcontain('Expand 1 commit')
620 response.mustcontain('Collapse 1 commit')
621 621 file_changes = (1, 0, 0)
622 622
623 623 compare_page = ComparePage(response)
@@ -83,17 +83,14 b''
83 83 <div id="changeset_compare_view_content">
84 84 <div class="pull-left">
85 85 <div class="btn-group">
86 <a
87 class="btn"
88 href="#"
89 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
90 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
91 </a>
92 <a
93 class="btn"
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)}
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 % if c.collapse_all_commits:
88 <i class="icon-plus-squared-alt icon-no-margin"></i>
89 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
90 % else:
91 <i class="icon-minus-squared-alt icon-no-margin"></i>
92 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
93 % endif
97 94 </a>
98 95 </div>
99 96 </div>
@@ -1140,6 +1140,32 b' def get_comments_for(diff_type, comments'
1140 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 1169 // get stored diff mode and pre-enable it
1144 1170 if (templateContext.session_attrs.wide_diff_mode === "true") {
1145 1171 Rhodecode.comments.toggleWideMode(null);
@@ -55,10 +55,9 b''
55 55 </td>
56 56 </tr>
57 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 59 <td colspan="5">
60 ${_ungettext('%s commit hidden','%s commits hidden', len(c.commit_ranges)) % 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>
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))}
62 61 </td>
63 62 </tr>
64 63 % if not c.commit_ranges:
@@ -283,17 +283,14 b''
283 283 <div id="changeset_compare_view_content">
284 284 <div class="pull-left">
285 285 <div class="btn-group">
286 <a
287 class="btn"
288 href="#"
289 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
290 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
291 </a>
292 <a
293 class="btn"
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)}
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 % if c.collapse_all_commits:
288 <i class="icon-plus-squared-alt icon-no-margin"></i>
289 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
290 % else:
291 <i class="icon-minus-squared-alt icon-no-margin"></i>
292 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
293 % endif
297 294 </a>
298 295 </div>
299 296 </div>
@@ -400,17 +400,14 b''
400 400
401 401 <div class="pull-left">
402 402 <div class="btn-group">
403 <a
404 class="btn"
405 href="#"
406 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
407 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
408 </a>
409 <a
410 class="btn"
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)}
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 % if c.collapse_all_commits:
405 <i class="icon-plus-squared-alt icon-no-margin"></i>
406 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
407 % else:
408 <i class="icon-minus-squared-alt icon-no-margin"></i>
409 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
410 % endif
414 411 </a>
415 412 </div>
416 413 </div>
General Comments 0
You need to be logged in to leave comments. Login now