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

Leaflet Profile Occurrence Map #554

Merged
merged 9 commits into from
Aug 15, 2023
Merged

Conversation

MuchQuak
Copy link
Collaborator

@MuchQuak MuchQuak commented Jul 20, 2023

Pull Request Checklist:

  • Features and backlog bugs should be merged into the Development branch, NOT master
  • Hotfixes should be merged into both the Development and master branches (at the same time).
  • All new text is preferrably internationalized (i.e., no end-user-visible text is hard-coded on the PHP pages)
  • There are no linter errors
  • New features have responsive design (i.e., look aesthetically pleasing both full screen and with small or mobile screens)
  • Symbiota coding standards have been followed
  • If any files have been reformatted (e.g., by an autoformatter), the reformat is its own, separate commit in the PR
  • Comment which GitHub issue(s), if any does this PR address
  • It is the code author's responsibility to merge their own pull request after it has been approved
  • If this PR represents a merge into the Development branch, remember to use the squash & merge option
  • If this PR represents a merge from the Development branch into the master branch, remember to use the merge option
  • If the dev team has agreed that this PR represents the last PR going into the Development branch before a tagged release (i.e., before an imminent merge into the master branch), make sure to notify the team and lock the Development branch to prevent accidental merges while QA takes place

Thanks for contributing and keeping it clean!

Issue #537

Summary

Very simple map that just renders a marker where occurrence is located

Files Changed

Collections/individual/index.php

Notes

  • Did not alter the google version of the code
  • Only really touched lines 246 - 278

@MuchQuak MuchQuak requested review from egbot and Atticus29 July 20, 2023 17:13
@MuchQuak MuchQuak changed the title Extracting google version, adding leaflet version Leaflet Profile Occurence Map Jul 24, 2023
@MuchQuak MuchQuak changed the title Leaflet Profile Occurence Map Leaflet Profile Occurrence Map Jul 24, 2023
Copy link
Collaborator

@Atticus29 Atticus29 left a comment

Choose a reason for hiding this comment

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

Code looks good to me, although I'm curious about the quotations (see comment) - I think I might stand to learn something there.

As noted in slack, there was some wonkiness with having to re-size the browser window to get the map to fully render on my local machine, but this is 1) not germane to the current PR and 2) likely a library issue.

const marker = L.marker(mLatLng).addTo(map.mapLayer);
}
function initializeMap(){
if("<?php echo $LEAFLET?>") {
Copy link
Collaborator

@Atticus29 Atticus29 Aug 1, 2023

Choose a reason for hiding this comment

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

I'm curious about the quotes here. Why are they needed?

Copy link
Member

Choose a reason for hiding this comment

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

This is needed to see if LeafLet has been activated for for the portal. Some portals might want to use LeafLet and others Google Map. However, this will produce a warning/notice in the error logs if the $LEAFLET variable hasn't been added to the symbini file, which will be most of the portals initially. Better to use !empty($LEAFLET), which will return true when variable exists and is true (e.g. true, 1, non-empty), and won't produce a warning if variable is not set.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry. Mine was a syntax question. I was wondering why:
if(<?php echo $LEAFLET?>) wasn't sufficient instead of if("<?php echo $LEAFLET?>") with the doublequotes. But agreed about !empty.

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes, good point, it's due to it being a php boolan within a js conditional statement, which highlights that what I stated earlier doesn't work. You can't use !empty within a js condition. However, it will still throw a php warning whenever $LEAFLET is not declared within symbini. It might be better to convert the code to be totally to php within that section, maybe something like:

Copy link
Member

@egbot egbot left a comment

Choose a reason for hiding this comment

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

See note about us of !empty().
You have a mixture of tabs and 4 spaces being used for indenting code. Best to use one or the other within a page, or the indentation will look strange in other IDEs / interfaces. Since Symbiota has been using tab from the beginning, that is what we prefer.
Within the php code, best to use single quotes when string doesn't have to be evaluated for imbedded variables (e.g. "my $color cat"). Single quotes tell the processor that it can skip the evaluation step. This is very minor, thus not a big issue, but mentioning since it's listed in the code preferences.

@MuchQuak MuchQuak merged commit 1e3d056 into Development Aug 15, 2023
@MuchQuak MuchQuak deleted the Leaflet-Profile-Occurence-Map branch August 15, 2023 18:42
Atticus29 added a commit that referenced this pull request Aug 23, 2023
…ent (#582)

* create individualCollectionReorg.js file

* bring new styling from css/v202209/symbiota/main.css over to css/uswds/symbiota/main.css

* begin work on changing the order in collections/individual/index.php programmatically

* add ids to a few more divs and fix an existing typo I think

* finish div reordering via reorderElements method

* Leaflet Profile Occurrence Map (#554)

* Extracting google version, adding leaflet version

* matching google and leaflet zooms

* Fix for leaflet_tiles not loading

* Changing Leaflet Check to be in php

* Fixing tab/space issue

* adding empty check to profile occurrence map

* updating coord aids $LEAFLET CHECK

* removing old coord aid $LEAFLET switch

* Adding $LEAFLET improved leaflet check to clgmap

* Leaflet public occurence map (#570)

* Observation Leaflet Observation Icon

* Leaflet-Occurence-Map

* Added Leaflet Switch

* 508 collections individual index (#578)

* being to implement changes recommended by tvp

* finish actionable total validator pro issues

* improve spacing styling in collections/individual/index.css

* fix typo found during self-review

* add ids to a few more divs and fix an existing typo I think

* add id to record-id-div and make code more readable

* rename individualCollectionReorg.js to domManipulationUtils.js and add hr styling

---------

Co-authored-by: Logan Wilt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants