Skip to content
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
2 changes: 1 addition & 1 deletion app/controllers/chapters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ChaptersController < ApplicationController

# GET /chapters or /chapters.json
def index
@countries = Country.order(:name)
@countries = Country.joins(:chapters).distinct.order(:name)
@country_param = determine_country_param
@chapters = filter_chapters_by_country
load_country_data if @country_param
Expand Down
23 changes: 22 additions & 1 deletion app/helpers/chapters_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,48 @@ def country_icon(country_name)
'Botswana' => 'countries/country_botswana.png',
'Burkina Faso' => 'countries/country_burkina_faso.png',
'Burundi' => 'countries/country_burundi.png',
'Cape Verde' => 'countries/country_cape_verde.png',
'Cameroon' => 'countries/country_cameroon.png',
'Central African Republic' => 'countries/country_central_african_republic.png',
'Chad' => 'countries/country_chad.png',
'Democratic Republic of Congo' => 'countries/country_democratic_republic_of_congo.png',
'Comoros' => 'countries/country_comoros.png',
'Congo' => 'countries/congo.png',
'DR Congo' => 'countries/country_democratic_republic_of_congo.png',
'Djibouti' => 'countries/country_djibouti.png',
'Egypt' => 'countries/country_egypt.png',
'Equatorial Guinea' => 'countries/country_equatorial_guinea.png',
'Eritrea' => 'countries/country_eritrea.png',
'Eswatini' => 'countries/country_eswatini.png',
'Ethiopia' => 'countries/country_ethiopia.png',
'Gabon' => 'countries/country_gabon.png',
'Gambia' => 'countries/country_gambia.png',
'Ghana' => 'countries/country_ghana.png',
'Guinea' => 'countries/country_guinea.png',
'Guinea-Bissau' => 'countries/country_guinea_bissau.png',
'Ivory Coast' => 'countries/country_ivory_coast.png',
'Kenya' => 'countries/country_kenya.png',
'Lesotho' => 'countries/country_lesotho.png',
'Liberia' => 'countries/country_liberia.png',
'Libya' => 'countries/country_libya.png',
'Madagascar' => 'countries/country_madagascar.png',
'Mali' => 'countries/country_mali.png',
'Malawi' => 'countries/country_malawi.png',
'Mauritania' => 'countries/country_mauritania.png',
'Mauritius' => 'countries/country_mauritius.png',
'Morocco' => 'countries/country_morocco.png',
'Mozambique' => 'countries/country_mozambique.png',
'Namibia' => 'countries/country_namibia.png',
'Niger' => 'countries/country_niger.png',
'Nigeria' => 'countries/country_nigeria.png',
'Rwanda' => 'countries/country_rwanda.png',
'Sao Tome & Principe' => 'countries/country_sao_tome_and_principe.png',
'Senegal' => 'countries/country_senegal.png',
'Seychelles' => 'countries/country_seychelles.png',
'Sierra Leone' => 'countries/country_sierra_leone.png',
'Somalia' => 'countries/country_somalia.png',
'South Africa' => 'countries/country_south_africa.png',
'South Sudan' => 'countries/country_south_sudan.png',
'Sudan' => 'countries/country_sudan.png',
'Tanzania' => 'countries/country_tanzania.png',
'Togo' => 'countries/country_togo.png',
'Tunisia' => 'countries/country_tunisia.png',
Expand Down
2 changes: 1 addition & 1 deletion app/views/chapters/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</div>

<!-- Upcoming Events from that country -->
<div class="mt-16">
<div class="mt-16" style="display: none">
<h2 class="text-2xl font-bold mb-6">Upcoming events</h2>
<% if @upcoming_events.present? %>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 sm:gap-8">
Expand Down
6 changes: 6 additions & 0 deletions app/views/countries/_updated_country.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div id="<%= dom_id country %>">
<p>
<strong>Name:</strong>
<%= country.name %>
</p>
</div>
2 changes: 1 addition & 1 deletion app/views/learning_materials/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>

<!-- Search Bar -->
<div class="mb-8">
<div class="mb-8" style="display: none">
<%= form_with url: learning_materials_path, method: :get, local: true, class: 'max-w-4xl' do %>
<div class="flex gap-4 items-center">
<div class="relative flex-1">
Expand Down