gamesystem_detail.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {% extends "base.html" %}
  2. {% block page_title %}{{object.name}}{% endblock %}
  3. {% block title %}{{object.name}}{% endblock %}
  4. {% block extra_head %}
  5. <script>
  6. $('#library-update-form').on('submit', function(event){
  7. event.preventDefault();
  8. console.log("form submitted!") // sanity check
  9. $.ajax({
  10. url : "library/update/",
  11. type : "GET",
  12. // handle a successful response
  13. success : function(json) {
  14. $('#library-update-form').html("<button id='library-update-btn' class='btn btn-secondary my-2 my-sm-0' type='submit' disabled>Update</button>");
  15. console.log(json); // log the returned json to the console
  16. },
  17. // handle a non-successful response
  18. error : function(xhr,errmsg,err) {
  19. console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
  20. }
  21. });
  22. });
  23. </script>
  24. {% endblock %}
  25. {% block content %}
  26. <h4>Browsing {{object_list.count}} games</h4>
  27. <form id="library-update-form" class="form-inline my-2 my-lg-0" method="get" action="{% url 'games:game_library_update' %}?game_systems={{object.retropie_slug}}">
  28. <button id="library-update-btn" class="btn btn-warning my-2 my-sm-0" type="submit" {% if update_in_progress %}disabled{% endif %}>Update {{object.name}}</button>
  29. </form>
  30. <div class="d-flex flex-column">
  31. <div class="image-grid-container">
  32. {% for game in object_list %}
  33. {% include "games/_game_card.html" %}
  34. {% endfor %}
  35. </div>
  36. </div>
  37. {% include "games/_pagination.html" %}
  38. {% endblock %}