Skip to content

Commit

Permalink
Test implementation of Popups on Category pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nischayn22 committed Aug 27, 2023
1 parent b362c11 commit 03e743a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
9 changes: 7 additions & 2 deletions includes/Folc.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,19 @@ public function getTemplateData() {

foreach( $countries as $country ){

$country_pages = $dbr->newSelectQueryBuilder()
$country_pages = $dbr->newSelectQueryBuilder()
->select( '*' )
->from( 'cargo__' . 'Articles' )
->where(['Country__full LIKE "%' . $country->Country . '%"', 'Subject__full LIKE "%' . $wgTitle->getFullText() . '%"'] )
->caller( __METHOD__ )
->fetchResultSet();

$data[$country->Continent . '_filtered'][] = [ 'country' => $country->Country, 'count' => $country_pages->numRows() ];
$page_list = [];
foreach( $country_pages as $page ) {
$page_list[] = \Title::newFromID( $page->_pageID )->getFullText();
}

$data[$country->Continent . '_filtered'][] = [ 'country' => $country->Country, 'count' => $country_pages->numRows(), 'list' => $page_list ];
}

} else if ( array_key_exists( "Category:SDG", $this_page_categories ) ) {
Expand Down
Binary file modified templates/.DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion templates/Header.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@
<a class="nav-link text-primary" href="/(11)_Sustainable_Cities_and_Communities">11 - Sustainable cities and communities</a>
</li>
</ul>
</div> </div>
</div>
</div>
</li>
<li class="d-flex d-md-none pt-0 pb-3">
<nav class="navbar navbar--mobile-menu-footer">
Expand Down
18 changes: 16 additions & 2 deletions templates/category.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,28 @@
<div class="tab-pane bg-white active" id="countries-africa-multi" role="tabpanel">
<div class="p-5 navbar d-block">
<ul class="countries-cols css-columns-lg-4 list-unstyled">
{{#Africa_filtered}}<li><a href="{{country}}" class="nav-link">{{country}} ({{count}})</a></li>{{/Africa_filtered}}
{{#Africa_filtered}}<li>
<a href="#" class="nav-link a-link d-inline-block" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{country}} ({{count}})</a>
<div class="dropdown-menu position-absolute w-100 pt-0 ml-n2 show">
<div class="dropdown-header d-flex align-items-center bg-primary text-white">
<h3 class="h2 d-none d-md-block">{{country}}</h3>
<a href="/{{country}}" class="a-link with-prefix text-white ml-auto h5 font-body mb-0 ">Go to {{country}} ({{count}}) </a>
<div class="dropdown-close d-none bg-white text-primary rounded-circle ml-5 d-md-flex justify-content-center align-items-center">×</div>
</div>
<div class="row p-2 py-3">
<div class="col-12 col-md-12">{{#list}}
<a class="nav-link with-prefix " href="/{{.}}">{{.}}</a>{{/list}}
</div>
</div>
</div>
</li>{{/Africa_filtered}}
</ul>
</div>
</div>
<div class="tab-pane bg-white" id="countries-asia-multi" role="tabpanel">
<div class="p-5 navbar d-block">
<ul class="countries-cols css-columns-lg-4 list-unstyled">
{{#Asia_filtered}}<li><a href="{{country}}" class="nav-link">{{country}} ({{count}})</a></li>{{/Asia_filtered}}
{{#Asia_filtered}}<li><a href="#" class="nav-link a-link d-inline-block" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{country}} ({{count}})</a></li>{{/Asia_filtered}}
</ul>
</div>
</div>
Expand Down

0 comments on commit 03e743a

Please sign in to comment.