Skip to content

Commit

Permalink
trigger reload of profile page on adding location tags (publiclab#2350)
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhbir-singh authored and jywarren committed Mar 13, 2018
1 parent 88dd204 commit 59afa5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/views/locations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
if (blurredLocation.isBlurred()) tags = tags + ',' + 'location:blurred'
if ($('#placenameDisplay').val() != 'Location unavailable') tags = tags + ',' + 'place:' + parameterize($('#placenameDisplay').val());
addTag(tags);

<% if params[:reload] %>setTimeout(function() { location.reload(); }, 3000);<% end %>
}

function parameterize(input) {
Expand Down
6 changes: 5 additions & 1 deletion app/views/tag/_location.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<script>
jQuery(document).ready(function() {
$('.blurred-location-input').click(function createBlurredLocationInput() {
$.ajax('/locations/modal')
<% if params[:action] == "profile" %>
$.ajax('/locations/modal?reload=true')
<% else %>
$.ajax('/locations/modal')
<% end %>
.done(function(response) {
$('.blurred-location-container').html(response);
$('.modal').on('shown.bs.modal', function () { blurredLocation.map.invalidateSize(); });
Expand Down

0 comments on commit 59afa5e

Please sign in to comment.