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

Developing a button to display current latitude and longitude the current position of map is pointing to #9

Closed
5 tasks done
mridulnagpal opened this issue May 25, 2017 · 12 comments

Comments

@mridulnagpal
Copy link
Member

mridulnagpal commented May 25, 2017

Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!
blu
If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!

The Problem

We have an API available to get the current lat and lon of the map. What we need to do is create a button for template here https://github.com/publiclab/leaflet-blurred-location/blob/master/examples/example.html which will be available as soon as #7 is merged.

Solution

In the file example.html we need to add a button which when clicked alerts us with the lat, lon. The API reference is blurredLocation.getLat() and blurredLocation.getLon() which would return the lat and lon respectively. blurredLocation is a Global object which controls the map. You need to get those co-ordinates from the API using blurredLocation.getLat() and blurredLocation.getLon(). And then display them to the user. It will be something like this in the example.html file.
<button onclick="displayLocation()">Location</button>

And adding the function to object.js file

function displayLocation() { if(blurredLocation) { var lat = blurredLocation.getLat(); var lon = blurredLocation.getLon(); alert(lat+','+lon); } }

Remember as soon as you make changes in object.js either run grunt build or have grunt watch running while you save changes, to test them.

Steps to fix

  • claim this issue with a comment here, below, and ask any clarifying questions you need
  • set up a repository locally following the README instructions, and make sure that all tests pass
  • try to fix the issue following the steps above, but even before you're done, you can:
  • commit your changes and start a pull request (see contributing to Public Lab software) but mark it as "in progress" if you have questions or if you haven't finished
  • alert someone via the developers list (see below) to have your pull request merged. This may take a few extra steps depending on when you do it, but we'll help you out!
@mridulnagpal
Copy link
Member Author

@jywarren If you could tag this, also can I merge PR's in this repo, I couldn't find out how to do it. Is there some privacy issue there, please let me know. Thanks!

@jywarren
Copy link
Member

I'd still like to review PRs for the time being, so please be in communication before doing it, but i invited you to be a collaborator a while ago and I think you didn't click the invitation yet?

@jywarren
Copy link
Member

I also think this one is totally ready to be a help-wanted issue, but not quite a first-timers-only issue. It may seem like a lot, but a true FTO issue can actually guide you step by step through the code that has to be added, on what line, linking to perhaps an example of how similar code looks like elsewhere. Think about it like a way to guide people through every step, just the first time, so they see the whole experience -- it's more about them going through the steps than about them solving an unsolved problem. Make sense?

If you could add a bit more detail i'll add the FTO label too!

@mridulnagpal
Copy link
Member Author

Sorry for that, I'll more info to it.

@mridulnagpal
Copy link
Member Author

@jywarren Please have a look

@mridulnagpal
Copy link
Member Author

@jywarren I have added some more info to the issue, is it ready to be a first timer issue?

@jywarren
Copy link
Member

I think it is but let's wait until #7 is merged and it is more possible for folks to get started. Great work!

@ananyo2012
Copy link
Member

Can we add a fto-candidate label here?

@mridulnagpal
Copy link
Member Author

mridulnagpal commented Aug 27, 2017 via email

@warborn
Copy link
Contributor

warborn commented Aug 27, 2017

Hi, i would like to take this if it's still available, i set up the repo locally but i can't find the object.js file where the function should be added and examples.html file where the button should be added, for now, i added the changes to the examples/index.html file and maked them work as expected.

@mridulnagpal
Copy link
Member Author

mridulnagpal commented Aug 27, 2017

The code has been restructured a bit. You will need to add the displayLocation() method to src/blurredLocation.js which comprises of the main object blurredLocation, and then return the object adding the method to it, i.e for the last part in src/blurredLocation.js add the method to the object as follows:

return { ... ... displayLocation: displayLocation, }

@warborn
Copy link
Contributor

warborn commented Aug 27, 2017

Thanks for the info! I've created a new pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants