Implement map pagination fix for public slug pages
Co-authored-by: magicbug <84308+magicbug@users.noreply.github.com>
这个提交包含在:
父节点
6b34483b6c
当前提交
e531ddc277
共有 2 个文件被更改,包括 31 次插入 和 1 次删除
|
|
@ -193,7 +193,16 @@ class Visitor extends CI_Controller {
|
|||
show_404('Unknown Public Page.');
|
||||
}
|
||||
|
||||
$qsos = $this->logbook_model->get_qsos('18', null, $logbooks_locations_array);
|
||||
// Get pagination parameters - if page is provided, calculate offset
|
||||
$page = $this->input->post('page');
|
||||
$per_page = 25; // Match the per_page from index method
|
||||
$offset = null;
|
||||
|
||||
if ($page && is_numeric($page) && $page > 0) {
|
||||
$offset = ($page - 1) * $per_page;
|
||||
}
|
||||
|
||||
$qsos = $this->logbook_model->get_qsos($per_page, $offset, $logbooks_locations_array);
|
||||
// [PLOT] ADD plot //
|
||||
$plot_array = $this->logbook_model->get_plot_array_for_map($qsos->result());
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,27 @@
|
|||
<?php } ?>
|
||||
<?php if ($this->uri->segment(2) != "search" && $this->uri->segment(2) != "satellites") { ?>
|
||||
initmap(grid);
|
||||
|
||||
// Add pagination click handler for map updates
|
||||
$(document).on('click', '.pagination a', function(e) {
|
||||
var href = $(this).attr('href');
|
||||
if (href && typeof qso_loc !== 'undefined') {
|
||||
// Extract offset from URL (last segment after /index/ or default to 0)
|
||||
var matches = href.match(/\/index(?:\/(\d+))?$/);
|
||||
var offset = matches && matches[1] ? parseInt(matches[1]) : 0;
|
||||
var per_page = 25;
|
||||
var page = Math.floor(offset / per_page) + 1;
|
||||
|
||||
// Refresh map with new page data
|
||||
console.log('Pagination clicked, refreshing map for page:', page, 'offset:', offset);
|
||||
if (typeof askForPlots === 'function') {
|
||||
askForPlots(qso_loc, {
|
||||
dataPost: { page: page },
|
||||
map_id: '#map'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
});
|
||||
|
|
|
|||
正在加载…
在新工单中引用