Skip to content

Commit

Permalink
trigger reload of profile page on adding location tags
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhbir-singh committed Feb 16, 2018
1 parent fa16a69 commit f441cfe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/views/locations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
if (blurredLocation.isBlurred()) tags = tags + ',' + 'location:blurred'
if ($('#placenameDisplay').val() != 'Location unavailable') tags = tags + ',' + 'place:' + parameterize($('#placenameDisplay').val());
addTag(tags);

<% reload="false" if reload.blank? %>
<% if reload == "true" %>setTimeout(function() { location.reload(); }, 3000);<% end %>
}

function parameterize(input) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/locations/_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h4 class="modal-title">Enter a location</h4>
</div>
<div class="modal-body">
<%= render partial: 'locations/form' %>
<%= render partial: 'locations/form', locals:{reload: params[:reload]} %>
</div>
<!--
<div class="modal-footer">
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 parent==: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
2 changes: 1 addition & 1 deletion app/views/tag/_tagging.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ $(function () {
</form>
<% end %>

<%= render partial: 'tag/location' %>
<%= render partial: 'tag/location', locals:{parent: parent} %>

0 comments on commit f441cfe

Please sign in to comment.