Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

resources.html 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <div class="row">
  4. <div class="col-12 text-center">
  5. <h1>{% block title %}
  6. {{ type|capitalize + 's' }}
  7. {% endblock %}
  8. </h1>
  9. </div>
  10. </div>
  11. <div class="row">
  12. <div class="col-12 text-center">
  13. <p>
  14. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget viverra magna. Nam in ante ultricies purus feugiat vestibulum et ac erat. Donec in sagittis ante. Maecenas non mauris et eros commodo fringilla. Integer accumsan ullamcorper diam, non rhoncus tellus molestie ut. Maecenas finibus pretium dolor ac sagittis.
  15. </p>
  16. </div>
  17. </div>
  18. <div class="row">
  19. <div class="col-md-4 col-lg-3 py-3">
  20. <div class="search-filter-sidebar">
  21. <input class="form-control" id="searchResources" type="text" placeholder="filter by search...">
  22. <div class="row">
  23. {% if practices_filter %}
  24. <div class="col-sm-6 d-md-block d-sm-none d-none">
  25. <div class="filter-title">Practices</div>
  26. <ul class="filter-items">
  27. {% for practice in practices_filter %}
  28. <li {% if request.args.get('practice') == practice[0]|string %} class="fw-bold"{% endif %}>
  29. <a href="/{{type + 's'}}?practice={{practice[0]}}">{{ practice[1] }}</a>
  30. </li>
  31. {% endfor %}
  32. </ul>
  33. </div>
  34. <div class="d-md-none accordion">
  35. <div class="accordion-item">
  36. <div class="filter-title accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#filter-practice">Practices</div>
  37. <div class="accordion-body">
  38. <ul id="filter-practice" class="collapse filter-items">
  39. {% for practice in practices_filter %}
  40. <li {% if request.args.get('practice') == practice[0]|string %} class="fw-bold"{% endif %}>
  41. <a href="/{{type + 's'}}?practice={{practice[0]}}">{{ practice[1] }}</a>
  42. </li>
  43. {% endfor %}
  44. </ul>
  45. </div>
  46. </div>
  47. </div>
  48. {% endif %}
  49. {% if year_filter %}
  50. <div class="col-sm-6 d-md-block d-sm-none d-none">
  51. <div class="filter-title">Year</div>
  52. <ul class="filter-items">
  53. {% for year in year_filter %}
  54. <li {% if request.args.get('year') == year %} class="fw-bold"{% endif %}>
  55. <a href="/books?year={{year}}">{{ year }}</a>
  56. </li>
  57. {% endfor %}
  58. </ul>
  59. </div>
  60. <div class="d-md-none accordion">
  61. <div class="accordion-item">
  62. <div class="filter-title accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#filter-year">Year</div>
  63. <div class="accordion-body">
  64. <ul id="filter-year" class="collapse filter-items">
  65. {% for year in year_filter %}
  66. <li {% if request.args.get('year') == year %} class="fw-bold"{% endif %}>
  67. <a href="/books?year={{year}}">{{ year }}</a>
  68. </li>
  69. {% endfor %}
  70. </ul>
  71. </div>
  72. </div>
  73. </div>
  74. {% endif %}
  75. </div>
  76. <div class="row">
  77. {% if languages_filter %}
  78. <div class="col-sm-6 d-md-block d-sm-none d-none">
  79. <div class="filter-title">Scripting languages</div>
  80. <ul class="filter-items">
  81. {% for language in languages_filter %}
  82. <li {% if request.args.get('scriptingLanguage') == language %} class="fw-bold"{% endif %}>
  83. <a href="/tools?scriptingLanguage={{language}}">{{ language }}</a>
  84. </li>
  85. {% endfor %}
  86. </ul>
  87. </div>
  88. <div class="d-md-none accordion">
  89. <div class="accordion-item">
  90. <div class="filter-title accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#filter-language">Scripting language</div>
  91. <div class="accordion-body">
  92. <ul id="filter-language" class="collapse filter-items">
  93. {% for language in languages_filter %}
  94. <li {% if request.args.get('scriptingLanguage') == language %} class="fw-bold"{% endif %}>
  95. <a href="/tools?scriptingLanguage={{language}}">{{ language }}</a>
  96. </li>
  97. {% endfor %}
  98. </ul>
  99. </div>
  100. </div>
  101. </div>
  102. {% endif %}
  103. {% if licenses_filter %}
  104. <div class="col-sm-6 d-md-block d-sm-none d-none">
  105. <div class="filter-title">License</div>
  106. <ul class="filter-items">
  107. {% for license in licenses_filter %}
  108. <li {% if request.args.get('license') == license %} class="fw-bold"{% endif %}>
  109. <a href="/tools?license={{license}}">{{ license }}</a>
  110. </li>
  111. {% endfor %}
  112. </ul>
  113. </div>
  114. <div class="d-md-none accordion">
  115. <div class="accordion-item">
  116. <div class="filter-title accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#filter-license">License</div>
  117. <div class="accordion-body">
  118. <ul id="filter-license" class="collapse filter-items">
  119. {% for license in licenses_filter %}
  120. <li {% if request.args.get('license') == license %} class="fw-bold"{% endif %}>
  121. <a href="/tools?license={{license}}">{{ license }}</a>
  122. </li>
  123. {% endfor %}
  124. </ul>
  125. </div>
  126. </div>
  127. </div>
  128. {% endif %}
  129. </div>
  130. </div>
  131. </div>
  132. <div class="col-md-8 col-lg-9">
  133. <div id="resource-boxes" class="row">
  134. {% for resource in resources %}
  135. <div id="resource" class="col-md-4 col-sm-6 py-3">
  136. <div class="card text-dark bg-{{type}} mb-3">
  137. <div class="card-body">
  138. {% if resource['type'] == 'tool' %}
  139. <a href="{{ url_for('tool.show_tool', tool_id=resource['id']) }}">
  140. <h3 class="card-title text-center text-dark">{{ resource['name'] }}</h3>
  141. </a>
  142. <p class="card-text">
  143. {{ resource['description']|truncate(100) }}
  144. </p>
  145. {% elif resource['type'] == 'practice' %}
  146. <a href="{{ url_for('practice.show_practice', practice_id=resource['id']) }}">
  147. <h3 class="card-title text-center text-dark">{{ resource['name'] }}</h3>
  148. </a>
  149. <p class="card-text">
  150. {{ resource['description']|truncate(100) }}
  151. </p>
  152. {% elif resource['type'] == 'book' %}
  153. <a href="{{ url_for('book.show_book', book_id=resource['id']) }}">
  154. <h3 class="card-title text-center text-dark">{{ resource['name'] }}</h3>
  155. </a>
  156. <p class="card-text text-center">
  157. {{ resource['author']|truncate(100) }}
  158. </p>
  159. {% endif %}
  160. {% if current_user.is_authenticated %}
  161. {% if resource['type'] == 'tool' %}
  162. <a href="{{ url_for('tool.edit_tool', tool_id=resource['id']) }}">
  163. <span class="badge bg-dark">Edit</span>
  164. </a>
  165. {% elif resource['type'] == 'practice' %}
  166. <a href="{{ url_for('practice.edit_practice', practice_id=resource['id']) }}">
  167. <span class="badge bg-dark">Edit</span>
  168. </a>
  169. {% elif resource['type'] == 'book' %}
  170. <a href="{{ url_for('book.edit_book', book_id=resource['id']) }}">
  171. <span class="badge bg-dark">Edit</span>
  172. </a>
  173. {% endif %}
  174. {% endif %}
  175. </div>
  176. </div>
  177. </div>
  178. {% endfor %}
  179. </div>
  180. </div>
  181. </div>
  182. {% endblock %}