-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #32 transformering og fixer for påvirkningsfaktorer
Visning gjenstår
- Loading branch information
Showing
5 changed files
with
351 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
228 changes: 228 additions & 0 deletions
228
Assessments.Frontend.Web/Views/Redlist/Assessment/partials/_ImpactFactors.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
@model SpeciesAssessment2021 | ||
@functions{ | ||
|
||
// Snatched and shortened from 2018 nature red list, | ||
// Not yet ready for use. | ||
// https://github.com/Artsdatabanken/RodlisteNaturtyper2018visning/blob/2019update/Views/Home/Partials/impact-factors.cshtml | ||
string ImpactIcon(string mainTitle, string subtitle) | ||
{ | ||
|
||
// 0. ingen trussel / no factor has no image, as it is never displayed. | ||
if (mainTitle == "Forurensing") | ||
{ // 2 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "forurensing" + ".png"; | ||
} | ||
else if (mainTitle == "Høsting") | ||
{ // 3 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "høsting" + ".png"; | ||
} | ||
else if (mainTitle == "Tilfeldig mortalitet") | ||
{ // 4 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "ukjent" + ".png"; // TODO - MISSING | ||
} | ||
else if (mainTitle == "Fremmede arter") | ||
{ // 5 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "fremmedarter" + ".png"; | ||
} | ||
else if (subtitle != null && subtitle.Contains("stedegne")) | ||
{ // 6 "påvirkning fra stedegne arter" | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "stedegne" + ".png"; | ||
} | ||
else if (mainTitle == "Klimatiske endringer") | ||
{ // 7 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "klima" + ".png"; | ||
} | ||
else if (mainTitle == "Naturkatastrofer") | ||
{ // 8 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "naturkatastrofe" + ".png"; | ||
} | ||
else if (mainTitle == "Menneskelig forstyrrelse") | ||
{ // 9 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "menneske" + ".png"; | ||
} | ||
else if (mainTitle == "Andre") | ||
{ // 10 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "andre" + ".png"; | ||
} | ||
else if (subtitle != null && subtitle.Contains("Ukjent")) | ||
{ // 11 ukjent | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "ukjent" + ".png"; | ||
} | ||
else if (subtitle != null && subtitle.Contains("Påvirkning utenfor Norge")) | ||
{ // 12 | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "ukjent" + ".png"; // TODO - MISSING | ||
} | ||
else if (subtitle != null && subtitle.Contains("Landbruk")) | ||
{ // 1.1 habitat | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "landbruk" + ".png"; | ||
} | ||
else if (subtitle != null && subtitle.Contains("terrestrisk")) | ||
{ // 1.2 habitat | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "terrestisk" + ".png"; | ||
} | ||
else if (subtitle != null && subtitle.Contains("limnisk")) | ||
{ // 1.3 habitat | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "limnisk" + ".png"; | ||
} | ||
else if (subtitle != null && subtitle.Contains("marine")) | ||
{// 1.4 habitat | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "marint" + ".png"; | ||
} | ||
else | ||
{ | ||
return "https://artsdatabanken.no/RLN2018/media/impact/" + "ukjent" + ".png"; | ||
} | ||
} | ||
|
||
public string iconfinder(string factor) | ||
{ | ||
@if (factor == "Ingen trussel") | ||
{ | ||
return "delete_sweep"; | ||
} | ||
else if (factor == "Påvirkning på habitat") | ||
{ | ||
return "nature"; | ||
} | ||
else if (factor == "Forurensning") | ||
{ | ||
return "recycling"; | ||
} | ||
else if (factor == "Høsting") | ||
{ | ||
return "gradient"; | ||
} | ||
else if (factor == "Tilfeldig mortalitet") | ||
{ | ||
return "close"; | ||
} | ||
else if (factor == "Fremmede arter") | ||
{ | ||
return "pest_control"; | ||
} | ||
else if (factor == "Påvirkning fra stedegne arter") | ||
{ | ||
return "nature"; | ||
} | ||
else if (factor == "Klimatiske endringer") | ||
{ | ||
return "cloud"; | ||
} | ||
else if (factor == "Naturkatastrofer") | ||
{ | ||
return "air"; | ||
} | ||
else if (factor == "Menneskelig forstyrrelse") | ||
{ | ||
return "engineering"; | ||
} | ||
else if (factor == "Andre") | ||
{ | ||
return "lens_blur"; | ||
} | ||
else if (factor == "Ukjent") | ||
{ | ||
return "lens_blur"; | ||
} | ||
else if (factor == "Påvirkning utenfor Norge") | ||
{ | ||
return "public"; | ||
} | ||
else | ||
{ | ||
return "delete"; | ||
} | ||
} | ||
} | ||
|
||
|
||
<div class="page_section"> | ||
<h2>Påvirkningsfaktorer </h2> | ||
|
||
<p class="fact_box"> @ViewBag.glossary["oneliners"]["Påvirkningsfaktorer"]</p> | ||
|
||
<div class="factors"> | ||
@{foreach (var pfaktor in Model.ImpactFactors) | ||
{ | ||
<div class="fake_table_header"> | ||
<div class="stats_element_container"> | ||
<img src="@ImpactIcon(@pfaktor.GroupingFactor,@pfaktor.Factor)" class="paavirk" /> | ||
</div> | ||
<div class="stats_element_text topalign"> | ||
<h3>@pfaktor.GroupingFactor</h3> | ||
@* todo: se om stien skal brukes, inneholder også toppnivå - kan fjernes under ved å skrive pfaktor.FactorPath.Skip(1) *@ | ||
<h5> Sti: @string.Join(" > ", pfaktor.FactorPath.Skip(1))</h5> | ||
<b>@pfaktor.Id - @pfaktor.Factor</b> | ||
|
||
</div> | ||
</div> | ||
<div class="fake_table"> | ||
<div> | ||
<h3>Omfang</h3> | ||
|
||
@{ | ||
|
||
var omfang_text = @pfaktor.PopulationScope; | ||
var omfang_numbers = ""; | ||
|
||
if (omfang_text.Contains("(")) | ||
{ | ||
// Split out the percentages etc. from the main string. | ||
// Percentages appear to always be enclosed in "()". | ||
omfang_text = omfang_text.Split("(")[0]; | ||
omfang_numbers = @pfaktor.PopulationScope.Split("(")[1].Replace(")", ""); | ||
} | ||
|
||
} | ||
<span>@omfang_text</span><br /> | ||
@if (omfang_text.Contains("(")) | ||
{ | ||
<span class="stats_element"> | ||
<span>@omfang_numbers</span> | ||
</span> | ||
} | ||
|
||
|
||
</div> | ||
<div class="sideborders"> | ||
<h3>Alvorlighetsgrad</h3> | ||
|
||
@{ | ||
var alv_text = @pfaktor.Severity; | ||
var alv_perc = ""; | ||
var alv_numbers = ""; | ||
|
||
if (alv_text.Contains("(")) | ||
{ | ||
// Split out the percentages etc. from the main string. | ||
// Percentages appear to always be enclosed in "()". | ||
alv_text = alv_text.Split("(")[0]; | ||
alv_perc = @pfaktor.Severity.Split("(")[1].Replace(")", ""); | ||
if (@pfaktor.Severity.Contains("%")) | ||
{ | ||
alv_numbers = alv_perc.Split("%")[1]; | ||
alv_perc = alv_perc.Split("%")[0] + "%"; | ||
} | ||
} | ||
} | ||
<span>@alv_text</span><br /> | ||
@if (@pfaktor.Severity.Contains("(")) | ||
{ | ||
<span class="stats_element"> | ||
<span>@alv_perc</span> | ||
</span> | ||
<span>@alv_numbers</span> | ||
} | ||
|
||
</div> | ||
<div> | ||
<h3>Tidspunkt</h3> | ||
@pfaktor.TimeScope | ||
</div> | ||
</div> | ||
} | ||
} | ||
|
||
</div> <!-- end pavirkningsboks --> | ||
</div> <!-- end factors --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.