Skip to content

Commit

Permalink
Reload fucntion added upon adding location tags (publiclab#7520)
Browse files Browse the repository at this point in the history
* Reload function improved

* IMPROVED

* Error removed

* Error removed

* Click function added in post_test.rb
  • Loading branch information
NitinBhasneria authored Feb 19, 2020
1 parent db94d3c commit abe0ca5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/assets/javascripts/tagging.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ function addNewTagsSuccess(response, deletion_path, el = "#tagform"){
if (typeof response == "string") response = JSON.parse(response)
$.each(response['saved'], function(i, tag) {
// only display tag if it was added to the note we're currently viewing
var tagNameCheck = !!tag[0].split(':')[0].match(/^(lat|lon|place)$/)
if (tagNameCheck) {
location.reload(true);
}
if (tag[2] == getDeletionPathId(deletion_path)) {
displayNewTag(tag[0], tag[1], deletion_path);
}
Expand Down
1 change: 1 addition & 0 deletions test/system/post_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def assert_page_does_not_reload(message = "page should not reload")

# Wait for the location to be added
wait_for_ajax
find('.tags-list a.show-more-tags').click()

# Make sure proper latitude and longitude tags are added
assert_selector('.tags-list .badge a[href="/tag/lat:22"]', text: "lat:22")
Expand Down

0 comments on commit abe0ca5

Please sign in to comment.