##// END OF EJS Templates
diffs: update all sticky elements on dom changes to handle cases like:...
dan -
r3129:62991ed2 default
parent child Browse files
Show More
@@ -775,10 +775,10 b' var CommentsController = function() {'
775 linkifyComments($('.inline-comment-injected'));
775 linkifyComments($('.inline-comment-injected'));
776 timeagoActivate();
776 timeagoActivate();
777
777
778 if (window.Waypoint !== undefined) {
778 if (window.updateSticky !== undefined) {
779 // potentially our comments change the active window size, so we
779 // potentially our comments change the active window size, so we
780 // notify waypint to re-paint
780 // notify sticky elements
781 Waypoint.refreshAll()
781 updateSticky()
782 }
782 }
783
783
784 commentForm.setActionButtonsDisabled(false);
784 commentForm.setActionButtonsDisabled(false);
@@ -157,7 +157,7 b' collapse_all = len(diffset.files) > coll'
157 ## anchor with support of sticky header
157 ## anchor with support of sticky header
158 <div class="anchor" id="a_${h.FID(filediff.raw_id, filediff.patch['filename'])}"></div>
158 <div class="anchor" id="a_${h.FID(filediff.raw_id, filediff.patch['filename'])}"></div>
159
159
160 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox" onchange="Waypoint.refreshAll();">
160 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox" onchange="updateSticky();">
161 <div
161 <div
162 class="filediff"
162 class="filediff"
163 data-f-path="${filediff.patch['filename']}"
163 data-f-path="${filediff.patch['filename']}"
@@ -189,10 +189,10 b' collapse_all = len(diffset.files) > coll'
189 <td class="cb-text" ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=4' or 'colspan=6')}>
189 <td class="cb-text" ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=4' or 'colspan=6')}>
190 ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
190 ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
191 <a href="#" class="cb-expand"
191 <a href="#" class="cb-expand"
192 onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')}
192 onclick="$(this).closest('table').removeClass('cb-collapsed'); updateSticky(); return false;">${_('Show them')}
193 </a>
193 </a>
194 <a href="#" class="cb-collapse"
194 <a href="#" class="cb-collapse"
195 onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')}
195 onclick="$(this).closest('table').addClass('cb-collapsed'); updateSticky(); return false;">${_('Hide them')}
196 </a>
196 </a>
197 </td>
197 </td>
198 </tr>
198 </tr>
@@ -292,7 +292,7 b' collapse_all = len(diffset.files) > coll'
292 display_state = ''
292 display_state = ''
293 %>
293 %>
294 <div class="filediffs filediff-outdated" style="${display_state}">
294 <div class="filediffs filediff-outdated" style="${display_state}">
295 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox" onchange="Waypoint.refreshAll();">
295 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox" onchange="updateSticky();">
296 <div class="filediff" data-f-path="${filename}" id="a_${h.FID(filediff.raw_id, filename)}">
296 <div class="filediff" data-f-path="${filename}" id="a_${h.FID(filediff.raw_id, filename)}">
297 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
297 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
298 <div class="filediff-collapse-indicator"></div>
298 <div class="filediff-collapse-indicator"></div>
@@ -778,11 +778,11 b' def get_comments_for(diff_type, comments'
778 <a
778 <a
779 class="btn"
779 class="btn"
780 href="#"
780 href="#"
781 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); Waypoint.refreshAll(); return false">${_('Expand All Files')}</a>
781 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); updateSticky(); return false">${_('Expand All Files')}</a>
782 <a
782 <a
783 class="btn"
783 class="btn"
784 href="#"
784 href="#"
785 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); Waypoint.refreshAll(); return false">${_('Collapse All Files')}</a>
785 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); updateSticky(); return false">${_('Collapse All Files')}</a>
786 <a
786 <a
787 class="btn"
787 class="btn"
788 href="#"
788 href="#"
@@ -900,7 +900,7 b' def get_comments_for(diff_type, comments'
900 window.location.hash = idSelector;
900 window.location.hash = idSelector;
901 // expand the container if we quick-select the field
901 // expand the container if we quick-select the field
902 $(idSelector).next().prop('checked', false);
902 $(idSelector).next().prop('checked', false);
903 Waypoint.refreshAll()
903 updateSticky()
904 });
904 });
905
905
906 var contextPrefix = _gettext('Context file: ');
906 var contextPrefix = _gettext('Context file: ');
@@ -917,7 +917,8 b' def get_comments_for(diff_type, comments'
917 });
917 });
918
918
919 updateSticky = function () {
919 updateSticky = function () {
920 sidebar.updateSticky()
920 sidebar.updateSticky();
921 Waypoint.refreshAll();
921 };
922 };
922
923
923 var animateText = $.debounce(100, function(fPath, anchorId) {
924 var animateText = $.debounce(100, function(fPath, anchorId) {
General Comments 0
You need to be logged in to leave comments. Login now