Skip to content

Commit

Permalink
Merge pull request #3 from renyi/master
Browse files Browse the repository at this point in the history
Small bug fixes
  • Loading branch information
paltman committed Jul 1, 2012
2 parents 7bc72b2 + fbd493b commit 38fef71
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
25 changes: 0 additions & 25 deletions agon_ratings/static/agon_ratings/js/ajax_csrf.js

This file was deleted.

17 changes: 14 additions & 3 deletions agon_ratings/templates/agon_ratings/_script.html
@@ -1,4 +1,13 @@
<script type="text/javascript" src="{{ STATIC_URL }}agon_ratings/js/ajax_csrf.js"></script>
<script>
(function($) {
$('html').ajaxSend(
function(event, xhr, settings) {
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");
}
});
})(jQuery);
</script>
<script type="text/javascript" src="{{ STATIC_URL }}agon_ratings/js/jquery.raty.js"></script>
<script type="text/javascript">
$(function () {
Expand All @@ -17,8 +26,10 @@
url: "{{ post_url }}",
type: "POST",
data: {
"rating": current_rating,
"category": "{{ category }}"
"rating": current_rating
{% if category %}
,"category": "{{ category }}"
{% endif %}
},
statusCode: {
403: function(jqXHR, textStatus, errorThrown) {
Expand Down

0 comments on commit 38fef71

Please sign in to comment.