Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show occurrence photos in site visit detail #3480

Merged
merged 1 commit into from
Sep 17, 2023
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
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
Loading