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

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