game_library_list.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {% extends "base.html" %}
  2. {% block page_title %}Game Library{% endblock %}
  3. {% block title %}All games by rating{% endblock %}
  4. {% block head_extra %}
  5. <script>
  6. $(document).ready(function () {
  7. $('#library-update-form').on('submit', function(event){
  8. event.preventDefault();
  9. console.log("form submitted!") // sanity check
  10. $.ajax({
  11. url : "/library/update/",
  12. type : "GET",
  13. // handle a successful response
  14. success : function(json) {
  15. $('#library-update-form').html("<button id='library-update-btn' class='btn btn-secondary my-2 my-sm-0' type='submit' disabled>Update</button>");
  16. console.log(json); // log the returned json to the console
  17. },
  18. // handle a non-successful response
  19. error : function(xhr,errmsg,err) {
  20. console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
  21. }
  22. });
  23. });
  24. });
  25. </script>
  26. {% endblock %}
  27. {% block content %}
  28. <form id="library-update-form" class="form-inline my-2 my-lg-0" method="get" action="{% url 'games:game_library_update' %}">
  29. <button id="library-update-btn" class="btn btn-warning my-2 my-sm-0" type="submit" {% if update_in_progress %}disabled{% endif %}>Update</button>
  30. </form>
  31. &nbsp;
  32. {% include "games/_game_table.html" %}
  33. {% include "games/_pagination.html" %}
  34. {% endblock %}