listing.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. {% extends 'base_no_card.html' %}
  2. {% load crispy_forms_tags %}
  3. {% load static %}
  4. {% block exted_menu %}
  5. {% for cat in page.blog_cat %}
  6. <li class="nav-item"><a class="nav-link" href="{% url 'blog_tag' cat.cb_titre_slgify %}">{{cat.cb_titre}}</a></li>
  7. {% endfor %}
  8. <li class="nav-item"><a class="nav-link" href="{% url 'blog_tag' 'all' %}">Tous les articles</a></li>
  9. {% endblock %}
  10. {% block main %}
  11. <style>
  12. /* Style pour les articles avec miniatures à gauche */
  13. .article-card {
  14. background-color: rgba(250,250,250,0.88);
  15. border-radius: 8px;
  16. overflow: hidden;
  17. margin-bottom: 1.5rem;
  18. box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  19. transition: box-shadow 0.3s ease;
  20. }
  21. .article-card:hover {
  22. box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  23. }
  24. .article-row {
  25. display: flex;
  26. flex-direction: row;
  27. align-items: stretch;
  28. }
  29. .article-image-container {
  30. position: relative;
  31. width: 280px;
  32. min-width: 280px;
  33. overflow: hidden;
  34. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  35. }
  36. .article-image-container::after {
  37. content: '';
  38. position: absolute;
  39. top: 0;
  40. right: 0;
  41. bottom: 0;
  42. width: 60px;
  43. background: linear-gradient(to right, rgba(250,250,250,0) 0%, rgba(250,250,250,0.88) 100%);
  44. pointer-events: none;
  45. }
  46. .article-image-container img {
  47. width: 100%;
  48. height: 100%;
  49. object-fit: cover;
  50. object-position: center;
  51. display: block;
  52. }
  53. .article-image-placeholder {
  54. width: 100%;
  55. height: 100%;
  56. display: flex;
  57. align-items: center;
  58. justify-content: center;
  59. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  60. color: white;
  61. font-size: 2rem;
  62. font-weight: bold;
  63. }
  64. .article-content {
  65. flex: 1;
  66. padding: 1.5rem;
  67. display: flex;
  68. flex-direction: column;
  69. }
  70. .article-title {
  71. font-size: 1.5rem;
  72. font-weight: 700;
  73. color: #1a202c;
  74. margin-bottom: 1rem;
  75. text-decoration: none;
  76. }
  77. .article-title:hover {
  78. color: #667eea;
  79. }
  80. .article-description {
  81. color: #4a5568;
  82. line-height: 1.6;
  83. margin-bottom: 1rem;
  84. flex: 1;
  85. }
  86. .article-footer {
  87. display: flex;
  88. align-items: center;
  89. justify-content: space-between;
  90. padding-top: 1rem;
  91. border-top: 1px solid #e2e8f0;
  92. font-size: 0.9rem;
  93. color: #718096;
  94. }
  95. .article-meta {
  96. display: flex;
  97. align-items: center;
  98. gap: 0.5rem;
  99. flex-wrap: wrap;
  100. }
  101. .article-category {
  102. display: inline-block;
  103. padding: 0.5rem 1rem;
  104. background: #343a40;
  105. color: white;
  106. border-radius: 4px;
  107. font-size: 0.9rem;
  108. font-weight: 500;
  109. text-decoration: none;
  110. transition: background 0.2s;
  111. border: none;
  112. }
  113. .article-category:hover {
  114. background: #23272b;
  115. color: white;
  116. text-decoration: none;
  117. }
  118. /* Responsive */
  119. @media (max-width: 768px) {
  120. .article-row {
  121. flex-direction: column;
  122. }
  123. .article-image-container {
  124. width: 100%;
  125. height: 200px;
  126. }
  127. .article-image-container::after {
  128. top: auto;
  129. bottom: 0;
  130. left: 0;
  131. right: 0;
  132. width: 100%;
  133. height: 40px;
  134. background: linear-gradient(to bottom, rgba(250,250,250,0) 0%, rgba(250,250,250,0.88) 100%);
  135. }
  136. .article-content {
  137. padding: 1rem;
  138. }
  139. .article-title {
  140. font-size: 1.3rem;
  141. }
  142. }
  143. </style>
  144. {% if page.blog_art %}
  145. {% for item in page.blog_art %}
  146. <article class="article-card">
  147. <div class="article-row">
  148. <!-- Miniature à gauche -->
  149. <div class="article-image-container">
  150. {% if item.b_description_img %}
  151. <a href="{% url 'blog_play' item.b_titre_slugify %}">
  152. <img src="{{item.b_description_img}}" alt="{{item.b_titre}}">
  153. </a>
  154. {% else %}
  155. <div class="article-image-placeholder">
  156. <i class="fas fa-file-alt"></i>
  157. </div>
  158. {% endif %}
  159. </div>
  160. <!-- Contenu à droite -->
  161. <div class="article-content">
  162. <a href="{% url 'blog_play' item.b_titre_slugify %}" class="article-title text-decoration-none">
  163. <h2 class="article-title">{{item.b_titre}}</h2>
  164. </a>
  165. <div class="article-description">
  166. {{item.b_description|safe|truncatewords_html:40}}
  167. </div>
  168. <div class="article-footer">
  169. <div class="article-meta">
  170. <span>
  171. <i class="far fa-clock"></i> {{item.b_publdate|timesince}}
  172. </span>
  173. {% if item.b_cat.all %}
  174. {% for cat in item.b_cat.all %}
  175. <a href="{% url 'blog_tag' cat.cb_titre_slgify %}" class="article-category">
  176. {{ cat.cb_titre }}
  177. </a>
  178. {% endfor %}
  179. {% endif %}
  180. </div>
  181. <span class="text-muted">
  182. <i class="far fa-eye"></i> {{item.b_reading}}
  183. </span>
  184. </div>
  185. </div>
  186. </div>
  187. </article>
  188. {% endfor %}
  189. {% else %}
  190. <div class="alert alert-info">
  191. <i class="fas fa-info-circle"></i> Aucun article trouvé.
  192. </div>
  193. {% endif %}
  194. {% endblock %}
  195. {% block right_panel %}
  196. {% if page.p_right != "" %}
  197. <div class="card" style="background-color: rgba(250,250,250,0.88);" >
  198. <div class="card-body">
  199. <form action="" method="get">
  200. <div class="row align-items-center">
  201. <div class="col-lg-8 col-sm-12">
  202. {{page.blog_search|crispy}}
  203. </div>
  204. <div class="col mt-sm-1">
  205. <input type="submit" class="btn btn-success w-100" value="Rechercher">
  206. </div>
  207. </div>
  208. </form>
  209. <hr>
  210. {% if page.blog_art.paginator.num_pages != 1 %}
  211. <p class="card-text">
  212. <nav aria-label="...">
  213. <ul class="pagination justify-content-center">
  214. {% if page.blog_art.has_previous %}
  215. <li class="page-item">
  216. <a class="page-link" href="?page={{ page.blog_art.previous_page_number }}"> << </a>
  217. </li>
  218. {% else %}
  219. <li class="page-item disabled">
  220. <span class="page-link"> << </span>
  221. </li>
  222. {% endif %}
  223. {% for nb_page in page.blog_art.nbpage %}
  224. {% if page.blog_art.number == forloop.counter %}
  225. <li class="page-item active" aria-current="page"><span class="page-link">{{forloop.counter}}</span></li>
  226. {% else %}
  227. <li class="page-item"><a class="page-link" href="?page={{forloop.counter}}">{{forloop.counter}}</a></li>
  228. {% endif %}
  229. {% endfor %}
  230. {% if page.blog_art.has_next %}
  231. <li class="page-item">
  232. <a class="page-link" href="?page={{ page.blog_art.next_page_number }}"> >> </a>
  233. </li>
  234. {% else %}
  235. <li class="page-item disabled">
  236. <span class="page-link"> >> </span>
  237. </li>
  238. {% endif %}
  239. </ul>
  240. </nav>
  241. <p>
  242. {% endif %}
  243. <p class="card-text">{{page.p_right|safe}}</p>
  244. <h4> <i class="fas fa-tags"></i> Les Catégories </h4>
  245. <p class="card-text">
  246. {% for cat in page.blog_cat %}
  247. <a href="{% url 'blog_tag' cat.cb_titre_slgify %}" class="btn btn-dark mb-2" tabindex="-1" role="button" aria-disabled="true">{{cat.cb_titre}}</a>
  248. {% endfor %}
  249. {% if page.blog_filter == True %}
  250. <a href="{% url 'blog_index' %}" class="btn btn-danger mb-2" tabindex="-1" role="button" aria-disabled="true"><i class="fas fa-filter text-white"></i> Retirer les filtres</a>
  251. {% else %}
  252. <a href="{% url 'blog_tag' 'all' %}" class="btn btn-dark mb-2" tabindex="-1" role="button" aria-disabled="true">Tous les articles</a>
  253. {% endif %}
  254. </p>
  255. <h4> <i class="fas fa-bomb"></i> Les articles les plus consulté </h4>
  256. <p class="card-text">
  257. {% for item in page.blog_top10 %}
  258. <i class="far fa-play-circle"></i> <a class="text-dark" data-bs-toggle="tooltip" data-bs-placement="top" title="{{item.b_titre}}" href="{% url 'blog_play' item.b_titre_slugify %}">{{item.b_titre|truncatechars:40}}</a><br>
  259. {% endfor %}
  260. </p>
  261. {% if page.retour %}
  262. <p class="card-text">
  263. <a href="{% url page.retour %}" class="btn btn-dark mb-2" tabindex="-1" role="button" aria-disabled="true"><i class="fas fa-undo-alt"></i> Retour</a>
  264. </p>
  265. {% endif %}
  266. </div>
  267. </div>
  268. {% endif %}
  269. {% endblock %}