game_detail.html 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {% extends "base.html" %}
  2. {% load static %}
  3. {% block head_extra %}
  4. <script>
  5. $(document).ready(function() {
  6. // Initialize the tooltip.
  7. $('#copy-button').tooltip();
  8. // When the copy button is clicked, select the value of the text box, attempt
  9. // to execute the copy command, and trigger event to update tooltip message
  10. // to indicate whether the text was successfully copied.
  11. $('#copy-button').bind('click', function() {
  12. var input = document.querySelector('#copy-input');
  13. input.setSelectionRange(0, input.value.length + 1);
  14. try {
  15. var success = document.execCommand('copy');
  16. if (success) {
  17. $('#copy-button').trigger('copied', ['Copied!']);
  18. } else {
  19. $('#copy-button').trigger('copied', ['Copy with Ctrl-c']);
  20. }
  21. } catch (err) {
  22. $('#copy-button').trigger('copied', ['Copy with Ctrl-c']);
  23. }
  24. });
  25. // Handler for updating the tooltip message.
  26. $('#copy-button').bind('copied', function(event, message) {
  27. $(this).attr('title', message)
  28. .tooltip('fixTitle')
  29. .tooltip('show')
  30. .attr('title', "Copy to Clipboard")
  31. .tooltip('fixTitle');
  32. });
  33. });
  34. </script>
  35. {% endblock %}
  36. {% block title %}{{object.name}}{% endblock %}
  37. {% block content %}
  38. <a href="{% url "games:game_list" %}">Back to list</a>
  39. <p><img src="{{object.screenshot.url}}" /></p>
  40. <dl>
  41. <dt>Released
  42. <dd>{{object.release_date|date:"Y/m/d"}}</dd>
  43. <dt>Players</dt>
  44. <dd>{{object.players}}</dd>
  45. <dt>Game System</dt>
  46. <dd>
  47. <a href="{{game.game_system.get_absolute_url}}">
  48. <span class="system-badge badge badge-success {{game.game_system.retropie_slug}}">{{game.game_system.name|upper}}</span>
  49. </a>
  50. </dd>
  51. <dt>Genre</dt>
  52. <dd>{% for genre in object.genre.all %}{{genre}}{% if not forloop.last %}, {% endif %}{% endfor %}</dd>
  53. <dt>Region</dt>
  54. <dd>{{object.region}}</dd>
  55. <dt>Publisher/Developer</dt>
  56. <dd><a href="{{object.publisher.get_absolute_url}}">{{object.publisher}}</a>/<a href="{{object.developer.get_absolute_url}}">{{object.developer}}</a></dd>
  57. <dt>Rating</dt>
  58. <dd>{{game.rating_by_100}}</dd>
  59. </dl>
  60. {% if object.webretro_url %}
  61. <p><a href="{{game.webretro_url}}" class="btn btn-primary" targe="_blank">Play</a></p>
  62. {% elif object.retroarch_cmd %}
  63. <p>
  64. <form>
  65. <div class="input-group">
  66. <input type="text" class="form-control"
  67. value="{{object.retroarch_cmd}}" placeholder="" id="copy-input">
  68. <span class="input-group-btn">
  69. <button class="btn btn-default" type="button" id="copy-button"
  70. data-toggle="tooltip" data-placement="button"
  71. title="Copy to Clipboard">
  72. Copy
  73. </button>
  74. </span>
  75. </div>
  76. </form>
  77. </p>
  78. {% endif %}
  79. <p>{{object.description}}</p>
  80. {% endblock %}