date-picker.js
1 year ago
duplicate-field.js
1 year ago
email-reports.js
2 months ago
module-markup.js
3 months ago
notices.js
1 year ago
overview.js
9 months ago
scroll-to-top.js
2 years ago
sticky-sidebar.js
2 years ago
support.js
3 months ago
user-roles.js
1 year ago
overview.js
56 lines
| 1 | const $ = jQuery; |
| 2 | |
| 3 | const Overview = { |
| 4 | setup: function() { |
| 5 | // Pagination |
| 6 | $('body').on('click', '.pagination-button', function() { |
| 7 | var current = $(this).parent().parent().find('.current'); |
| 8 | var pageCount = current.siblings('.module-pagination').find('.current-page'); |
| 9 | if ($(this).hasClass('right')) { |
| 10 | if (current.next('.module-page').length == 0) { |
| 11 | return; |
| 12 | } |
| 13 | if (current.parents('.iawp-module').hasClass('full-width') |
| 14 | && current.next().next('.module-page').length == 0 |
| 15 | && window.innerWidth > 700) { |
| 16 | return; |
| 17 | } |
| 18 | current.removeClass('current'); |
| 19 | if (current.parents('.iawp-module').hasClass('full-width') && window.innerWidth > 700) { |
| 20 | current = current.next().next('.module-page').addClass('current'); |
| 21 | } else { |
| 22 | current = current.next('.module-page').addClass('current'); |
| 23 | } |
| 24 | pageCount.text(parseInt(pageCount.text()) + 1); |
| 25 | $(this).parent().find('.left').prop('disabled', false); |
| 26 | if (current.next('.module-page').length == 0 |
| 27 | || (current.parents('.iawp-module').hasClass('full-width') && current.next().next('.module-page').length == 0) |
| 28 | ) { |
| 29 | $(this).prop('disabled', true); |
| 30 | } |
| 31 | } else { |
| 32 | if (current.prev('.module-page').length !== 0) { |
| 33 | current.removeClass('current'); |
| 34 | if (current.parents('.iawp-module').hasClass('full-width') |
| 35 | && window.innerWidth > 700) { |
| 36 | // Handle situation where they are on page 2 and the screen is < 700 then gets resized larger |
| 37 | if (current.hasClass('module-page-2') || current.hasClass('module-page-4')) { |
| 38 | current = current.prev('.module-page').addClass('current'); |
| 39 | } else { |
| 40 | current = current.prev().prev('.module-page').addClass('current'); |
| 41 | } |
| 42 | } else { |
| 43 | current = current.prev('.module-page').addClass('current'); |
| 44 | } |
| 45 | pageCount.text(parseInt(pageCount.text()) - 1); |
| 46 | $(this).parent().find('.right').prop('disabled', false); |
| 47 | if (current.prev('.module-page').length == 0) { |
| 48 | $(this).prop('disabled', true); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | }); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | export { Overview }; |