Commit 96d9aa98 authored by Okhin's avatar Okhin
Browse files

Fixing the JS and the templates toget rid of django_und, and refresh the display value

parent 8dc0468e
Pipeline #2681 passed with stages
in 3 minutes and 41 seconds
...@@ -103,16 +103,13 @@ ...@@ -103,16 +103,13 @@
<td>{{article.lang}}</td> <td>{{article.lang}}</td>
<td class="title-cell"><a target="_blank" href="{{article.url}}"><strong>{{article.title}}</strong></a></td> <td class="title-cell"><a target="_blank" href="{{article.url}}"><strong>{{article.title}}</strong></a></td>
<td> <td>
{% if filter_view == "published" %} <span id="score_{{article.id}}">{{article.score}}</span>
{{article.und_score}} {% if filter_view != "published" %}
{% else %}
<ul class="votes-list"> <ul class="votes-list">
<li class="actions-item" onclick="javascript:call_upvote({{article.id}})"> <li class="actions-item" onclick="javascript:call_upvote({{article.id}})">
<span id="count_up_{{article.id}}">{{article.und_score_up}}</span>
<i class="fa fa-thumbs-up" aria-hidden="true" style="color:green"></i> <i class="fa fa-thumbs-up" aria-hidden="true" style="color:green"></i>
</li> </li>
<li class="actions-item" onclick="javascript:call_downvote({{article.id}})"> <li class="actions-item" onclick="javascript:call_downvote({{article.id}})">
<span id="count_down_{{article.id}}">{{article.und_score_down}}</span>
<i class="fa fa-thumbs-down" aria-hidden="true" style="color:red"></i> <i class="fa fa-thumbs-down" aria-hidden="true" style="color:red"></i>
</li> </li>
</ul> </ul>
......
...@@ -30,13 +30,13 @@ $(function () { ...@@ -30,13 +30,13 @@ $(function () {
window.call_upvote = function(id) { window.call_upvote = function(id) {
$.post("/api/articles/" + id + "/upvote/", function response(data) { $.post("/api/articles/" + id + "/upvote/", function response(data) {
$("#count_up_" + id).text(data.und_score_up); $("#score_" + id).text(data.score);
}); });
} }
window.call_downvote = function(id) { window.call_downvote = function(id) {
$.post("/api/articles/" + id + "/downvote/", function response(data) { $.post("/api/articles/" + id + "/downvote/", function response(data) {
$("#count_down_" + id).text(data.und_score_down); $("#score_" + id).text(data.score);
}); });
} }
......
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