diff options
Diffstat (limited to 'tbc')
-rw-r--r-- | tbc/templates/tbc/book-details.html | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tbc/templates/tbc/book-details.html b/tbc/templates/tbc/book-details.html index fc67847..0119117 100644 --- a/tbc/templates/tbc/book-details.html +++ b/tbc/templates/tbc/book-details.html @@ -2,6 +2,24 @@ {% load static %} {% block script %} +{% load staticfiles %} +<script src="{% static 'hitcount/jquery.postcsrf.js' %}"></script> + +{% load hitcount_tags %} +{% get_hit_count_js_variables for book as hitcount %} +<script type="text/javascript"> +jQuery(document).ready(function($) { + // use the template tags in our JavaScript call + $.postCSRF("{{ hitcount.ajax_url }}", { hitcountPK : "{{ hitcount.pk }}" }) + .done(function(data){ + $('<i />').text(data.hit_counted).attr('id','hit-counted-value').appendTo('#hit-counted'); + $('#hit-response').text(data.hit_message); + }).fail(function(data){ + console.log('POST failed'); + console.log(data); + }); +}); +</script> <script> function redirectToIpynb(notebook) { @@ -50,6 +68,7 @@ function redirectToIpynb(notebook) <tr> <td>Author: </td> <td>{{ book.author }}</td> + </tr> <tr> <td>Publisher: </td> @@ -79,7 +98,11 @@ function redirectToIpynb(notebook) <td>GitHub: </td> <td><a href= 'https://github.com/FOSSEE/Python-Textbook-Companions/tree/master/{{ book.title.split|join:"_" }}_by_{{ book.author.split|join:"_" }}' target="_blank">{{ book.title }}</a></td> </tr> +<tr> + <td>Page Hits: </td> +<td>{% get_hit_count for book %}</td> +</tr> </table> </div> |