src/UI/WebBundle/Resources/views/Blog/articles_list.html.twig line 1

Open in your IDE?
  1. {% extends 'Common/base.html.twig' %}
  2. {% import 'Common/parts/functions.html.twig' as function %}
  3. {% block title %}{{ 'blog.list_articles.title'|trans }} | {{ parent() }}{% endblock %}
  4. {% block classBody %}blog {{ parent() }}{% endblock %}
  5. {% block javascripts %}
  6. {{ parent() }}
  7. {{ encore_entry_script_tags('wt_list_articles') }}
  8. {% endblock javascripts %}
  9. {% block contents %}
  10. <div class="container-small" ng-controller="listArticlesCtrl">
  11. <nav class="mb-2" aria-label="breadcrumb">
  12. <ol class="breadcrumb mb-0">
  13. <li class="breadcrumb-item"><a href="{{path('web_init')}}">Inicio</a></li>
  14. {% if articleCategory is defined %}
  15. <li class="breadcrumb-item" ><a href="{{path('web_blog_list_articles')}}">Blog</a></li>
  16. <li class="breadcrumb-item active" aria-current="page">{{ articleCategory.title(locale)}}</li>
  17. {% else %}
  18. <li class="breadcrumb-item active" aria-current="page">Blog</li>
  19. {% endif %}
  20. </ol>
  21. </nav>
  22. <h1 class="my-2">{{ 'blog.list_articles.title'|trans }}</h1>
  23. {% if articleCategory is defined %}
  24. <h3 ><a class="text-muted" href="{{url('web_blog_list_articles_category',{ 'categorySlug': articleCategory.slug(locale)})}}">{{ articleCategory.title(locale)}}</h3>
  25. {% endif %}
  26. <div class="row">
  27. {% for article in articlePage %}
  28. <div class="col-12 my-2 py-1">
  29. <div class="card" >
  30. {% if article.headerImageUrl %}
  31. <a href="{{ url('web_blog_show_article', { 'articleSlug' : article.slug(locale), '_locale': locale })}}">
  32. <img class="card-img-top" src="{{ article.headerImageUrl | imagine_filter('whater_blog_header_list_image_1200_200') }}" title="{{ article.title(locale) }}">
  33. </a>
  34. {% endif %}
  35. <div class="card-body">
  36. <a class="text-dark" href="{{ url('web_blog_show_article', { 'articleSlug' : article.slug(locale), '_locale': locale })}}">
  37. <h3 class="card-title">{{ article.title(locale) }}</h3>
  38. </a>
  39. <p class="card-text">{{ article.content(locale) | striptags | u.truncate(350) |raw }}...</p>
  40. <div class="my-1">
  41. <span class="">Categorias:</span>
  42. {% for category in article.categories(locale) %}
  43. <a class="text-muted" href="{{ url('web_blog_list_articles_category', { 'categorySlug': category.slug(locale), '_locale': locale} )}}">{{ category.title(locale) }}</a>
  44. {% if not loop.last %} | {%endif%}
  45. {% endfor %}
  46. </div>
  47. <div class="fs--1 text-muted">{{ article.publishAt | date('d-m-Y') }} - {{ article.publishAt | ago }}</div>
  48. <div class="my-1">
  49. {% for metaKeyword in article.metaKeywords(locale) %}
  50. <a class="text-muted fs--1">#{{ metaKeyword | replace({' ': '-'})}}</a>
  51. {% endfor %}
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. {% endfor %}
  57. </div>
  58. {% if articlePage.haveToPaginate() and articleCategory is not defined %}
  59. <div class="row">
  60. <div class="col-12 my-2 py-1">
  61. <div class="d-flex justify-content-between">
  62. {% if articlePage.hasPreviousPage() %}
  63. <a class="btn btn-secondary" href="{{url('web_blog_list_articles',{'page':articlePage.getPreviousPage()})}}">Página anterior</a>
  64. {% else %}
  65. <div></div>
  66. {% endif %}
  67. {% if articlePage.hasNextPage() %}
  68. <a class="btn btn-secondary" href="{{url('web_blog_list_articles',{'page':articlePage.getNextPage()})}}">Siguiente página</a>
  69. {% else %}
  70. <div></div>
  71. {% endif %}
  72. </div>
  73. </div>
  74. </div>
  75. {% elseif articlePage.haveToPaginate() and articleCategory is defined %}
  76. <div class="row">
  77. <div class="col-12 my-2 py-1">
  78. <div class="d-flex justify-content-between">
  79. {% if articlePage.hasPreviousPage() %}
  80. <a class="btn btn-secondary" href="{{url('web_blog_list_articles_category',{'categorySlug': articleCategory.slug(locale), 'page':articlePage.getPreviousPage()})}}">Página anterior</a>
  81. {% else %}
  82. <div></div>
  83. {% endif %}
  84. {% if articlePage.hasNextPage() %}
  85. <a class="btn btn-secondary" href="{{url('web_blog_list_articles_category',{'categorySlug': articleCategory.slug(locale), 'page':articlePage.getNextPage()})}}">Siguiente página</a>
  86. {% else %}
  87. <div></div>
  88. {% endif %}
  89. </div>
  90. </div>
  91. </div>
  92. {% endif %}
  93. </div>
  94. {#
  95. <div class="main-content" ng-controller="listArticlesCtrl">
  96. <div class="ui container">
  97. <h2>{{ 'blog.list_articles.title'|trans }}</h2>
  98. <div class="separator-line"></div>
  99. {% if articleCategory is defined %}
  100. <h3><a href="{{url('web_blog_list_articles_category',{ 'categorySlug': articleCategory.slug(locale)})}}">{{ articleCategory.title(locale)}}</h3>
  101. {% endif %}
  102. <div class="ui stackable two cards">
  103. {% for article in articlePage %}
  104. <div class="ui raised card no_shadow">
  105. <div class="content">
  106. <div class="article-image">
  107. {% if article.headerImageUrl %}
  108. <img class="ui small image" src="{{ article.headerImageUrl }}">
  109. {% else %}
  110. <img class="ui small image" src="{{asset('/assets/images/logo_v2.png')}}">
  111. {% endif %}
  112. </div>
  113. <div class="header"><a href="{{ url('web_blog_show_article', { 'articleSlug' : article.slug(locale), '_locale': locale })}}">{{ article.title(locale) }}</a></div>
  114. <div class="meta">{{ article.publishAt | ago }}</div>
  115. <div class="extra content article-categories">
  116. {% for category in article.categories(locale) %}
  117. <a href="{{ url('web_blog_list_articles_category', { 'categorySlug': category.slug(locale), '_locale': locale} )}}">{{ category.title(locale) }}</a>
  118. {% if not loop.last %} | {%endif%}
  119. {% endfor %}
  120. </div>
  121. <div class="ui ">
  122. </div>
  123. <div class="description">
  124. {{ article.content(locale) | striptags | u.truncate(300) |raw }}
  125. </div>
  126. <div class="extra content article-keywords">
  127. {% for metaKeyword in article.metaKeywords(locale) %}
  128. <a>#{{ metaKeyword | replace({' ': '-'})}}</a>
  129. {% endfor %}
  130. </div>
  131. </div>
  132. </div>
  133. {% endfor %}
  134. </div>
  135. {% if articlePage.haveToPaginate() and articleCategory is not defined %}
  136. <div class="ui right floated pagination">
  137. {% if articlePage.hasPreviousPage() %}
  138. <a class="item" href="{{url('web_blog_list_articles',{'page':articlePage.getPreviousPage()})}}">Página anterior</a>
  139. {% endif %}
  140. {% if articlePage.hasNextPage() %}
  141. <a class="item" href="{{url('web_blog_list_articles',{'page':articlePage.getNextPage()})}}">Siguiente página</a>
  142. {% endif %}
  143. </div>
  144. {% elseif articlePage.haveToPaginate() and articleCategory is defined %}
  145. <div class="ui right floated pagination">
  146. {% if articlePage.hasPreviousPage() %}
  147. <a class="item" href="{{url('web_blog_list_articles_category',{'categorySlug': articleCategory.slug(locale), 'page':articlePage.getPreviousPage()})}}">Página anterior</a>
  148. {% endif %}
  149. {% if articlePage.hasNextPage() %}
  150. <a class="item" href="{{url('web_blog_list_articles_category',{'categorySlug': articleCategory.slug(locale), 'page':articlePage.getNextPage()})}}">Siguiente página</a>
  151. {% endif %}
  152. </div>
  153. {% endif %}
  154. </div>
  155. </div>
  156. #}
  157. {% endblock contents %}