Skip to content

Commit

Permalink
feat: Add support for new GK Types: pebble, car, playing card, dog
Browse files Browse the repository at this point in the history
  • Loading branch information
kumy committed Jul 21, 2024
1 parent 9eaaad0 commit 0a39abc
Show file tree
Hide file tree
Showing 22 changed files with 498 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Test Setup Test Setup
Type valid
[Template] GeoKret is created
0 Traditional
1 A book/CD/DVD…
1 A book
2 A human
3 A coin
4 KretyPost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Edit A GeoKret
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}
Element Should Contain ${GEOKRET_DETAILS_NAME} GKNewName
Element Attribute Should Be ${GEOKRET_DETAILS_CREATED_ON_DATETIME}/span data-datetime 2024-05-18T00:00:00+00:00
Element Should Contain ${GEOKRET_DETAILS_TYPE} A book/CD/DVD…
Element Should Contain ${GEOKRET_DETAILS_TYPE} A book
Element Should Contain ${GEOKRET_DETAILS_MISSION} New mission

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Shown On Home Page
${expected} = Change Born Date To Now With Validation

Go To Home
Element Attribute Should Be ${HOME_RECENTLY_CREATED_GK_TABLE}//tr[1]/td[4]/span data-datetime ${expected}
Element Attribute Should Be ${HOME_RECENTLY_CREATED_GK_TABLE}//tr[1]/td[3]/span data-datetime ${expected}


Shown On Inventory Picker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,53 @@ Can be enabled only if it has an holder
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}
Flash message shown has been updated

Changing type to human should change the collectible date
Sign In ${USER_1.name} Fast

Go To Url ${PAGE_GEOKRETY_1_DETAILS_URL}
Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE}

Go To Url ${PAGE_GEOKRETY_2_DETAILS_URL}
Element Should Contain ${GEOKRET_DETAILS_COLLECTIBLE} Non-Collectible

Go To Url ${PAGE_GEOKRETY_2_EDIT_URL}
Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${2}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Element Should Contain ${GEOKRET_DETAILS_COLLECTIBLE} Non-Collectible

Go To Url ${PAGE_GEOKRETY_2_EDIT_URL}
Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${6}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Element Should Contain ${GEOKRET_DETAILS_COLLECTIBLE} Non-Collectible

Go To Url ${PAGE_GEOKRETY_2_EDIT_URL}
Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${8}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Element Should Contain ${GEOKRET_DETAILS_COLLECTIBLE} Non-Collectible

Go To Url ${PAGE_GEOKRETY_2_EDIT_URL}
Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${9}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE}


Changing type should fail if not holder
Sign In ${USER_1.name} Fast
Post Move Fast &{MOVE_1}

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Select From List By Value ${GEOKRET_CREATE_TYPE_SELECT} ${2}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Flash message shown You must hold the Geokrety to change to this type

Go To Url ${PAGE_GEOKRETY_1_DETAILS_URL}
Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE}



*** Keywords ***

Test Setup
Clear Database And Seed ${2} users
Seed ${1} geokrety owned by ${1}
Seed ${1} geokrety owned by ${1} with type ${2}
3 changes: 3 additions & 0 deletions tests-qa/acceptance/ressources/Devel.robot
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ Seed ${count} geokrety owned by ${userid} with mission ${mission}
Seed ${count} geokrety owned by ${userid} with birthdate ${birthdate}
Go To Url Fast url=${GK_URL}/devel/db/users/${userid}/geokrety/seed/${count}?birthdate=${birthdate}

Seed ${count} geokrety owned by ${userid} with type ${type}
Go To Url Fast url=${GK_URL}/devel/db/users/${userid}/geokrety/seed/${count}?type=${type}

Seed special geokrety with tracking code starting with GK owned by ${userid}
Go To Url Fast ${GK_URL}/devel/db/users/${userid}/geokrety/tc-starting-with-gk

Expand Down
1 change: 1 addition & 0 deletions tests-qa/acceptance/ressources/vars/Urls.robot
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ ${PAGE_PICTURES_GALLERY_URL} ${GK_URL}/en/picture/gallery
${PAGE_GEOKRETY_CREATE_URL} ${PAGE_HOME_URL_EN}/geokrety/create
${PAGE_GEOKRETY_EDIT_URL} ${PAGE_HOME_URL_EN}/geokrety/1/edit
${PAGE_GEOKRETY_EDIT_URL_FR} ${PAGE_HOME_URL_FR}/geokrety/1/edit
${PAGE_GEOKRETY_2_EDIT_URL} ${PAGE_HOME_URL_EN}/geokrety/2/edit
${PAGE_GEOKRETY_CLAIM_URL} ${PAGE_HOME_URL_EN}/geokrety/claim
${PAGE_GEOKRETY_WATCH_URL} ${PAGE_HOME_URL_EN}/geokrety/\${params.gkid}/watch
${PAGE_GEOKRETY_UNWATCH_URL} ${PAGE_HOME_URL_EN}/geokrety/\${params.gkid}/unwatch
Expand Down
2 changes: 1 addition & 1 deletion website/app-templates/smarty/blocks/user/details.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="panel panel-default" id="userDetailsPanel">
<div class="panel-heading">
<img id="userDetailsTypeIcon" src="{GK_CDN_IMAGES_URL}/log-icons/2/icon_25.jpg" width="25" height="25" data-gk-type="" />
<img id="userDetailsTypeIcon" src="{GK_CDN_IMAGES_URL}/log-icons/2/icon.svg" width="25px" height="25px" data-gk-type="" />
{$user|userlink nofilter}
<div class="btn-group pull-right" role="group">
{if $f3->get('SESSION.CURRENT_USER') && !$user->isCurrentUser() && $user->email}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<tr class="{if $geokret->isMissing()}danger{elseif $geokret->isArchived()}danger{elseif !$geokret->owner}info{/if}">
<td>{$geokret|gkicon nofilter}</td>
<td>
{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}<br />
{$geokret|gkicon nofilter}{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}<br />
<small>{$geokret->gkid}</small>
</td>
<td class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{if $geokret->isMissing()}<span title="{t}Declared as missing{/t}"><i class="fa fa-exclamation-triangle"></i></span>{/if}
</td>
<td>
{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}<br />
{$geokret|gkicon nofilter}{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}<br />
<small>{$geokret->gkid}</small>
</td>
<td class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{$geokret|posicon nofilter}
</td>
<td>
{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}<br />
{$geokret|gkicon nofilter}{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}<br />
<small>{$geokret->gkid}</small>
</td>
<td class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{$geokret|posicon nofilter}
</td>
<td>
{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}<br />
{$geokret|gkicon nofilter}{$geokret|gklink nofilter} {$geokret|gkavatar nofilter}<br />
<small>{$geokret->gkid}</small>
</td>
<td class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function computeLogType(Geokret $geokret, ?int $locationType, ?int $lastUserId):
if (is_null($locationType)) {
return 9;
}
if ((($locationType === LogType::LOG_TYPE_GRABBED or $locationType === LogType::LOG_TYPE_DIPPED) and $lastUserId === (is_null($geokret->owner) ? null : $geokret->owner->id)) and $locationType !== LogType::LOG_TYPE_ARCHIVED and !$geokret->type->isType(GeokretyType::GEOKRETY_TYPE_HUMAN)) {
if ((($locationType === LogType::LOG_TYPE_GRABBED or $locationType === LogType::LOG_TYPE_DIPPED) and $lastUserId === (is_null($geokret->owner) ? null : $geokret->owner->id)) and $locationType !== LogType::LOG_TYPE_ARCHIVED and !($geokret->type->isType(GeokretyType::GEOKRETY_TYPE_HUMAN) or $geokret->type->isType(GeokretyType::GEOKRETY_TYPE_CAR) or $geokret->type->isType(GeokretyType::GEOKRETY_TYPE_DOG_TAG))) {
return 8;
}

Expand Down Expand Up @@ -379,7 +379,7 @@ public function smarty_modifier_gkavatar(Geokret $geokret): string {
*/
public function smarty_modifier_gkicon(Geokret $geokret): string {
return sprintf(
'<img src="%s/log-icons/%s/icon.svg" class="img-fluid w-3" alt="%s" title="%s" data-gk-type="%s" width="25" height="25">',
'<img src="%s/log-icons/%s/icon.svg" class="img-fluid w-3" alt="%s" title="%s" data-gk-type="%s" width="25px" height="25px">',
GK_CDN_IMAGES_URL,
$geokret->type->getTypeId(),
_('GK type icon'),
Expand Down
89 changes: 76 additions & 13 deletions website/app-templates/smarty/help-pages/en/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@
</ol>

<p>Examples of ready GeoKrety</p>
<img src="{GK_CDN_IMAGES_URL}/help/geokret-przyklad-sp2ong_1.jpg" alt="example" width="250" height="188" />
<img src="{GK_CDN_IMAGES_URL}/help/geokret-przyklad-sp2ong_2.jpg" alt="example 2" width="250" height="148" />
<img src="{GK_CDN_IMAGES_URL}/help/geokret-przyklad-dziku.jpg" alt="example" width="250" height="180" />
<img src="{GK_CDN_IMAGES_URL}/help/geokret-przyklad-sp2ong_1.jpg" alt="example" width="250px" height="188px" />
<img src="{GK_CDN_IMAGES_URL}/help/geokret-przyklad-sp2ong_2.jpg" alt="example 2" width="250px" height="148px" />
<img src="{GK_CDN_IMAGES_URL}/help/geokret-przyklad-dziku.jpg" alt="example" width="250px" height="180px" />
<a href="/en/geokrety/GK18270" target="_blank">
<img src="{GK_CDN_IMAGES_URL}/help/GK18270_667566821c2bf.png" alt="example" width="250px" height="180px" />
</a>

</div>
<div class="col-md-5">
Expand All @@ -127,9 +130,9 @@
GeoKrety types
</div>
<div class="panel-body">
<div class="row">
<div class="row same-height">

<div class="col-sm-2">
<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/0/icon.svg" alt="traditional" width="100" height="100" />
<div class="caption">
Expand All @@ -139,7 +142,7 @@ <h3>Traditional</h3>
</div>
</div>

<div class="col-sm-2">
<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/1/icon.svg" alt="book" width="100" height="100" />
<div class="caption">
Expand All @@ -153,19 +156,19 @@ <h3>A book</h3>
</div>
</div>

<div class="col-sm-2">
<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/2/icon.svg" alt="" width="100" height="100" />
<div class="caption">
<h3>A Human</h3>
<p>
When you want to track yourself and write something like GeoBlog
When you want to track yourself and write something like GeoBlog. <i>(Not collectible)</i>
</p>
</div>
</div>
</div>

<div class="col-sm-2">
<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/3/icon.svg" alt="" width="100" height="100" />
<div class="caption">
Expand All @@ -177,7 +180,7 @@ <h3>A Coin</h3>
</div>
</div>

<div class="col-sm-2">
<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/4/icon.svg" alt="" width="100" height="100" />
<div class="caption">
Expand All @@ -189,14 +192,74 @@ <h3>KretyPost</h3>
</div>
</div>

<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/5/icon.svg" alt="" width="100" height="100" />
<div class="caption">
<h3>Pebble</h3>
<p>
A painted small rock.
</p>
</div>
</div>
</div>

<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/6/icon.svg" alt="" width="100" height="100" />
<div class="caption">
<h3>Car</h3>
<p>
Stickers for vehicules. <i>(Not collectible)</i>
</p>
</div>
</div>
</div>

<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/7/icon.svg" alt="" width="100" height="100" />
<div class="caption">
<h3>Playing card</h3>
<p>
A playing card, for some Geo-Poker games.
</p>
</div>
</div>
</div>

<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/8/icon.svg" alt="" width="100" height="100" />
<div class="caption">
<h3>Dog tag</h3>
<p>
A dog tag on your favorite pet. <i>(Not collectible)</i>
</p>
</div>
</div>
</div>

<div class="col-sm-2 col-xs-12">
<div class="thumbnail">
<img src="{GK_CDN_IMAGES_URL}/log-icons/9/icon.svg" alt="" width="100" height="100" />
<div class="caption">
<h3>Jigsaw part</h3>
<p>
A Jigsaw part.
</p>
</div>
</div>
</div>

</div>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<a class="anchor" id="kretypostrules"></a>
<img src="{GK_CDN_IMAGES_URL}/log-icons/4/icon_25.jpg" alt="kretypost icon" />
<img src="{GK_CDN_IMAGES_URL}/log-icons/4/icon.svg" alt="kretypost icon" width="25px" height="25px" />
KretyPost rules
</div>
<div class="panel-body">
Expand Down Expand Up @@ -775,8 +838,8 @@ <h3>How to decode?</h3>
<ul>
<li><a href="https://www.geocaching.com/track/">TravelBugs</a></li>
<li><s><a href="http://www.geocachearmy.com">www.geocachearmy.com</a></s></li>
<li><a href="http://www.geolutins.com">www.geolutins.com</a></li>
<li><a href="https://geotrackable.com">geotrackable.com"</a></li>
<li><s><a href="http://www.geolutins.com">www.geolutins.com</a></s></li>
<li><a href="https://geotrackable.com">geotrackable.com</a></li>
<li><s><a href="http://www.travelertags.com">www.travelertags.com</a></s></li>
<li><a href="http://www.pathtags.com">www.pathtags.com</a></li>
<li><a href="http://www.toyvoyagers.com/">www.toyvoyagers.com</a></li>
Expand Down
9 changes: 7 additions & 2 deletions website/app-templates/smarty/pages/help_api.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,15 @@
<p>GeoKrety Types are internaly stored using a <code>small integer</code>. The current mapping is as follow:</p>
<ul>
<li><code>0</code> = Traditional</li>
<li><code>1</code> = A book/CD/DVD…</li>
<li><code>2</code> = A human/pet</li>
<li><code>1</code> = A book</li>
<li><code>2</code> = A human</li>
<li><code>3</code> = A coin</li>
<li><code>4</code> = KretyPost</li>
<li><code>5</code> = Pebble</li>
<li><code>6</code> = Car</li>
<li><code>7</code> = Playing card</li>
<li><code>8</code> = Dog tag/pet</li>
<li><code>9</code> = Jigsaw part</li>
</ul>
<p>Please refer to the <a href="{'help'|alias}#GeoKretytypes">help page</a> for more details about each type.</p>
</div>
Expand Down
1 change: 0 additions & 1 deletion website/app-templates/smarty/pages/home.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th>{t}ID{/t}</th>
<th class="text-center">{t}Owner{/t}</th>
<th class="text-center">{t}Born{/t}</th>
Expand Down
4 changes: 2 additions & 2 deletions website/app/GeoKrety/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(?Template $template = null) {
'Content-Security-Policy: '
.sprintf('script-src \'nonce-%s\' \'strict-dynamic\'; ', $nonce)
.sprintf('img-src \'self\' data: %s %s https://www.gstatic.com/recaptcha/ https://tile.openstreetmap.org https://cdn.crowdin.com/jipt/images/ https://seccdn.libravatar.org/avatar/ https://crowdin-static.downloads.crowdin.com/avatar/ https://cdn.geokrety.org; ', GK_CDN_SERVER_URL, GK_MINIO_SERVER_URL_EXTERNAL)
.'frame-src https://www.google.com/ https://crowdin.com; '
.'frame-src https://www.google.com/ https://www.youtube.com/ https://crowdin.com/; '
.sprintf('style-src \'self\' \'nonce-%s\'; ', $nonce)
.sprintf('style-src-elem \'self\' \'unsafe-inline\' %s https://cdn.crowdin.com/jipt/jipt.css https://fonts.googleapis.com/css; ', GK_CDN_SERVER_URL)
.'style-src-attr \'self\' \'unsafe-inline\'; '
Expand All @@ -31,7 +31,7 @@ public function __construct(?Template $template = null) {
'Content-Security-Policy: '
.sprintf('script-src \'nonce-%s\' \'strict-dynamic\'; ', $nonce)
.sprintf('img-src \'self\' data: %s %s https://www.gstatic.com/recaptcha/ https://tile.openstreetmap.org https://seccdn.libravatar.org/avatar/ https://cdn.geokrety.org; ', GK_CDN_SERVER_URL, GK_MINIO_SERVER_URL_EXTERNAL)
.'frame-src https://www.google.com/; '
.'frame-src https://www.google.com/ https://www.youtube.com/; '
.sprintf('style-src \'self\' \'nonce-%s\'; ', $nonce)
.sprintf('style-src-elem \'self\' \'unsafe-inline\' %s; ', GK_CDN_SERVER_URL)
.'style-src-attr \'self\' \'unsafe-inline\'; '
Expand Down
4 changes: 4 additions & 0 deletions website/app/GeoKrety/Controller/Devel/DatabaseSeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public function geokrety(\Base $f3) {
$geokret->born_on_datetime = $f3->get('GET.birthdate');
$geokret->save();
}
if ($f3->exists('GET.type')) {
$geokret->type = $f3->get('GET.type');
$geokret->save();
}
}

echo 'OK';
Expand Down
Loading

0 comments on commit 0a39abc

Please sign in to comment.