diff --git a/opentech/apply/funds/templates/funds/applicationsubmission_admin_detail.html b/opentech/apply/funds/templates/funds/applicationsubmission_admin_detail.html index 694f1112a60a22c5ffe8837a6d1214859916b2b3..3fe7abffd55ec917e56ceab14cc296bb8c496995 100644 --- a/opentech/apply/funds/templates/funds/applicationsubmission_admin_detail.html +++ b/opentech/apply/funds/templates/funds/applicationsubmission_admin_detail.html @@ -27,7 +27,6 @@ </div> {% endblock %} - {% block extra_js %} {{ reviewer_form.media }} {% endblock %} diff --git a/opentech/apply/funds/templates/funds/includes/review_table.html b/opentech/apply/funds/templates/funds/includes/review_table.html index d6d0ba55d3988bcedfa1220342cfd9dafa36fb55..b628ecfe3207560fad977cb6431c55f55092d339 100644 --- a/opentech/apply/funds/templates/funds/includes/review_table.html +++ b/opentech/apply/funds/templates/funds/includes/review_table.html @@ -1,5 +1,5 @@ {% load review_tags %} -<table class="reviews-sidebar"> +<table class="reviews-sidebar js-reviews-sidebar"> {% if staff_reviews or object.staff_not_reviewed %} {% if staff_reviews %} <tr class="tr tr--subchild light-grey-bg"> @@ -20,8 +20,14 @@ {% if object.stage.has_external_review %} <tr class="tr tr--subchild"><td colspan="4"><hr></td></tr> - {% include 'funds/includes/review_table_row.html' with reviews=reviewer_reviews %} - {# Add logic for showing missing reviews #} - {% include 'funds/includes/review_table_row.html' with reviews=object.reviewers_not_reviewed missing=True %} + {% if reviewer_reviews or object.reviewers_not_reviewed %} + {% include 'funds/includes/review_table_row.html' with reviews=reviewer_reviews %} + {% if object.reviewers_not_reviewed %} + {% include 'funds/includes/review_table_row.html' with reviews=object.reviewers_not_reviewed missing=True class="hidden" %} + <tr><td colspan="4"><a class="link link--bold link--underlined js-toggle-reviewers" href="#">All Assigned Advisors</a></td></tr> + {% endif %} + {% else %} + <tr><td colspan="4" class="reviews-sidebar__no-reviews">No assignees or reviews yet</td></tr> + {% endif %} {% endif %} </table> diff --git a/opentech/apply/funds/templates/funds/includes/review_table_row.html b/opentech/apply/funds/templates/funds/includes/review_table_row.html index ffe2bde74f89db48d32b345e5bfb819aeb832d50..5db9d45072c92696b5d5844a60bb4dcb04fbd4fc 100644 --- a/opentech/apply/funds/templates/funds/includes/review_table_row.html +++ b/opentech/apply/funds/templates/funds/includes/review_table_row.html @@ -1,5 +1,5 @@ {% for review in reviews %} - <tr class="tr--subchild {% if missing %}no-response{% endif %}"> + <tr class="tr--subchild {{ class }} {% if missing %}no-response{% endif %}"> {% if missing %} <td colspan="2">{{ review }}</td> <td>-</td> diff --git a/opentech/static_src/src/javascript/components/toggle-reviewers.js b/opentech/static_src/src/javascript/components/toggle-reviewers.js new file mode 100644 index 0000000000000000000000000000000000000000..e6826dc7e6b80f4ec8d2e00622a9865d2b468642 --- /dev/null +++ b/opentech/static_src/src/javascript/components/toggle-reviewers.js @@ -0,0 +1,24 @@ +import $ from './../globals'; + +export default () => { + // get all the reviewers that are missing + const reviewers = Array.prototype.slice.call($('.js-reviews-sidebar').find('tr.hidden.no-response')); + + $('.js-toggle-reviewers').click(function(e) { + e.preventDefault(); + + // toggle class and update text + $(this).toggleClass('is-open'); + $(this).hasClass('is-open') ? $(this).html('Hide All Assigned Advisors') : $(this).html('All Assigned Advisors'); + + // toggle the reviewers + toggleReviewers(reviewers); + }); + + // show/hide the reviewers + function toggleReviewers(reviewers) { + reviewers.forEach(((reviewer) => { + $(reviewer).toggleClass('hidden'); + })); + } +}; diff --git a/opentech/static_src/src/javascript/main.js b/opentech/static_src/src/javascript/main.js index fdf7e931d3115aef79c851184145378ea19b59ee..342f8b0ab7a3fa791976f462cc3cd39d15649d1d 100755 --- a/opentech/static_src/src/javascript/main.js +++ b/opentech/static_src/src/javascript/main.js @@ -13,6 +13,7 @@ import submissionFilters from './components/submission-filters'; import mobileFilterPadding from './components/mobile-filter-padding'; import generateTooltips from './components/submission-tooltips'; import DeterminationCopy from './components/determination-template'; +import toggleReviewers from './components/toggle-reviewers'; (function ($) { $(document).ready(function(){ @@ -62,6 +63,9 @@ import DeterminationCopy from './components/determination-template'; // Submission filters logic submissionFilters(); + + // Toggle all reviewers in the sidebar + toggleReviewers(); }); // Add active class to select2 checkboxes after page has been filtered diff --git a/opentech/static_src/src/sass/apply/base/_base.scss b/opentech/static_src/src/sass/apply/base/_base.scss index ea21f8bbf74a21e16c13b3adb3e8072efc437841..17a897268d9fbc3768f5733a611e7300c9fd758f 100755 --- a/opentech/static_src/src/sass/apply/base/_base.scss +++ b/opentech/static_src/src/sass/apply/base/_base.scss @@ -74,6 +74,7 @@ ol { transition: opacity, z-index, $transition; } +.hidden, .is-hidden, %is-hidden { display: none; diff --git a/opentech/static_src/src/sass/apply/components/_link.scss b/opentech/static_src/src/sass/apply/components/_link.scss index 0bc83534fcee0698943be1b7cea4dd5b717148ba..da61ef457eee4b2f70dc3ef076a1ac04ab5760ac 100644 --- a/opentech/static_src/src/sass/apply/components/_link.scss +++ b/opentech/static_src/src/sass/apply/components/_link.scss @@ -187,4 +187,9 @@ } } } + + &--toggle-reviewers { + display: block; + margin: 0 10px 30px; + } }