Skip to content

Commit 966c23a

Browse files
add tabs
1 parent 939396e commit 966c23a

File tree

3 files changed

+93
-61
lines changed

3 files changed

+93
-61
lines changed

hurumap_ng/profiles.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,34 @@ def get_profile(geo, profile_name, request):
3535
if function_name in globals():
3636
func = globals()[function_name]
3737
data[section] = func(geo, session)
38+
39+
40+
tabs = []
41+
if not data['demographics'].get('is_missing'):
42+
tabs.append({'name': 'Demographics', 'href': '#demographics'})
43+
44+
if not data['health'].get('is_missing'):
45+
tabs.append({'name': 'Health', 'href': '#health'})
46+
47+
if not data['education'].get('is_missing'):
48+
tabs.append({'name': 'Education', 'href': '#education'})
49+
50+
if not data['agriculture'].get('is_missing'):
51+
tabs.append({'name': 'Agriculture', 'href': '#agriculture'})
52+
53+
if not data['crime'].get('is_missing'):
54+
tabs.append({'name': 'Corruption & Crime', 'href': '#crime'})
55+
56+
if not data['drugs'].get('is_missing'):
57+
tabs.append({'name': 'Drugs', 'href': '#drugs'})
58+
59+
if not data['finance'].get('is_missing'):
60+
tabs.append({'name': 'Finances', 'href': '#finance'})
61+
62+
if not data['others'].get('is_missing'):
63+
tabs.append({'name': 'Others', 'href': '#others'})
64+
65+
data['tabs'] = tabs
3866
return data
3967

4068
finally:
@@ -521,7 +549,7 @@ def get_health_profile(geo, session):
521549
return final_data
522550

523551

524-
def get_transportation_profile(geo, session):
552+
def get_others_profile(geo, session):
525553
diseal_yearly = LOCATIONNOTFOUND
526554
diseal_price_2015 = LOCATIONNOTFOUND
527555
diesel_price_2016 = LOCATIONNOTFOUND

hurumap_ng/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999

100100
# -------------------------------------------------------------------------------------
101101
# Profile Sections
102-
HURUMAP['topics'] = {'demographics', 'education', 'health', 'crime', 'drugs', 'agriculture', 'transportation', 'finance'}
102+
HURUMAP['topics'] = {'demographics', 'education', 'health', 'crime', 'drugs', 'agriculture', 'others', 'finance'}
103103

104104
LOGGING["loggers"]["hurumap_ng"] = {"level": "DEBUG" if DEBUG else "INFO"}
105105

hurumap_ng/templates/profile/profile_detail.html

Lines changed: 63 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
src="{% static 'img/icons/favicon.ico' %}">{{ geography.this.name }}
1010
</span>
1111
</div>
12+
<ul>
13+
{% for tab in tabs %}
14+
<li><a href={{tab.href}}><span>{{tab.name}}</span></a>
15+
</li>
16+
{% endfor %}
17+
</ul>
1218
</div>
1319
</nav>
1420
</div>
@@ -525,147 +531,175 @@ <h3 class="chart-header">Corruption Index</h3>
525531
</div>
526532
</article>
527533
{% endif %}
528-
529-
{% if not transportation.is_missing %}
534+
{% if not finance.is_missing %}
535+
<article id="transportation" class="clearfix">
536+
<header class="section-contents"><h1>Finances</h1></header>
537+
<div class="section-container">
538+
{% if not finance.bank_credit.is_missing and not finance.bank_deposit.is_missing %}
539+
<section class="clearfix stat-row">
540+
{% if not finance.bank_credit.is_missing %}
541+
<div class="column-half">
542+
<div id="chart-column-finance-bank_credit"
543+
data-chart-title="Bank Credit 2010 - 2015, (N' Million)"
544+
data-stat-type="number"
545+
data-source-title="National Bureau of Statistics, 2018"
546+
data-source-link="https://nigerianstat.gov.ng/download/384"></div>
547+
</div>
548+
{% endif %}
549+
{% if not finance.bank_deposit.is_missing %}
550+
<div class="column-half">
551+
<div id="chart-column-finance-bank_deposit"
552+
data-chart-title="Bank Deposit 2010 - 2015, (N' Million)"
553+
data-stat-type="number"
554+
data-source-title="National Bureau of Statistics, 2018"
555+
data-source-link="https://nigerianstat.gov.ng/download/384"></div>
556+
</div>
557+
{% endif %}
558+
</section>
559+
{% endif %}
560+
</div>
561+
</article>
562+
{% endif %}
563+
{% if not others.is_missing %}
530564
<article id="transportation" class="clearfix">
531-
<header class="section-contents"><h1>Transportation</h1></header>
565+
<header class="section-contents"><h1>Others</h1></header>
532566
<div class="section-container">
533-
{% if not transportation.driver_licences_processed.is_missing %}
567+
{% if not false %}
534568
<section class="clearfix stat-row">
535569
<div class="column-full">
536-
<div id="chart-column-transportation-driver_licences_processed"
570+
<div id="chart-column-others-driver_licences_processed"
537571
data-chart-title="Drivers Licences Processed (2013 - 2015)"
538572
data-stat-type="number"
539573
data-source-title="National Bureau of Statistics, 2016"
540574
data-source-link="https://nigerianstat.gov.ng/download/359"></div>
541575
</div>
542576
</section>
543577
{% endif %}
544-
{% if not transportation.air_transportation_domestic.is_missing %}
578+
{% if not others.air_transportation_domestic.is_missing %}
545579
<section class="clearfix stat-row">
546580
<div class="column-full">
547-
<div id="chart-grouped_column-transportation-air_transportation_domestic"
581+
<div id="chart-grouped_column-others-air_transportation_domestic"
548582
data-chart-title="Number of Passengers 2018, Domestics Flights"
549583
data-stat-type="number"
550584
data-source-title="National Bureau of Statistics, 2018"
551585
data-source-link="https://nigerianstat.gov.ng/resource/JAN-DEC%202018%20Harmonised%20Air%20Traffic%20Statistics.xlsx"></div>
552586
</div>
553587
</section>
554588
{% endif %}
555-
{% if not transportation.air_transportation_international.is_missing %}
589+
{% if not others.air_transportation_international.is_missing %}
556590
<section class="clearfix stat-row">
557591
<div class="column-full">
558-
<div id="chart-grouped_column-transportation-air_transportation_international"
592+
<div id="chart-grouped_column-others-air_transportation_international"
559593
data-chart-title="Number of Passengers 2018, International Flights"
560594
data-stat-type="number"
561595
data-source-title="National Bureau of Statistics, 2018"
562596
data-source-link="https://nigerianstat.gov.ng/resource/JAN-DEC%202018%20Harmonised%20Air%20Traffic%20Statistics.xlsx"></div>
563597
</div>
564598
</section>
565599
{% endif %}
566-
{% if not transportation.diesel_year.is_missing %}
600+
{% if not others.diesel_year.is_missing %}
567601
<section class="clearfix stat-row">
568602
<div class="column-full">
569-
<div id="chart-column-transportation-diesel_year"
603+
<div id="chart-column-others-diesel_year"
570604
data-chart-title="Yearly Average Diesel Price per litre (₦)"
571605
data-stat-type="number"
572606
data-source-title="National Bureau of Statistics, 2019"
573607
data-source-link="https://nigerianstat.gov.ng/resource/DIESEL%20may%202019.xlsx"></div>
574608
</div>
575609
</section>
576610
{% endif %}
577-
{% if not transportation.petrol_price.2019.is_missing %}
611+
{% if not others.petrol_price.2019.is_missing %}
578612
<section class="clearfix stat-row">
579613
<div class="column-full">
580-
<div id="chart-column-transportation-petrol_price-2019"
614+
<div id="chart-column-others-petrol_price-2019"
581615
data-chart-title="Petrol Price Jan to Dec 2019"
582616
data-stat-type="number"
583617
data-source-title="National Bureau of Statistics, 2019"
584618
data-source-link="https://nigerianstat.gov.ng/download/923"></div>
585619
</div>
586620
</section>
587621
{% endif %}
588-
{% if not transportation.diesel_price.2019.is_missing %}
622+
{% if not others.diesel_price.2019.is_missing %}
589623
<section class="clearfix stat-row">
590624
<div class="column-full">
591-
<div id="chart-column-transportation-diesel_price-2019"
625+
<div id="chart-column-others-diesel_price-2019"
592626
data-chart-title="Desel Price Jan to Dec 2019"
593627
data-stat-type="number"
594628
data-source-title="National Bureau of Statistics, 2019"
595629
data-source-link="https://nigerianstat.gov.ng/download/921"></div>
596630
</div>
597631
</section>
598632
{% endif %}
599-
{% if not transportation.petrol_price.2018.is_missing %}
633+
{% if not others.petrol_price.2018.is_missing %}
600634
<section class="clearfix stat-row">
601635
<div class="column-full">
602-
<div id="chart-column-transportation-petrol_price-2018"
636+
<div id="chart-column-others-petrol_price-2018"
603637
data-chart-title="Petrol Price Jan to Dec 2018"
604638
data-stat-type="number"
605639
data-source-title="National Bureau of Statistics, 2019"
606640
data-source-link="https://nigerianstat.gov.ng/download/923"></div>
607641
</div>
608642
</section>
609643
{% endif %}
610-
{% if not transportation.diesel_price.2018.is_missing %}
644+
{% if not others.diesel_price.2018.is_missing %}
611645
<section class="clearfix stat-row">
612646
<div class="column-full">
613-
<div id="chart-column-transportation-diesel_price-2018"
647+
<div id="chart-column-others-diesel_price-2018"
614648
data-chart-title="Desel Price Jan to Dec 2018"
615649
data-stat-type="number"
616650
data-source-title="National Bureau of Statistics, 2019"
617651
data-source-link="https://nigerianstat.gov.ng/download/921"></div>
618652
</div>
619653
</section>
620654
{% endif %}
621-
{% if not transportation.petrol_price.2017.is_missing %}
655+
{% if not others.petrol_price.2017.is_missing %}
622656
<section class="clearfix stat-row">
623657
<div class="column-full">
624-
<div id="chart-column-transportation-petrol_price-2017"
658+
<div id="chart-column-others-petrol_price-2017"
625659
data-chart-title="Petrol Price Jan to Dec 2017"
626660
data-stat-type="number"
627661
data-source-title="National Bureau of Statistics, 2019"
628662
data-source-link="https://nigerianstat.gov.ng/download/923"></div>
629663
</div>
630664
</section>
631665
{% endif %}
632-
{% if not transportation.diesel_price.2017.is_missing %}
666+
{% if not others.diesel_price.2017.is_missing %}
633667
<section class="clearfix stat-row">
634668
<div class="column-full">
635-
<div id="chart-column-transportation-diesel_price-2017"
669+
<div id="chart-column-others-diesel_price-2017"
636670
data-chart-title="Desel Price Jan to Dec 2017"
637671
data-stat-type="number"
638672
data-source-title="National Bureau of Statistics, 2019"
639673
data-source-link="https://nigerianstat.gov.ng/download/921"></div>
640674
</div>
641675
</section>
642676
{% endif %}
643-
{% if not transportation.petrol_price.2016.is_missing %}
677+
{% if not others.petrol_price.2016.is_missing %}
644678
<section class="clearfix stat-row">
645679
<div class="column-full">
646-
<div id="chart-column-transportation-petrol_price-2016"
680+
<div id="chart-column-others-petrol_price-2016"
647681
data-chart-title="Petrol Price Jan to Dec 2016"
648682
data-stat-type="number"
649683
data-source-title="National Bureau of Statistics, 2019"
650684
data-source-link="https://nigerianstat.gov.ng/download/923"></div>
651685
</div>
652686
</section>
653687
{% endif %}
654-
{% if not transportation.diesel_price.2016.is_missing %}
688+
{% if not others.diesel_price.2016.is_missing %}
655689
<section class="clearfix stat-row">
656690
<div class="column-full">
657-
<div id="chart-column-transportation-diesel_price-2016"
691+
<div id="chart-column-others-diesel_price-2016"
658692
data-chart-title="Desel Price Jan to Dec 2016"
659693
data-stat-type="number"
660694
data-source-title="National Bureau of Statistics, 2019"
661695
data-source-link="https://nigerianstat.gov.ng/download/921"></div>
662696
</div>
663697
</section>
664698
{% endif %}
665-
{% if not transportation.diesel_price.2015.is_missing %}
699+
{% if not others.diesel_price.2015.is_missing %}
666700
<section class="clearfix stat-row">
667701
<div class="column-full">
668-
<div id="chart-column-transportation-diesel_price-2015"
702+
<div id="chart-column-others-diesel_price-2015"
669703
data-chart-title="Desel Price Jan to Dec 2015"
670704
data-stat-type="number"
671705
data-source-title="National Bureau of Statistics, 2019"
@@ -676,34 +710,4 @@ <h3 class="chart-header">Corruption Index</h3>
676710
</div>
677711
</article>
678712
{% endif %}
679-
680-
{% if not finance.is_missing %}
681-
<article id="transportation" class="clearfix">
682-
<header class="section-contents"><h1>Finances</h1></header>
683-
<div class="section-container">
684-
{% if not finance.bank_credit.is_missing and not finance.bank_deposit.is_missing %}
685-
<section class="clearfix stat-row">
686-
{% if not finance.bank_credit.is_missing %}
687-
<div class="column-half">
688-
<div id="chart-column-finance-bank_credit"
689-
data-chart-title="Bank Credit 2010 - 2015, (N' Million)"
690-
data-stat-type="number"
691-
data-source-title="National Bureau of Statistics, 2018"
692-
data-source-link="https://nigerianstat.gov.ng/download/384"></div>
693-
</div>
694-
{% endif %}
695-
{% if not finance.bank_deposit.is_missing %}
696-
<div class="column-half">
697-
<div id="chart-column-finance-bank_deposit"
698-
data-chart-title="Bank Deposit 2010 - 2015, (N' Million)"
699-
data-stat-type="number"
700-
data-source-title="National Bureau of Statistics, 2018"
701-
data-source-link="https://nigerianstat.gov.ng/download/384"></div>
702-
</div>
703-
{% endif %}
704-
</section>
705-
{% endif %}
706-
</div>
707-
</article>
708-
{% endif %}
709713
{% endblock %}

0 commit comments

Comments
 (0)