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

Unique tags are only displayed once per Map Show view #81

Open
keithnewman14 opened this issue Aug 9, 2012 · 8 comments
Open

Unique tags are only displayed once per Map Show view #81

keithnewman14 opened this issue Aug 9, 2012 · 8 comments

Comments

@keithnewman14
Copy link
Member

This is kind of a strange bug to describe, but basically, if you do the following:

  1. Outline an annotation
  2. Type in enough to generate tags
  3. Close the modal without saving
  4. Create another annotation that would generate similar/the same tags (i.e. type in the original annotation somewhere else)

Then no tags are displayed (though the Annotation Controller still seems to be generating them). This is particularly an issue with the user-suggest condition, where all tags are drawn from the same tag pool, so if a user changes their mind after creating an initial annotation and wants to do another one on the same map, they will receive limited to no tag suggestions.

I believe the root of the problem is that in the javascript TaggingView file, only unique tags are displayed, but the TaggingView is loaded only once per show view. It would seem that the list of tags in the TaggingView perpetuates until the map is rendered again.

@slhck
Copy link
Member

slhck commented Aug 9, 2012

Seems we need to call

// resets the internal structure of the tagging view, i.e. the tags it remembered
maphub.TaggingView.prototype.reset = function() {
  this.tags = new Array();
}

… once the modal is closed. Like this:

window.tagging_view.reset();

@keithnewman14
Copy link
Member Author

I was wondering what that method was for. Where do you think is best to catch the modal closing event?

@slhck
Copy link
Member

slhck commented Aug 9, 2012

Probably attach handler for the close button when the tagging view is initialized.

$("#modal-annotation a.close").click(function() {
  window.tagging_view.reset();
}); 

Or similar.

@keithnewman14
Copy link
Member Author

It doesn't appear that you can add a click() handler to a link, because they're they're already tied to their own click() event. I'll look for a workaround.

@slhck
Copy link
Member

slhck commented Aug 9, 2012

Ah, you know what? You could also bind the reset to when the modal is opened, because that happens in the annotation view, i.e. in the featureadded callback.

@keithnewman14
Copy link
Member Author

It seems that if you add an inline event click handler for the link, it works fine, so that's what I did. So now it reads:

<a class="close" data-dismiss="modal" onclick="window.tagging_view.reset();">×</a>

@slhck
Copy link
Member

slhck commented Aug 9, 2012

It's not pretty, but it works ;) I mean, we don't have these kinds of inline handlers anywhere else, and it's a little old-fashioned to use them at all, but that is something for "code quality", not a bug.

@keithnewman14
Copy link
Member Author

Yeah, I realize that it's not as elegant a solution as it could be, but there are bigger fish to fry for getting the experiment environment ready to run tests. I'll reopen this as a code quality issue.

@keithnewman14 keithnewman14 reopened this Aug 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants