annotate themes/default/static_blog.html @ 1193:aee3d8fa679f

pages: fixed cached data when `url_cache` is used: `request.template_data` and `request.data` where cached using a shallow copy, causing trouble when a mutable object was used. This has been fixed by using a deepcopy, which should not be a resource issue as `request.data` and `request.template_data` should contain a few data in most cases.
author Goffi <goffi@goffi.org>
date Wed, 12 Jun 2019 20:05:45 +0200
parents 6de862136eb6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
1 {#
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
2 Libervia: a Salut à Toi frontend
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
3 Copyright (C) 2011 - 2016 Jérôme Poisson <goffi@goffi.org>
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
4 Copyright (C) 2013 - 2016 Adrien Cossa <souliane@mailoo.org>
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
5
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
6
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
7 This program is free software: you can redistribute it and/or modify
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
8 it under the terms of the GNU Affero General Public License as published by
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
10 (at your option) any later version.
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
11
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
12 This program is distributed in the hope that it will be useful,
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
15 GNU Affero General Public License for more details.
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
16
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
17 You should have received a copy of the GNU Affero General Public License
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
19 #}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
20
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
21 {% macro message(entry) -%}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
22
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
23 <div class="mblog_entry {{ entry.style }}">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
24 {% if entry.type == "comment" %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
25 <div class="mblog_header">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
26 <div class="mblog_metadata">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
27 <div class="mblog_author">{{entry.author}}</div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
28 <div class="mblog_timestamp">{{entry.date}}</div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
29 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
30 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
31 {% else %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
32 <a href="{{entry.url}}" class="item_link">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
33 <div class="mblog_header mblog_header_main">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
34 <div class="mblog_metadata">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
35 <div class="mblog_author">{{entry.author}}</div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
36 <div class="mblog_timestamp">{{entry.date}}</div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
37 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
38 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
39 </a>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
40 {% endif %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
41 <span class="mblog_content">
743
916075bd0356 server_side: display tags in static blogs
souliane <souliane@mailoo.org>
parents: 712
diff changeset
42 {% if entry.title %}
916075bd0356 server_side: display tags in static blogs
souliane <souliane@mailoo.org>
parents: 712
diff changeset
43 <h2><a href="{{entry.url}}" class="item_link">{{entry.title}}</a></h2>
916075bd0356 server_side: display tags in static blogs
souliane <souliane@mailoo.org>
parents: 712
diff changeset
44 {% endif %}
916075bd0356 server_side: display tags in static blogs
souliane <souliane@mailoo.org>
parents: 712
diff changeset
45 {% if entry.tags %}
916075bd0356 server_side: display tags in static blogs
souliane <souliane@mailoo.org>
parents: 712
diff changeset
46 <ul class="mblog_tags">
916075bd0356 server_side: display tags in static blogs
souliane <souliane@mailoo.org>
parents: 712
diff changeset
47 {% for tag in entry.tags %}
855
de17f7313cbe server (blog): fixed atom feed link
Goffi <goffi@goffi.org>
parents: 853
diff changeset
48 <li><a href="{{url_base}}?tag={{tag}}">{{tag}}</a></li>
743
916075bd0356 server_side: display tags in static blogs
souliane <souliane@mailoo.org>
parents: 712
diff changeset
49 {% endfor %}
916075bd0356 server_side: display tags in static blogs
souliane <souliane@mailoo.org>
parents: 712
diff changeset
50 </ul>
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
51 {% endif %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
52 {{entry.content}}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
53 </span>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
54 {% if entry.type == "main_item" %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
55 <a href="{{entry.url}}" class="item_link">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
56 <div class="mblog_footer mblog_footer_main">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
57 <div class="mblog_metadata">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
58 <div class="mblog_comments">{{ entry.comments_text }}</div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
59 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
60 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
61 </a>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
62 {% endif %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
63 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
64 {% if entry.all_comments_link %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
65 {{ link(entry.all_comments_link) }}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
66 {% endif %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
67
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
68 {% for comment in entry.comments %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
69 {{ message(comment) }}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
70 {% endfor %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
71
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
72 {%- endmacro %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
73
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
74 {% macro link(entry) -%}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
75 <a href="{{entry.url}}" class="{{entry.style}}">{{entry.text}}</a>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
76 {%- endmacro %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
77
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
78 {% macro image(entry) -%}
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
79 <img src="{{entry.url}}" alt="{{entry.alt}}" />
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
80 {%- endmacro %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
81
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
82 <!DOCTYPE html>
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
83
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
84 <html>
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
85 <head profile="http://www.w3.org/2005/10/profile">
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
86 <meta charset="UTF-8" />
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
87 <meta name="keywords" content="{{keywords}}" />
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
88 <meta name="description" content="{{description}}" />
874
c030d8235c23 theme (default): added query information in blog's atom feed alternate url
Goffi <goffi@goffi.org>
parents: 855
diff changeset
89 <link rel="alternate" type="application/atom+xml" href="{{url_base}}/atom.xml{{url_query}}" />
897
6de862136eb6 theme (default): changed MIME type for xmpp: link
Goffi <goffi@goffi.org>
parents: 880
diff changeset
90 <link rel="alternate" type="application/atom+xml" href="{{xmpp_uri}}" />
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
91 <link rel='stylesheet' type="text/css" href='{{styles}}/blog.css' />
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
92 <link rel="icon" type="image/png" href="{{favicon}}" />
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
93
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
94 <title>{{title}}</title>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
95 </head>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
96
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
97 <body>
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
98 <div class="mblog_title">
855
de17f7313cbe server (blog): fixed atom feed link
Goffi <goffi@goffi.org>
parents: 853
diff changeset
99 <a href="{{url_base}}">
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
100 {{ image(banner_img) }}
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
101 {{ title }}
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
102 </a>
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
103 </div>
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
104
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
105 <div class="header">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
106 <div class="header_content">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
107 {{ link(navlinks.later_message) }}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
108 {{ link(navlinks.later_messages) }}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
109 {{ link(navlinks.older_message) }}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
110 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
111 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
112
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
113 {% for entry in messages %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
114 {{ message(entry) }}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
115 {% endfor %}
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
116
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
117 <div class="footer">
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
118 <div class="footer_content">
850
c64c039bb403 server (themes/default): display later and older messages link also in the footer (when only one message is displayed)
souliane <souliane@mailoo.org>
parents: 842
diff changeset
119 {{ link(navlinks.later_message) }}
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
120 {{ link(navlinks.older_messages) }}
850
c64c039bb403 server (themes/default): display later and older messages link also in the footer (when only one message is displayed)
souliane <souliane@mailoo.org>
parents: 842
diff changeset
121 {{ link(navlinks.older_message) }}
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
122 </div>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
123 </div>
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
124
797
6f2200d720d5 themes: add "Powered by Salut à Toi" in the footer
souliane <souliane@mailoo.org>
parents: 743
diff changeset
125 <div class="powered">
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
126 Powered by <a href="http://salut-a-toi.org" target="#"><img src="/media/icons/apps/16/sat.png" /> Salut à Toi</a>
797
6f2200d720d5 themes: add "Powered by Salut à Toi" in the footer
souliane <souliane@mailoo.org>
parents: 743
diff changeset
127 </div>
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
128
842
3eb26b269539 themes (default): display a link to the atom feed below the static blog entries
souliane <souliane@mailoo.org>
parents: 831
diff changeset
129 <div class="feed">
3eb26b269539 themes (default): display a link to the atom feed below the static blog entries
souliane <souliane@mailoo.org>
parents: 831
diff changeset
130 Subscribe to this news feed
855
de17f7313cbe server (blog): fixed atom feed link
Goffi <goffi@goffi.org>
parents: 853
diff changeset
131 <a href="{{url_base}}/atom.xml{{url_query}}" target="#">
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
132 <img src="{{images}}/atom/Feed-icon.svg" alt="Atom feed" />
842
3eb26b269539 themes (default): display a link to the atom feed below the static blog entries
souliane <souliane@mailoo.org>
parents: 831
diff changeset
133 </a>
3eb26b269539 themes (default): display a link to the atom feed below the static blog entries
souliane <souliane@mailoo.org>
parents: 831
diff changeset
134 </div>
853
fe43cf3ed7d8 server (blog/template): fixed template:
Goffi <goffi@goffi.org>
parents: 850
diff changeset
135
712
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
136 </body>
bf562fb9c273 server_side: use Jinja2 template engine for static blog
souliane <souliane@mailoo.org>
parents:
diff changeset
137 </html>