-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add default location to /post #6957
Conversation
Still having that NodeShared test issue. 😞 |
342334c
to
e449dcd
Compare
app/views/editor/rich.html.erb
Outdated
@@ -404,6 +406,29 @@ | |||
} | |||
}); | |||
|
|||
editor.mapModule.blurredLocation.setZoomByPrecision(getPrecisionFromNum("<%= @lat %>")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome @nstjean !
But this getPrecisionFromNum
function needs to be removed. I have added more details here: #6946
Briefly - the zoom level calculation needs to be inside a function in LBL.
The PL.editor will just take that zoom level as input and just set map to that zoom in map_module of PL.editor.
If zoom is present in the form of zoom:xx in plots2, let's pass that otherwise call the function of LBL to get zoom and then pass it. Thanks 😄 !!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, ok! That makes sense!
e449dcd
to
65e58ba
Compare
publiclab/leaflet-blurred-location#222 must be merged first so it works!
|
b07068c
to
5962ab7
Compare
editor.mapModule.blurredLocation.setZoom(<%= @zoom %>); | ||
<% else %> | ||
let zoom = editor.mapModule.blurredLocation.getZoomFromCoordinates(<%= @lat %>, <%= @lon %>); | ||
addTag('zoom:'+zoom, '/profile/tags/create/<%= current_user.uid %>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we are explicitly adding tag here?
Pl.editor will automatically add zoom tag, right?
Moreover if user changes zoom level, we will have 2 zoom tags? One from here and other from PL.editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only calculates zoom in the instances that the user has a lat and lon in their profile but no zoom level saved. So it calculates a zoom and saves it to their profile using the addTag javascript function (I worked on that a few weeks ago). It does not add the tag into the map, just to their profile. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh i see, the name is misleading. Very cool place to put this though :)
editor.mapModule.blurredLocation.setZoom(<%= @zoom %>); | ||
<% else %> | ||
let zoom = editor.mapModule.blurredLocation.getZoomFromCoordinates(<%= @lat %>, <%= @lon %>); | ||
addTag('zoom:'+zoom, '/profile/tags/create/<%= current_user.uid %>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh i see, the name is misleading. Very cool place to put this though :)
@jywarren I think this all set but codeclimate is complaining! |
5962ab7
to
39441fa
Compare
Sorry for slow catchup here, i just resolved that. All good to merge then? Thanks! |
Ah, we now have a couple merge conflicts to resolve. Would you mind taking a look? Thanks! |
39441fa
to
ae2134e
Compare
Codecov Report
@@ Coverage Diff @@
## master #6957 +/- ##
==========================================
+ Coverage 80.69% 80.83% +0.14%
==========================================
Files 97 97
Lines 5568 5574 +6
==========================================
+ Hits 4493 4506 +13
+ Misses 1075 1068 -7
|
Hmm, looks like this is the error, odd!
|
ae2134e
to
b04b14e
Compare
That's weird. That class is in PublicLab.Editor - I'll try |
Screenshots 📸 (click to expand)6957-test_questions.png6957-test_embeddable_grids.png6957-test_signup.png6957-test_viewing_the_settings_page.png6957-test_tag_by_author_page.png6957-test_wiki_page_with_inline_grids.png6957-test_stats.png6957-test_viewing_the_dashboard.png6957-test_searching_an_item_from_the_homepage.png6957-test_signup_modal_form_validation.png6957-test_questions_shadow.png6957-test_login_modal.png6957-test_profile_page.png6957-test_comments.png6957-test_tags.png6957-test_signup_modal.png6957-test_wiki.png6957-test_methods.png6957-test_tag_page.png6957-test_blog_page_with_location_modal.png6957-test_tag_wildcard.png6957-test_signup_modal_disabled_submit_button_on_empty_username.png6957-test_embeddable_thumbnail_grids.png6957-test_front_page_with_navbar_search_autocomplete.png6957-test_login.png6957-test_viewing_the_dropdown_menu.png6957-test_viewing_question_post.png6957-test_mobile_displays.png6957-test_simple-data-grapher_powertag.png6957-test_front.png6957-test_question_page.png6957-test_tag_contributors_page.png6957-test_blog.png6957-test_people.png6957-test_wiki_revisions.pngLearn about automated screenshots Generated by 🚫 Danger |
@jywarren Fixed it! Should be all set to merge! |
Awesome! |
* update yarn * add default location to post form * keep default lat/lon zoom level by calculating precision * display zoom or calculate and save zoom * use LBL's getZoomFromCoordinates for zoom and style location button * fix codeclimate error with parentheses * fix codeclimate error * make map slider in modal update when map is zoomed * fix merge
* update yarn * add default location to post form * keep default lat/lon zoom level by calculating precision * display zoom or calculate and save zoom * use LBL's getZoomFromCoordinates for zoom and style location button * fix codeclimate error with parentheses * fix codeclimate error * make map slider in modal update when map is zoomed * fix merge
Fixes #6946 (<=== Add issue number here)
This adds in the user's profile location as a default value for location.
getPrecisionFromNum
- I recommend this be placed in leaflet-blurred-location. The precision number is then used to callsetZoomByPrecision
which already exists.plots2/app/views/map/_leaflet.html.erb
Line 24 in 7a6d931
lat:
andlon:
in the constructor, but notzoom:
. I callededitor.mapModule.blurredLocation.setZoomByPrecision
after the map was contructed to set the zoom level. Perhaps zoom could be added to the constructor?