From 17a65364a0f4e06b692a6fa4aa746af7c34d2a8b Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Wed, 3 May 2023 05:32:55 +0200 Subject: [PATCH] Adding missing templates. --- templates/page/_list_posts.html.ep | 25 +++++++++++++++++++++++++ templates/page/attribute.html.ep | 18 ++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 templates/page/_list_posts.html.ep create mode 100644 templates/page/attribute.html.ep diff --git a/templates/page/_list_posts.html.ep b/templates/page/_list_posts.html.ep new file mode 100644 index 0000000..fd98c4d --- /dev/null +++ b/templates/page/_list_posts.html.ep @@ -0,0 +1,25 @@ +% my $posts = stash 'posts'; +

Artículos

+
+% unless (defined $posts && @$posts) { +

Parece que aun no hay artículos.

+% } +% for my $post (@$posts) { + +
<% + my $date_article = DateTime::Format::ISO8601->parse_datetime($post->{date}); + $date_article->set_time_zone('Europe/Madrid'); + %>

<%= ''.$date_article %>

<% + if (defined $post->{image}) { + %>Portada de <%=$post->{title}%><% + } + %>

<%=$post->{title}%>

<% + my $xml = Mojo::DOM->new($post->{content}); + my $text = $xml->all_text; + if (length($text) > 120) { + $text = substr($text, 0, 100).'...'; + } + %>

<%=$text%>

Escrito por <%=$post->{author}%>

+
+% } +
diff --git a/templates/page/attribute.html.ep b/templates/page/attribute.html.ep new file mode 100644 index 0000000..500c15a --- /dev/null +++ b/templates/page/attribute.html.ep @@ -0,0 +1,18 @@ +% use Data::Dumper; +% use DateTime::Format::ISO8601; +% +% use Mojo::DOM; +% use Mojo::Util; +% +% use BurguillosInfo::Posts; +% +% my $category = stash 'category'; +% my $attribute = stash 'attribute'; +% my $posts = stash 'posts'; +% layout 'default', current_category_slug => $category->{slug}; +% title $attribute->{title}; +
+

<%= $attribute->{title} %>

+ <%== $attribute->{description} %> +%= include 'page/_list_posts', posts => $posts; +