Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

130 lines
3.5KB

  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <!-- <div class="cell-margin">
  4. <div class="mb-8">
  5. <h2>
  6. {% block title %}
  7. {% autoescape false %}
  8. {{ type + 's' | replace(" ","<br>") }}
  9. {% endautoescape %}
  10. {% endblock %}
  11. </h2>
  12. <p>
  13. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget viverra magna. Nam in ante ultricies
  14. purus feugiat vestibulum et ac erat. Donec in sagittis ante. Maecenas non mauris et eros commodo fringilla.
  15. Integer accumsan ullamcorper diam, non rhoncus tellus molestie ut. Maecenas finibus pretium dolor ac sagittis.
  16. </p>
  17. </div>
  18. </div> -->
  19. {% macro filter_dropdown(id, filter, plural='') %}
  20. <select
  21. name="{{ id }}"
  22. >
  23. <option
  24. value=""
  25. {% if request.args.get(id, '' )=='' %} selected {% endif %}
  26. >
  27. {% if plural != '' %}
  28. {{ plural }}
  29. {% else %}
  30. <span class="capitalize bg-red-400">{{ id }}s</span>
  31. {% endif%}
  32. </option>
  33. {% for thing in filter %}
  34. <option
  35. value="{{ thing[0] }}"
  36. {% if request.args.get(id)==thing[0]|string %} selected {% endif %}
  37. >
  38. {{ thing[1] }}
  39. </option>
  40. {% endfor %}
  41. </select>
  42. {% endmacro%}
  43. {% macro filter_dropdown_nokey(id, filter, plural='') %}
  44. <select
  45. name="{{ id }}"
  46. >
  47. <option
  48. value=""
  49. {% if request.args.get(id, '' ) == '' %} selected {% endif %}
  50. >
  51. {% if plural != '' %}
  52. {{ plural }}
  53. {% else %}
  54. <span class="capitalize">{{ id }}s</span>
  55. {% endif%}
  56. </option>
  57. {% for thing in filter %}
  58. <option
  59. value="{{ thing }}"
  60. {% if request.args.get(id)==thing|string %} selected {% endif %}
  61. >
  62. {{ thing }}
  63. </option>
  64. {% endfor %}
  65. </select>
  66. {% endmacro%}
  67. <div class="border-b-2 border-black grid lg:grid-cols-[52rem,30rem] content-start">
  68. <div class="mx-2 lg:ml-[13rem] text my-8 meta lg:max-w-[30rem]">
  69. {{ intro_text|safe }}
  70. </div>
  71. </div>
  72. <form
  73. action="{{ url_for(request.endpoint )}}"
  74. method="GET"
  75. hx-trigger="change"
  76. hx-push-url="true"
  77. >
  78. <input type="hidden" name="view" value="{{ view }}">
  79. <div class="flex flex-wrap gap-4 items-center min-h-[2rem] mb-8 border-b-2 border-black ">
  80. {{ view_switch() }}
  81. {% if practices_filter%}
  82. {{ filter_dropdown('practice', practices_filter, 'Practices') }}
  83. {% endif %}
  84. {% if year_filter %}
  85. {{ filter_dropdown_nokey('year', year_filter, 'Year') }}
  86. {% endif %}
  87. {% if typology_filter %}
  88. {{ filter_dropdown_nokey('typology', typology_filter, 'Typologies') }}
  89. {% endif %}
  90. {% if languages_filter %}
  91. {{ filter_dropdown_nokey('scriptingLanguage', languages_filter, 'Scripting languages') }}
  92. {% endif %}
  93. {% if licenses_filter %}
  94. {{ filter_dropdown_nokey('license', licenses_filter, 'Licenses') }}
  95. {% endif %}
  96. {% if status_filter %}
  97. {{ filter_dropdown_nokey('status', status_filter, 'Maintenance status') }}
  98. {% endif %}
  99. <a href="{{ url_for(request.endpoint) }}?view={{ view }}">Reset</a>
  100. </div>
  101. <div>
  102. {% if view == 'list' %}
  103. {% for resource in resources %}
  104. {{ resource_list(resource, loop) }}
  105. {% endfor %}
  106. {% else %}
  107. {% for resource in resources %}
  108. {{ resource_with_related(resource, loop) }}
  109. {% endfor %}
  110. {% endif %}
  111. </div>
  112. </form>
  113. {% endblock %}