Skip to content

Commit 2dc1034

Browse files
committed
Various discussion hidden fixes on document page
Summary: - Fix document outline behavior - Prevent error in affix code - Affixes in proper locations now - Doesn't pop out of the container - Gray border under title now present when discussion hidden Resolves T303 Resolves T293 Resolves T294 Test Plan: - Check outline behavior, per notes above - Check style between discussion hidden / open Reviewers: doshitan Reviewed By: doshitan Maniphest Tasks: T303, T294, T293 Differential Revision: https://phabricator.opengovfoundation.org/D192
1 parent df31dce commit 2dc1034

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

resources/assets/js/document.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ window.buildDocumentOutline = function (outlineContainer, documentContent) {
211211
// Set the outline to be affixed
212212
$(outlineContainer).children('ul').affix({
213213
offset: {
214-
top: $(outlineContainer).position().top - 5,
214+
top: $(outlineContainer).offset().top - 15,
215215
bottom: function () {
216-
return $(document).height() - $('#comments').position().top + 50;
216+
return $(document).height() - ($('#page_content').offset().top + $('#page_content').height());
217217
}
218218
}
219219
});

resources/assets/sass/document.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
}
1919

2020
.support-btns {
21+
min-height: 10px; // Needed when discussion is hidden
2122
padding-bottom: 0;
2223
margin: 30px 0;
2324
position: relative;

resources/views/documents/partials/support-btns.blade.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@if ($document->discussion_state !== \App\Models\Doc::DISCUSSION_STATE_HIDDEN)
2-
<div class="row">
3-
<div class="col-xs-12 text-center">
4-
<div class="support-btns">
1+
<div class="row">
2+
<div class="col-xs-12 text-center">
3+
<div class="support-btns">
4+
@if ($document->discussion_state !== \App\Models\Doc::DISCUSSION_STATE_HIDDEN)
55
<div class="support-btn" role="group">
66
{{ Form::open(['route' => ['documents.support', $document], 'method' => 'put']) }}
77
<input type="hidden" name="support" value="1">
@@ -27,7 +27,7 @@
2727
</button>
2828
{{ Form::close() }}
2929
</div>
30-
</div>
30+
@endif
3131
</div>
3232
</div>
33-
@endif
33+
</div>

resources/views/documents/show.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
<script src="{{ elixir('js/document.js') }}"></script>
114114
<script>
115115
window.documentId = {{ $document->id }};
116-
window.buildDocumentOutline('#document-outline', '#page_content');
117116
118117
@if ($document->discussion_state !== \App\Models\Doc::DISCUSSION_STATE_HIDDEN)
119118
loadAnnotations(
@@ -133,6 +132,9 @@
133132
if (window.getQueryParam('comment_page')) {
134133
showComments();
135134
}
135+
136+
// Build this last to prevent misplacement on the page during `showComments()`
137+
window.buildDocumentOutline('#document-outline', '#page_content');
136138
@endif
137139
</script>
138140
@endpush

0 commit comments

Comments
 (0)