Skip to content

Commit

Permalink
update the templates for new Bootstrap
Browse files Browse the repository at this point in the history
replace the Photos front page with something that lists Family names
Add link from species page to family page
be sure to show all matches during search box
  • Loading branch information
wfwalker committed Jul 9, 2020
1 parent 44449ac commit 79f5b54
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
3 changes: 2 additions & 1 deletion server/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ $(document).ready(function() {
this.$element[0].form.submit();
return item;
},
minLength: 3
minLength: 3,
items: 'all'
})
});
4 changes: 4 additions & 0 deletions server/scripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ class Application {
let taxonSightingList = new SightingList(tmp, photos)
taxonSightingList.sortByDate()

let family_name = Object.keys(taxonSightingList.getTaxonomyHierarchy())[0]
logger.debug('dataForTaxonTemplate, family name', family_name)

return {
name: req.params.common_name,
family_name: family_name,
category: SightingList.getCategoryFromCommonName(req.params.common_name),
scientificName: taxonSightingList.rows[0]['Scientific Name'],
photos: taxonSightingList.photos,
Expand Down
2 changes: 0 additions & 2 deletions server/scripts/sightinglist.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,6 @@ class SightingList {
getTaxonomyHierarchy () {
var byFamily = {}

logger.debug(byFamily)

for (var index = 0; index < this.rows.length; index++) {
var aSighting = this.rows[index]
var commonName = aSighting['Common Name']
Expand Down
2 changes: 1 addition & 1 deletion server/views/layouts/default.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DefaultLayout extends React.Component {
</div>
</li>

<form action='/search' method='GET' className="form-inline" role="search">
<form action='/search' method='GET' className="pl-5-lg form-inline" role="search">
<div className="form-group">
<input id='searchtext' name='searchtext' data-provide="typeahead" type="text" className="typeahead form-control" placeholder="Search" />
</div>
Expand Down
20 changes: 12 additions & 8 deletions server/views/photos.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ class Photos extends BirdwalkerComponent {
let randomImage = family[Math.floor(Math.random() * family.length)]

return (
<a href={'/family/' + familyName}>
<img alt={this.commonNameFromEbirdFamily(familyName)} src={randomImage['Photo URL']} />
</a>
<div className='col-md-4'>
<div style={{fontWeight: 'bold', paddingTop: '2em', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>
<a href={'/family/' + familyName}>{this.commonNameFromEbirdFamily(familyName)}</a>
</div>
<a href={'/family/' + familyName}>
<img alt={this.commonNameFromEbirdFamily(familyName)} src={randomImage['Photo URL']} className='img-fluid'/>
</a>
</div>
)
}

Expand Down Expand Up @@ -59,14 +64,13 @@ class Photos extends BirdwalkerComponent {
</div>

<div className='row'>
<div className='col-md-12'>
<div className='col'>
<PageHeading title={this.props.numSpecies + ' species photographed'} />

<div className='mygallery'>
{familyNames.map(familyName => this.generateImageForFamily(familyName, this.props.photosByFamily[familyName]))}
</div>
</div>
</div>
<div className='row'>
{familyNames.map(familyName => this.generateImageForFamily(familyName, this.props.photosByFamily[familyName]))}
</div>

</DefaultLayout>
)
Expand Down
3 changes: 3 additions & 0 deletions server/views/taxon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var React = require('react')
import DefaultLayout from './layouts/default.jsx'
import BirdwalkerComponent from './birdwalkercomponent.jsx'
import PageHeading from './pageheading.jsx'
import { LinkToFamily } from './utilities.jsx'

var moment = require('moment')

Expand Down Expand Up @@ -32,6 +33,8 @@ class Taxon extends BirdwalkerComponent {
<DefaultLayout title={this.props.name} subtitle={this.props.scientificName}>
<PageHeading title={this.props.name} subtitle={this.props.scientificName} />

<p><LinkToFamily family={this.props.family_name} /></p>

{(this.props.category != 'species') && <CategoryExplainer category={this.props.category} />}

{this.generateThumbnails()}
Expand Down

0 comments on commit 79f5b54

Please sign in to comment.