Skip to content

Commit

Permalink
Merge pull request #943 from WildMeOrg/915_configurable_encounter_search
Browse files Browse the repository at this point in the history
915 configurable encounter search
  • Loading branch information
TanyaStere42 authored Dec 16, 2024
2 parents dd98899 + 879122d commit ce5bc7f
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 6 deletions.
2 changes: 2 additions & 0 deletions frontend/src/AuthenticatedSwitch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function AuthenticatedSwitch({
showAlert,
setShowAlert,
showclassicsubmit,
showClassicEncounterSearch,
}) {
const { data } = useGetMe();
const username = data?.username;
Expand All @@ -44,6 +45,7 @@ export default function AuthenticatedSwitch({
showAlert={showAlert}
setShowAlert={setShowAlert}
showclassicsubmit={showclassicsubmit}
showClassicEncounterSearch={showClassicEncounterSearch}
/>
</div>

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/FrontDesk.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function FrontDesk() {
const [loading, setLoading] = useState(true);
const { data } = useGetSiteSettings();
const showclassicsubmit = data?.showClassicSubmit;

const showClassicEncounterSearch = data?.showClassicEncounters;
const checkLoginStatus = () => {
axios
.head("/api/v3/user")
Expand Down Expand Up @@ -93,6 +93,7 @@ export default function FrontDesk() {
showAlert={showAlert}
setShowAlert={setShowAlert}
showclassicsubmit={showclassicsubmit}
showClassicEncounterSearch={showClassicEncounterSearch}
/>
</AuthContext.Provider>
);
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/AuthenticatedAppHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function AuthenticatedAppHeader({
username,
avatar,
showclassicsubmit,
showClassicEncounterSearch,
}) {
const { visible } = useContext(FooterVisibilityContext);

Expand Down Expand Up @@ -74,6 +75,7 @@ export default function AuthenticatedAppHeader({
<Menu
username={username}
showclassicsubmit={showclassicsubmit}
showClassicEncounterSearch={showClassicEncounterSearch}
/>
</Nav>
<NotificationButton
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/components/header/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import DownIcon from "../svg/DownIcon";
import RightIcon from "../svg/RightIcon";
import { authenticatedMenu } from "../../constants/navMenu";

export default function Menu({ username, showclassicsubmit }) {
export default function Menu({
username,
showclassicsubmit,
showClassicEncounterSearch,
}) {
const [dropdownColor, setDropdownColor] = useState("transparent");

const [dropdownShows, setDropdownShows] = useState({});
Expand All @@ -21,7 +25,11 @@ export default function Menu({ username, showclassicsubmit }) {

return (
<>
{authenticatedMenu(username, showclassicsubmit).map((item, idx) => (
{authenticatedMenu(
username,
showclassicsubmit,
showClassicEncounterSearch,
).map((item, idx) => (
<Nav className="me-auto" key={idx}>
<NavDropdown
className="header-dropdown"
Expand Down
19 changes: 18 additions & 1 deletion frontend/src/constants/navMenu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React from "react";
import { FormattedMessage } from "react-intl";

const authenticatedMenu = (username, showclassicsubmit) => [
const authenticatedMenu = (
username,
showclassicsubmit,
showClassicEncounterSearch,
) => [
{
Submit: [
{
Expand Down Expand Up @@ -169,6 +173,19 @@ const authenticatedMenu = (username, showclassicsubmit) => [
),
href: `${process.env.PUBLIC_URL}/encounter-search`,
},
...(showClassicEncounterSearch
? [
{
name: (
<FormattedMessage
id="MENU_SEARCH_ENCOUNTERS_CLASSIC"
defaultMessage="Encounters (Classic)"
/>
),
href: "/encounters/encounterSearch.jsp",
},
]
: []),
{
name: (
<FormattedMessage
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"MENU_LEARN_MYBULKIMPORTS": "Meine Bulk-Importe",
"MENU_LEARN_MYPROJECTS": "Meine Projekte",
"MENU_SEARCH_ENCOUNTERS": "Begegnungen",
"MENU_SEARCH_ENCOUNTERS_CLASSIC": "Begegnungssuche (Klassisch)",
"MENU_SEARCH_INDIVIDUALS": "Individuen",
"MENU_SEARCH_SIGHTINGS": "Sichtungen",
"MENU_ANIMALS_INDIVIDUALGALLERY": "Individuelle Galerie",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"MENU_LEARN_MYBULKIMPORTS": "My Bulk Imports",
"MENU_LEARN_MYPROJECTS": "My Projects",
"MENU_SEARCH_ENCOUNTERS": "Encounters",
"MENU_SEARCH_ENCOUNTERS_CLASSIC": "Encounter Search (Classic)",
"MENU_SEARCH_INDIVIDUALS": "Individuals",
"MENU_SEARCH_SIGHTINGS": "Sightings",
"MENU_ANIMALS_INDIVIDUALGALLERY": "Individual Gallery",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locale/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"MENU_LEARN_MYBULKIMPORTS": "Mis importaciones masivas",
"MENU_LEARN_MYPROJECTS": "Mis proyectos",
"MENU_SEARCH_ENCOUNTERS": "Encuentros",
"MENU_SEARCH_ENCOUNTERS_CLASSIC": "Búsqueda de Encuentros (Clásico)",
"MENU_SEARCH_INDIVIDUALS": "Individuos",
"MENU_SEARCH_SIGHTINGS": "Avistamientos",
"MENU_ANIMALS_INDIVIDUALGALLERY": "Galería de individuos",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locale/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"MENU_LEARN_MYBULKIMPORTS": "Mes importations en masse",
"MENU_LEARN_MYPROJECTS": "Mes projets",
"MENU_SEARCH_ENCOUNTERS": "Rencontres",
"MENU_SEARCH_ENCOUNTERS_CLASSIC": "Recherche de Rencontres (Classique)",
"MENU_SEARCH_INDIVIDUALS": "Individus",
"MENU_SEARCH_SIGHTINGS": "Observations",
"MENU_ANIMALS_INDIVIDUALGALLERY": "Galerie individuelle",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locale/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"MENU_LEARN_MYBULKIMPORTS": "Le mie importazioni in massa",
"MENU_LEARN_MYPROJECTS": "I miei progetti",
"MENU_SEARCH_ENCOUNTERS": "Incontri",
"MENU_SEARCH_ENCOUNTERS_CLASSIC": "Ricerca di Incontri (Classico)",
"MENU_SEARCH_INDIVIDUALS": "Individui",
"MENU_SEARCH_SIGHTINGS": "Avvistamenti",
"MENU_ANIMALS_INDIVIDUALGALLERY": "Galleria individuale",
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/ecocean/api/SiteSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
settings.put("showClassicSubmit",
Util.booleanNotFalse(CommonConfiguration.getProperty("showClassicSubmit", context))
);

settings.put("showClassicEncounters",
Util.booleanNotFalse(CommonConfiguration.getProperty("showClassicEncounters", context))
);

Properties recaptchaProps = ShepherdProperties.getProperties("recaptcha.properties", "",
context);
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/bundles/commonConfiguration.properties
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ showTaxonomy = true
# show option for "classic" submit page in UI
showClassicSubmit = true

# show option for "classic" encounter search page in UI
showClassicEncounters = true

#for multi-species libraries, fill out the genus and species for each supported animal type, starting with genusSpecies0
genusSpecies0 = Balaenoptera acutorostrata

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/bundles/de/header.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ reportClassic = Eine Begegnung melden (Klassisch)
individuals = Einzelpersonen
viewAll = Alle anzeigen
encounters = Begegnungen
encountersClassic = Begegnungssuche (Klassisch)
viewEncounters = Begegnungen anzeigen
viewImages = Bilder anzeigen
encounterCalendar = Begegnungskalender
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/bundles/en/header.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ reportClassic = Report an encounter (Classic)
individuals = Individuals
viewAll = View All
encounters = Encounters
encountersClassic = Encounter Search (Classic)
viewEncounters = View Encounters
viewImages = View Images
encounterCalendar = Encounter Calendar
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/bundles/es/header.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ reportClassic = Informar un encuentro (Cl\u00e1sico)
individuals = Individuos
viewAll = Ver todos
encounters = Encuentros
encountersClassic = Búsqueda de Encuentros (Cl\u00e1sico)
viewEncounters = Ver Encuentros
viewImages = Ver Im\u00e1genes
encounterCalendar = Encuentro Calendario
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/bundles/fr/header.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ reportClassic = Signaler une rencontre (Classique)
individuals = Individus
viewAll = Tout voir
encounters = Rencontres
encountersClassic = Recherche de Rencontres (Classique)
viewEncounters = Voir toutes les rencontres
viewImages = Voir les images
encounterCalendar = Calendrier de rencontres
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/bundles/it/header.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ reportClassic = Segnala un incontro (Classico)
individuals = Gli esemplari
viewAll = Guarda tutto
encounters = Incontri
encountersClassic = Ricerca di Incontri (Classico)
viewEncounters = Visualizza Incontri
viewImages = Visualizza le immagini
encounterCalendar = Calendario degli incontri
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/servletResponseTemplate.htm
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
</a>
<ul class="dropdown-menu" role="menu">
<li><a href="/react/encounter-search">Encounters</a></li>

<li><a href="encounters/encounterSearch.jsp">Encounter Search (Classic)</a></li>
<li><a href="individualSearch.jsp">Individuals</a></li>
<li><a href="occurrenceSearch.jsp">Sightings</a></li>

Expand Down
4 changes: 3 additions & 1 deletion src/main/webapp/header.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ if(request.getUserPrincipal()!=null){
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><%=props.getProperty("search")%><span class="svg-placeholder"></span> </a>
<ul class="dropdown-menu" role="menu">
<li><a href="<%=urlLoc %>/react/encounter-search"><%=props.getProperty("encounters")%></a></li>

<% if (Util.booleanNotFalse(CommonConfiguration.getProperty("showClassicEncounters", context))) { %>
<li><a href="<%=urlLoc %>/encounters/encounterSearch.jsp" ><%=props.getProperty("encountersClassic")%></a></li>
<% } %>
<li><a href="<%=urlLoc %>/individualSearch.jsp"><%=props.getProperty("individuals")%></a></li>
<li><a href="<%=urlLoc %>/occurrenceSearch.jsp"><%=props.getProperty("sightings")%></a></li>

Expand Down

0 comments on commit ce5bc7f

Please sign in to comment.