Skip to content

Display a placeholder that indicates "no photos available" when appli… #261

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
16 changes: 15 additions & 1 deletion public/css/main/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@
margin: auto;
}

#no_image{
text-align: center;
font-size: 24px;
font-weight: bold;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: normal;
color: black;
margin-top: 60px;
margin-bottom: 6px;
max-width: 85%;
}

#sidebar-image-credit {
position: absolute;
bottom: 0;
Expand Down Expand Up @@ -269,4 +283,4 @@ span#sidebar-heritage-number {
}
#sidebar-heritage-description-container.active {
display: inline-block;
}
}
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ <h5>Nearest address: <span id="sidebar-vacant-address"></h5>
</div>
</div>
<div id="sidebar-tree">
<span id="no_image">No photos available</span>
<div id="sidebar-image" class="shadow hidden sidebar-image">
<div id="leftButton" class="sliderButton"><button onclick="lastSlideImage()"><</button></div>
<div id="rightButton" class="sliderButton"><button onclick="nextSlideImage()">></button></div>
Expand Down
7 changes: 5 additions & 2 deletions public/js/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var initialY = null;
this.treeContainer = document.getElementById('sidebar-tree');
this.errorScreen = document.getElementById('sidebar-error');
this.image = document.getElementById('sidebar-image');
this.no_image = document.getElementById('no_image');
this.imageCreditLink = document.getElementById('sidebar-image-credit-link');
this.commonName = document.getElementById('sidebar-common-name');
this.botanicalName = document.getElementById('sidebar-botanical-name');
Expand All @@ -41,8 +42,8 @@ var initialY = null;
this.detailsButton = document.getElementById('sidebar-details-button');
//Heritage Trees
this.heritageContainer = document.getElementById('sidebar-heritage-container');
this.heritageTreeNumber = document.getElementById('sidebar-heritage-number');
this.heritageTreeNumber = document.getElementById('sidebar-heritage-number');
this.heritageTreeNumber = document.getElementById('sidebar-heritage-number');
this.heritageTreeNumber = document.getElementById('sidebar-heritage-number');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's changed here? I'm not quite sure why this.heritageTreeNumber = document.getElementById('sidebar-heritage-number'); appears twice in a row, but it was written that way before, too

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall changing this part. Maybe I changed it by accident, it's not a part of my solution

this.heritageYearInscribed = document.getElementById('sidebar-heritage-year-inscribed');
this.heritageDescriptionContainer = document.getElementById('sidebar-heritage-description-container');
this.heritageDescription = document.getElementById('sidebar-heritage-description');
Expand Down Expand Up @@ -130,12 +131,14 @@ var initialY = null;
this.image.style.backgroundImage = 'url(' + tree.images[1].url + ')';
this.image.style.backgroundSize = 'cover';
this.image.classList.remove('hidden');
this.no_image.classList.add('hidden');

this.imageCreditLink.href = tree.images[1].author.url;
images = tree.images;
} else {
this.image.style.backgroundImage = '';
this.image.classList.add('hidden');
this.no_image.classList.remove('hidden');
}
if (tree.heritage === true) {
this.heritageContainer.classList.add('active');
Expand Down