Skip to content

Commit

Permalink
Show occurrence photos in site visit detail (#3480)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimasciput authored Sep 17, 2023
1 parent 20179b6 commit 9dd3401
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
34 changes: 31 additions & 3 deletions bims/templates/site_visit/site_visit_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
.btn-normal {
margin-bottom: 10px;
}
.third-party-wrapper {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
}
.third-party-wrapper .item {
padding: 5px;
}

</style>

{% endblock %}
Expand Down Expand Up @@ -333,16 +343,34 @@ <h2>Detail {{ taxon_group.name }} data for site {% if object.site.site_code %}{{
</div>
{% endif %}
<div class="form-group row">
<label for="date"
class="col-sm-2 col-form-label col-form-label">Site
<label for="site-image"
class="col-sm-2 col-form-label">Site
Image</label>
<div class="col-sm-10">
<div class="form-group">
<img src="{{ site_image.image.url }}" height="200">
{% if site_image %}
<img src="{{ site_image.image.url }}" height="200">
{% else %}
<input class="form-control" disabled value="-">
{% endif %}
</div>
</div>
</div>

<div class="form-group row">
<label for="occurrence-images" class="col-sm-2 col-form-label">
Occurrence Photos
</label>
<div class="col-sm-10 third-party-wrapper">
{% for taxon_image in taxon_images %}
<div class="item">
<img src="{{ taxon_image.taxon_image.url }}" style="max-height: 350px">
<p>{{ taxon_image.taxonomy.canonical_name }}</p>
</div>
{% endfor %}
</div>
</div>

{# ------ ALGAE BIOMASS FORM ------- #}
{% if taxon_group.name == 'Algae' %}
{% include 'collections_form_layouts/algae_biomass.html' %}
Expand Down
9 changes: 9 additions & 0 deletions bims/views/site_visit/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from bims.models.chem import Chem
from bims.models.basemap_layer import BaseMapLayer
from bims.enums.ecosystem_type import HYDROPERIOD_CHOICES
from bims.models.taxonomy import TaxonImage


class SiteVisitBaseView(View):
Expand Down Expand Up @@ -199,4 +200,12 @@ def get_context_data(self, **kwargs):
)
except SiteImage.DoesNotExist:
pass

try:
context['taxon_images'] = TaxonImage.objects.filter(
survey=self.object
)
except TaxonImage.DoesNotExist:
pass

return context

0 comments on commit 9dd3401

Please sign in to comment.