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

marker added to center of map fixes #1148 #1149

Merged
merged 8 commits into from
Jan 4, 2017

Conversation

mridulnagpal
Copy link
Member

@mridulnagpal mridulnagpal commented Dec 29, 2016

Make sure these boxes are checked before your pull request is ready to be reviewed and merged. Thanks!

  • all tests pass -- rake test:all
  • code is in uniquely-named feature branch, and has been rebased on top of latest master (especially if you've been asked to make additional changes)
  • pull request is descriptively named with #number reference back to original issue
  • if possible, multiple commits squashed if they're smaller changes
  • reviewed/confirmed/tested by another contributor or maintainer
  • schema.rb.example has been updated if any database migrations were added

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/wiki/contributing-to-public-lab-software

We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays. Please alert developers on plots-dev@googlegroups.com when your request is ready or if you need assistance.

Closes #1148
Thanks!

@mridulnagpal
Copy link
Member Author

@jywarren I put up a marker in the center but how do I test it as there is no map showing on the page?

@jywarren
Copy link
Member

jywarren commented Dec 29, 2016 via email

@mridulnagpal
Copy link
Member Author

@jywarren Moved it to location/form

@jywarren
Copy link
Member

How does it look at /locations/form ? Can you upload a screenshot? Thanks!

@mridulnagpal
Copy link
Member Author

@jywarren There is no map on the page
screenshot from 2016-12-29 22-46-48

@mridulnagpal
Copy link
Member Author

@jywarren Okay so I tried the commands on a test file and it looks like this
image

@mridulnagpal
Copy link
Member Author

@jywarren Is this okay or do I add something else as well?

@jywarren
Copy link
Member

jywarren commented Jan 3, 2017

Hi, sorry - was offline for the new year. Back now!

This looks good, but do you think you could swap it for the "droplet" style marker as shown on https://publiclab.org/archive ?

screen shot 2017-01-03 at 12 08 16 pm

@mridulnagpal
Copy link
Member Author

@jywarren Done
image

@jywarren
Copy link
Member

jywarren commented Jan 4, 2017

Cool -- but does the marker move when you pan the map? I looked through the code and I wasn't sure. Thanks!

@mridulnagpal
Copy link
Member Author

@jywarren No it doesn't how do I do that as I went through the documentation but couldn't find anything

@jywarren
Copy link
Member

jywarren commented Jan 4, 2017

Hmm, i think there are two ways to do this. One would be to constantly update the marker position, but the easier way would be to make the marker an image that's at a fixed position using CSS.

The marker icon is here: https://publiclab.org/assets/leaflet/dist/images//marker-icon.png

marker

But we'd still need to listen to the map move event to return getCenter() in a followup issue.

@mridulnagpal
Copy link
Member Author

@jywarren Please review.

@@ -1,4 +1,20 @@
<div style="width:100%;margin-left:0;height:300px;" id="map"></div>
<style>
#map { width:100%; height:300px; margin: 0; position: relative;}
Copy link
Member

Choose a reason for hiding this comment

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

This looks good, but actually one more change -- do you think we could change the id here to something unique, so that multiple maps could in theory appear on a page without conflicting? We could generate a unique id in Ruby using:

<%= unique_id = rand(10) %>

Then instead of #map we'd use:

#map<%= unique_id %>

Make sense? And we'd do this addition below too on line 19. That way each map instance will be uniquely set up and controlled, even if there are multiple maps on the page.

@mridulnagpal
Copy link
Member Author

@jywarren Done

@jywarren
Copy link
Member

jywarren commented Jan 4, 2017

Will look out for the tests passing. Great work here.

@jywarren jywarren merged commit 0bfff4b into publiclab:master Jan 4, 2017
@jywarren
Copy link
Member

jywarren commented Jan 4, 2017

Great! 🎉

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.

2 participants