diff --git a/opentech/apply/funds/templates/funds/base_submissions_table.html b/opentech/apply/funds/templates/funds/base_submissions_table.html index e9296c8423bf3bd4c6e245f3a2fdd3803e049626..322a4dca51c1d0a1b9c8aaf5e03531a308549429 100644 --- a/opentech/apply/funds/templates/funds/base_submissions_table.html +++ b/opentech/apply/funds/templates/funds/base_submissions_table.html @@ -3,6 +3,7 @@ {% load render_table from django_tables2 %} {% block extra_css %} +<link rel="stylesheet" href="{% static 'css/apply/fancybox.css' %}"> {{ filter.form.media.css }} {% endblock %} @@ -16,6 +17,8 @@ {% block extra_js %} {{ filter.form.media.js }} + <script src="//cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.1/jquery.fancybox.min.js"></script> + <script src="{% static 'js/apply/fancybox-global.js' %}"></script> <script src="{% static 'js/apply/all-submissions-table.js' %}"></script> <script src="https://cdn.jsdelivr.net/npm/symbol-es6@0.1.2/symbol-es6.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/url-search-params/1.1.0/url-search-params.js"></script> diff --git a/opentech/apply/funds/templates/funds/includes/batch_update_reviewer_form.html b/opentech/apply/funds/templates/funds/includes/batch_update_reviewer_form.html new file mode 100644 index 0000000000000000000000000000000000000000..cd6583cda14a2aac84d12760af6d6ad6f4f2683c --- /dev/null +++ b/opentech/apply/funds/templates/funds/includes/batch_update_reviewer_form.html @@ -0,0 +1,5 @@ +<div class="modal" id="batch-update-reviewers"> + <h4>Update Reviewers</h4> + <div class="js-batch-titles"></div> + {# insert form here #} +</div> diff --git a/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html b/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html index 390d8dc099d723687cdd4be531d2a77c91a9b9ac..7edcad1832cbf156157176e6ead6b98116ed6392 100644 --- a/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html +++ b/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html @@ -7,9 +7,7 @@ <button class="button button--action button--change-status" type="submit">Change status</button> </form> - <form action="" class="js-batch-update-reviewers"> - <button class="button button--action button--reviewers" type="submit">Reviewers</button> - </form> + <button data-fancybox data-src="#batch-update-reviewers" class="button button--action button--reviewers js-batch-update-reviewers" type="submit">Reviewers</button> </div> {# Right #} @@ -45,3 +43,5 @@ </ul> </form> </div> + +{% include "funds/includes/batch_update_reviewer_form.html" %} diff --git a/opentech/static_src/src/javascript/apply/batch-actions.js b/opentech/static_src/src/javascript/apply/batch-actions.js index 9b0f95c892284e27f538af25e3cfff806a8b67d6..f86d49f94076cad42d26116c7ac7f0960b53908e 100644 --- a/opentech/static_src/src/javascript/apply/batch-actions.js +++ b/opentech/static_src/src/javascript/apply/batch-actions.js @@ -6,7 +6,8 @@ const $checkbox = $('.js-batch-select'); const $allCheckboxInput = $('.js-batch-select-all'); const $changeStatusForm = $('.js-batch-update-status'); - const $changeReviewersForm = $('.js-batch-update-reviewers'); + const $batchReviewersButton = $('.js-batch-update-reviewers'); + const $batchTitles = $('.js-batch-titles'); const activeClass = 'batch-actions-enabled'; $allCheckboxInput.change(function () { @@ -38,6 +39,17 @@ } }); + // append selected project titles to batch update reviewer modal + $batchReviewersButton.click(function () { + $batchTitles.html(''); + + $checkbox.each(function () { + if ($(this).is(':checked')) { + $batchTitles.append(`<p>${$(this).parents('tr').find('.js-title').data('tooltip')}</p>`); + } + }); + }); + function toggleBatchActions() { if ($('.js-batch-select:checked').length) { $body.addClass(activeClass); @@ -66,10 +78,4 @@ } }); }); - - // reviewers form handler - $changeReviewersForm.submit(function (e) { - e.preventDefault(); - console.log('reviewers form submitted'); - }); })(jQuery); diff --git a/opentech/static_src/src/sass/apply/components/_actions-bar.scss b/opentech/static_src/src/sass/apply/components/_actions-bar.scss index 027d6b1ed862f3471b04768622f2e58d84161ee7..07bc372352880cfd366d7f139c547867eeca216a 100644 --- a/opentech/static_src/src/sass/apply/components/_actions-bar.scss +++ b/opentech/static_src/src/sass/apply/components/_actions-bar.scss @@ -16,8 +16,11 @@ align-items: center; & > * { - padding-left: 20px; - margin: 0; + margin: 0 0 0 20px; + + &:first-child { + margin-left: 0; + } } }