Commit 94ca88b8 authored by Okhin's avatar Okhin

Updating the Me Too small form to actually work

parent 61763ca9
...@@ -12,9 +12,8 @@ ...@@ -12,9 +12,8 @@
$('.metoo').submit(function(event) { $('.metoo').submit(function(event) {
event.preventDefault(); event.preventDefault();
var form = $(this); var form = $(this);
var pk = form.attr("id").split("-")[1]; var pk = $(form).attr("id")
var email = form.find("#email-" + pk).val(); var email = $(form).find("#email-" + pk).val();
console.log("pk: " + pk + "email: " + email);
$.ajax({ $.ajax({
url: "/confirm/" + pk + "/" + email, url: "/confirm/" + pk + "/" + email,
...@@ -22,7 +21,7 @@ $('.metoo').submit(function(event) { ...@@ -22,7 +21,7 @@ $('.metoo').submit(function(event) {
form.find("div").html(data); form.find("div").html(data);
} }
}); });
} });
$("#lookup_btn").click(function(event) { $("#lookup_btn").click(function(event) {
event.preventDefault(); event.preventDefault();
$.ajax({ $.ajax({
......
...@@ -14,6 +14,18 @@ ...@@ -14,6 +14,18 @@
<script type="text/javascript"> <script type="text/javascript">
var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %}; var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %};
var country="{{country}}"; var country="{{country}}";
$('.metoo').submit(function(event) {
event.preventDefault();
var form = $(this);
var pk = $(form).attr("id")
var email = $(form).find("#email-" + pk).val();
$.ajax({
url: "/confirm/" + pk + "/" + email,
success: function(data) {
form.find("div").html(data);
}
});
$("#sortedList").tablesorter({ $("#sortedList").tablesorter({
theme: 'dropbox', theme: 'dropbox',
}); });
...@@ -58,7 +70,7 @@ $("#sortedList").tablesorter({ ...@@ -58,7 +70,7 @@ $("#sortedList").tablesorter({
<div class="modal fade" id="modal-{{ violation.pk }}" tabindex="-1" role="dialog" aria-labelledby="modal-label-{{ violation.pk }}" data-backdrop="false"> <div class="modal fade" id="modal-{{ violation.pk }}" tabindex="-1" role="dialog" aria-labelledby="modal-label-{{ violation.pk }}" data-backdrop="false">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form method="post" class="inline-from" action="/confirm/{{ violation.pk }}" id="i{{ violation.pk }}"> <form method="post" class="metoo inline-from" action="/confirm/{{ violation.pk }}" id="i{{ violation.pk }}">
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label for="list-email-{{ violation.pk }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label> <label for="list-email-{{ violation.pk }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
......
...@@ -15,6 +15,20 @@ ...@@ -15,6 +15,20 @@
<script type="text/javascript"> <script type="text/javascript">
var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %}; var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %};
var country="{{country}}"; var country="{{country}}";
$('.metoo').submit(function(event) {
event.preventDefault();
var form = $(this);
var pk = $(form).attr("id")
var email = $(form).find("#email-" + pk).val();
$.ajax({
url: "/confirm/" + pk + "/" + email,
success: function(data) {
form.find("div").html(data);
}
});
});
$("#sortedList").tablesorter({ $("#sortedList").tablesorter({
theme: 'dropbox', theme: 'dropbox',
}); });
...@@ -77,7 +91,7 @@ $("#sortedList").tablesorter({ ...@@ -77,7 +91,7 @@ $("#sortedList").tablesorter({
<div class="modal fade" id="modal-{{ violation.pk }}" tabindex="-1" role="dialog" aria-labelledby="modal-label-{{ violation.pk }}" data-backdrop="false"> <div class="modal fade" id="modal-{{ violation.pk }}" tabindex="-1" role="dialog" aria-labelledby="modal-label-{{ violation.pk }}" data-backdrop="false">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form method="post" class="inline-from" action="/confirm/{{ violation.pk }}" id="i{{ violation.pk }}"> <form method="post" class="metoo inline-from" action="/confirm/{{ violation.pk }}" id="i{{ violation.pk }}">
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label for="list-email-{{ violation.pk }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label> <label for="list-email-{{ violation.pk }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment