Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use an intermediate page to link to a move id #877

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ function onEachFeature(feature, layer) {
} else {
author = `<em class="user-anonymous">${ author }</em>`;
}
let move_link = "{'geokret_details_by_move_id'|alias:'gkid=%GKID%,moveid=%MOVEID%'}"
.replace('%MOVEID%', feature.properties.move_id)
.replace('%GKID%', "{$geokret->gkid}");
layer.bindPopup(`
<h4>${ moveTypeIcon(feature.properties.move_type) } ${ moveTypeText(feature.properties.move_type) }</h4>
<h5>{t}Move details:{/t}</h5>
Expand All @@ -119,7 +122,7 @@ function onEachFeature(feature, layer) {
<div class="text-center">
<div class="btn-group" role="group">
${ previousMoveButton(feature) }
<a href="#log${ feature.properties.move_id }" class="btn btn-default btn-xs popup-move-navigate" title="{t}Show move{/t}" data-id="${ feature.properties.step }">
<a href="${ move_link }" class="btn btn-default btn-xs popup-move-navigate" title="{t}Show move{/t}" data-id="${ feature.properties.step }">
{t}Show move{/t}
</a>
${ nextMoveButton(feature) }
Expand Down
15 changes: 15 additions & 0 deletions website/app/GeoKrety/Controller/Pages/GeokretDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,19 @@ public function get($f3) {

// TODO check if GeoKret has already been discovered, and display Tracking Code
}

public function geokret_details_by_move_id(\Base $f3) {
$move_id = $f3->get('PARAMS.moveid');
if (!ctype_digit($move_id)) {
\Flash::instance()->addMessage(_('Invalid log_id'), 'danger');
$f3->reroute(sprintf('@geokret_details(@gkid=%s)', $this->geokret->gkid));
}
$move = new Move();
$move->load(['id = ?', $move_id]);
if ($move->dry()) {
\Flash::instance()->addMessage(_('Invalid log_id'), 'danger');
$f3->reroute(sprintf('@geokret_details(@gkid=%s)', $this->geokret->gkid));
}
$f3->reroute(sprintf('@geokret_details_paginate(@gkid=%s,@page=%d)#log%d', $this->geokret->gkid, $move->getMoveOnPage(), $move_id));
}
}
1 change: 1 addition & 0 deletions website/app/authorizations.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ allow @user_update_email_revalidate = *
allow @user_update_email_revalidate_token = *
allow @geokret_details = *
allow @geokret_details_paginate = *
allow @geokret_details_by_move_id = *
allow @photo_gallery = *
allow @photo_gallery_paginate = *
allow @move_create = *
Expand Down
1 change: 1 addition & 0 deletions website/app/routes.ini
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ POST @geokrety_move_edit: /moves/@moveid/edit = \GeoKrety\Controller\MoveCreate-
GET @move_delete: /moves/@moveid/delete [sync] = \GeoKrety\Controller\MoveDelete->get
GET @move_delete: /moves/@moveid/delete [ajax] = \GeoKrety\Controller\MoveDelete->get_ajax
POST @move_delete: /moves/@moveid/delete = \GeoKrety\Controller\MoveDelete->post
GET @geokret_details_by_move_id: /geokrety/@gkid/move/@moveid = \GeoKrety\Controller\GeokretDetails->geokret_details_by_move_id

; Validations
POST @validate_tracking_code: /validate/tracking-code = \GeoKrety\Controller\Validation\TrackingCode->post
Expand Down
Loading