您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

111 行
4.2KB

  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 }}" hx-trigger="change">
  21. <option value="all" {% if request.args.get(id, '' ) == '' %} selected {% endif %}
  22. hx-get="{{ request.base_url }}?{% for key in request.args %}{% if key != id %}&{{ key }}={{ request.args.get(key) }}{% endif %}{% endfor %}"
  23. hx-push-url="true">
  24. {% if plural != '' %}
  25. All {{ plural }}
  26. {% else %}
  27. All {{ id }}s
  28. {% endif%}
  29. </option>
  30. {% for thing in filter %}
  31. <option value="{{ thing[0] }}" {% if request.args.get(id)==thing[0]|string %} selected {% endif %}
  32. hx-get="{{ request.base_url }}?{{ id }}={{ thing[0] }}{% for key in request.args %}{% if key != id %}&{{ key }}={{ request.args.get(key) }}{% endif %}{% endfor %}"
  33. hx-push-url="true">
  34. {{ thing[1] }}
  35. </option>
  36. {% endfor %}
  37. </select>
  38. {% endmacro%}
  39. {% macro filter_dropdown_nokey(id, filter, plural='') %}
  40. <select name="{{ id }}" hx-trigger="change">
  41. <option value="all" {% if request.args.get(id, '' ) == '' %} selected {% endif %}
  42. hx-get="{{ request.base_url }}?{% for key in request.args %}{% if key != id %}&{{ key }}={{ request.args.get(key) }}{% endif %}{% endfor %}"
  43. hx-push-url="true">
  44. {% if plural != '' %}
  45. All {{ plural }}
  46. {% else %}
  47. All {{ id }}s
  48. {% endif%}
  49. </option>
  50. {% for thing in filter %}
  51. <option value="{{ thing }}" {% if request.args.get(id)==thing|string %} selected {% endif %}
  52. hx-get="{{ request.base_url }}?{{ id }}={{ thing }}{% for key in request.args %}{% if key != id %}&{{ key }}={{ request.args.get(key) }}{% endif %}{% endfor %}"
  53. hx-push-url="true">
  54. {{ thing }}
  55. </option>
  56. {% endfor %}
  57. </select>
  58. {% endmacro%}
  59. <div class="border-b-2 border-black grid lg:grid-cols-[52rem,30rem] content-start">
  60. <div class="mx-2 lg:ml-[13rem] text my-8 meta lg:max-w-[30rem]">
  61. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultricies egestas felis at dignissim. Morbi ut bibendum
  62. nisl. Integer ac sollicitudin risus. Vivamus et est est. Ut vitae lacus nec justo tincidunt interdum. Fusce sapien odio,
  63. commodo nec est et, interdum varius risus. Curabitur vehicula consequat auctor.
  64. </div>
  65. </div>
  66. <div class="" >
  67. <div id="resources" >
  68. {{ view_switch() }}
  69. <div class="flex gap-8">
  70. {% if practices_filter %}
  71. {{ filter_dropdown('practice', practices_filter) }}
  72. {% endif %}
  73. {% if year_filter %}
  74. {{ filter_dropdown_nokey('year', year_filter) }}
  75. {% endif %}
  76. {% if typology_filter %}
  77. {{ filter_dropdown_nokey('typology', typology_filter, 'typologies') }}
  78. {% endif %}
  79. {% if languages_filter %}
  80. {{ filter_dropdown_nokey('scriptingLanguage', languages_filter, 'scripting languages') }}
  81. {% endif %}
  82. {% if licenses_filter %}
  83. {{ filter_dropdown_nokey('license', licenses_filter) }}
  84. {% endif %}
  85. {% if status_filter %}
  86. {{ filter_dropdown_nokey('status', status_filter, 'statuses') }}
  87. {% endif %}
  88. </div>
  89. <div>
  90. {% if view == 'list' %}
  91. {% for resource in resources %}
  92. {{ resource_list(resource, loop) }}
  93. {% endfor %}
  94. {% else %}
  95. {% for resource in resources %}
  96. {{ resource_with_related(resource, loop) }}
  97. {% endfor %}
  98. {% endif %}
  99. </div>
  100. </div>
  101. </div>
  102. {% endblock %}