Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

132 lines
4.4KB

  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 name="{{ id }}">
  21. <option value="" {% if request.args.get(id, '' )=='' %} selected {% endif %}>
  22. {% if plural != '' %}
  23. {{ plural }}
  24. {% else %}
  25. <span class="capitalize bg-red-400">{{ id }}s</span>
  26. {% endif%}
  27. </option>
  28. {% for thing in filter %}
  29. <option value="{{ thing[0] }}" {% if request.args.get(id)==thing[0]|string %} selected {% endif %}>
  30. {{ thing[1] }}
  31. </option>
  32. {% endfor %}
  33. </select>
  34. {% endmacro%}
  35. {% macro filter_dropdown_nokey(id, filter, plural='') %}
  36. <select name="{{ id }}">
  37. <option value="" {% if request.args.get(id, '' )=='' %} selected {% endif %}>
  38. {% if plural != '' %}
  39. {{ plural }}
  40. {% else %}
  41. <span class="capitalize">{{ id }}s</span>
  42. {% endif%}
  43. </option>
  44. {% for thing in filter %}
  45. <option value="{{ thing }}" {% if request.args.get(id)==thing|string %} selected {% endif %}>
  46. {{ thing }}
  47. </option>
  48. {% endfor %}
  49. </select>
  50. {% endmacro%}
  51. <div class="border-b-2 border-black grid lg:grid-cols-[52rem,30rem] content-start">
  52. <div class="mx-4 lg:ml-[13rem] text my-4 lg:my-8 meta lg:max-w-[30rem]">
  53. {{ intro_text|safe }}
  54. </div>
  55. </div>
  56. <form action="{{ url_for(request.endpoint )}}" method="GET" hx-trigger="change" hx-push-url="true">
  57. <input type="hidden" name="view" value="{{ view }}">
  58. <div
  59. class="flex p-4 lg:p-0 flex-col items-start lg:items-center lg:flex-row lg:flex-wrap gap-2 lg:gap-4 min-h-[2rem] mb-8 border-b-2 border-black ">
  60. <div class="-m-4 mb-4 lg:m-0">
  61. {{ view_switch() }}
  62. </div>
  63. {% if practices_filter%}
  64. {{ filter_dropdown('practice', practices_filter, 'Practices') }}
  65. {% endif %}
  66. {% if year_filter %}
  67. {{ filter_dropdown_nokey('year', year_filter, 'Year') }}
  68. {% endif %}
  69. {% if typology_filter %}
  70. {{ filter_dropdown_nokey('typology', typology_filter, 'Typologies') }}
  71. {% endif %}
  72. {% if languages_filter %}
  73. {{ filter_dropdown_nokey('scriptingLanguage', languages_filter, 'Scripting languages') }}
  74. {% endif %}
  75. {% if licenses_filter %}
  76. {{ filter_dropdown_nokey('license', licenses_filter, 'Licenses') }}
  77. {% endif %}
  78. {% if status_filter %}
  79. {{ filter_dropdown_nokey('status', status_filter, 'Maintenance status') }}
  80. {% endif %}
  81. {% if not practices_filter and not year_filter and not typology_filter and not languages_filter and not licenses_filter and not status_filter %}
  82. {% else %}
  83. <a href="{{ url_for(request.endpoint) }}?view={{ view }}">Reset</a>
  84. {% endif %}
  85. </div>
  86. <div>
  87. {% if view == 'list' %}
  88. {% for resource in resources %}
  89. {{ resource_list(resource, loop) }}
  90. {% endfor %}
  91. {% else %}
  92. {% for resource in resources %}
  93. {{ resource_with_related(resource, loop) }}
  94. {% endfor %}
  95. {% endif %}
  96. </div>
  97. {% macro render_pagination(pagination) %}
  98. <div class=page-items>
  99. {{ pagination.first }} - {{ pagination.last }} of {{ pagination.total }}
  100. </div>
  101. <div class=pagination>
  102. {% for page in pagination.iter_pages() %}
  103. {% if page %}
  104. {% if page != pagination.page %}
  105. <a href="{{ url_for(request.endpoint, page=page) }}{% for key in request.args %}{% if key != 'page' %}&{{ key }}={{ request.args.get(key) }}{% endif %}{% endfor %}">{{ page }}</a>
  106. {% else %}
  107. <strong>{{ page }}</strong>
  108. {% endif %}
  109. {% else %}
  110. <span class=ellipsis>…</span>
  111. {% endif %}
  112. {% endfor %}
  113. </div>
  114. {% endmacro %}
  115. {{ render_pagination(resources) }}
  116. </form>
  117. {% endblock %}