Opt in opt out does not work on home page

Issue #4 resolved
Former user created an issue

The opt in opt out functionality only works when used by clicking on an issue first.

Issues cannot be rated when voting directly on the home page.

Comments (3)

  1. André Palma

    The form its there but for some reason when we click on any thumbs up/thumbs down there is a post request made to the root of the web-site.

    I did try to trace through the javascript but with no success.

  2. David Marrs

    I think I have found the relevant JavaScript: will write up my findings/make necessary commits after some lunch...

  3. David Marrs

    I think it's a hangover from when the thumbs up/down where anchor tags rather than form tags. The problem was around line 43 of templates/issues/partials/issue_detail.html. There was a click event handler which was grabbing the anchor tag and firing an ajax POST request. The new form tags have the same class as the old anchor tags, so they weren't being submitted on click. The reason the POST was going to the root of the site was because the click event handler was taking the url to use from the href attribute of the clicked tag, and form tags don't have a href attribute (they have an action attribute).

    For now, in the interests of just getting something working, I have removed the click event handler so that the forms just submit (and the user is taken to the relevant issue page). Otherwise, we need to get some JSON response in place to indicate success/failure and handle updating the opt ins/outs and ratio on the client side.

    Would be good if we could get some kind of message to show that the vote has been counted though?

  4. Log in to comment