[MERGE] forward port of branch 8.0 up to 491372e
[odoo/odoo.git] / addons / website_blog / views / website_blog_templates.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3 <data>
4
5 <template id="assets_editor" inherit_id="website.assets_editor" name="Blog Editor" groups="base.group_website_publisher">
6     <xpath expr="." position="inside">
7         <script type="text/javascript" src="/website_blog/static/src/js/website_blog.editor.js"></script>
8         <script type="text/javascript" src="/website_blog/static/src/js/website.tour.blog.js"></script>
9     </xpath>
10 </template>
11
12 <template id="assets_frontend" inherit_id="website.assets_frontend" name="Blog Front-end assets">
13     <xpath expr="." position="inside">
14         <link rel='stylesheet' href='/website_blog/static/src/css/website_blog.css'/>
15
16         <script type="text/javascript" src="/website_blog/static/lib/contentshare.js"/>
17         <script type="text/javascript" src="/website_blog/static/src/js/website_blog.inline.discussion.js"></script>
18         <script type="text/javascript" src="/website_blog/static/src/js/website_blog.js"/>
19     </xpath>
20 </template>
21
22 <!-- Layout add nav and footer -->
23 <template id="header_footer_custom" inherit_id="website.footer_default" name="Footer News Blog Link">
24     <xpath expr="//div[@id='info']/ul" position="inside">
25         <li><a t-attf-href="/blog/%(website_blog.blog_blog_1)d">News</a></li>
26     </xpath>
27 </template>
28
29 <!-- Overview of all blog posts -->
30 <template id="latest_blogs" name="Latest Blogs">
31     <t t-call="website.layout">
32         <div id="wrap">
33             <div class="oe_structure"/>
34             <section class="container">
35                 <div class="alert alert-warning alert-dismissable mt16" groups="base.group_website_publisher">
36                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
37                    <p>
38                    This page is great to improve your <strong>Search Engine Optimization</strong>;
39                    You can review titles, keywords and descriptions of all blogs at once.
40                    </p><p>
41                    You should <strong>add a banner on the top</strong> as it is a frequent landing page for new visitors.
42                    <span class="text-muted">This box will not be visible to your visitors.</span>
43                    </p>
44                 </div>
45                 <t t-call="website.pager" >
46                     <t t-set="classname">pull-right</t>
47                 </t>
48             </section>
49             <section class="container">
50                 <div class="row">
51                     <div class="col-md-12 text-center">
52                         <h1>Latest Posts</h1>
53                     </div>
54                 </div>
55             </section>
56             <section class="container">
57                 <div class="row">
58                     <t t-set="count" t-value="0"/>
59                     <t t-foreach="posts" t-as="post">
60                       <div class="col-md-4">
61                         <h4>
62                             <a t-attf-href="#{blog_url('', ['blog', 'post'], blog=post.blog_id, post=post)}" t-field="post.name"></a>
63                             <span t-if="not post.website_published" class="text-warning">
64                                 &amp;nbsp;
65                                 <span class="fa fa-warning" title="Not published"/>
66                             </span>
67                         </h4>
68                         <div class="text-muted">
69                             <span class="fa fa-calendar"> <span t-field="post.create_date"/> &amp;nbsp;</span>
70                             <span class="fa fa-folder-open"> In
71                                 <a t-attf-href="#{blog_url(blog=post.blog_id)}">
72                                 <span t-field="post.blog_id"/>
73                                 </a> &amp;nbsp;
74                             </span>
75                         </div>
76                         <div class="text-muted fa fa-tags">
77                             <span t-field="post.website_meta_keywords"/>
78                             <span t-if="editable and not post.website_meta_keywords" class="label label-danger">
79                                 No keywords defined!
80                             </span>
81                         </div>
82                         <div class="text-muted" t-if="len(post.message_ids) &gt; 0">
83                             <span class="fa fa-comment-o">
84                                 <a t-attf-href="#{blog_url('', ['blogpost'], blogpost=post)}#comments">
85                                     <t t-if="len(post.message_ids) &lt;= 1" ><t t-esc="len(post.message_ids)"/> comment</t>
86                                     <t t-if="len(post.message_ids) > 1"><t t-esc="len(post.message_ids)"/> comments</t>
87                                 </a>
88                             </span>
89                         </div>
90                         <div class="text-muted mb16" t-field="post.website_meta_description"/>
91                       </div>
92                       <t t-set="count" t-value="count+1"/>
93                       <div class="clearfix" t-if="(count % 3) == 0"/>
94                     </t>
95                 </div>
96             </section>
97             <div class="oe_structure"/>
98         </div>
99     </t>
100 </template>
101
102 <!-- Blog Post List: Displaying a list of Blog Posts -->
103 <template id="blog_post_short" name="Blog Posts">
104     <t t-call="website_blog.index">
105         <div class="oe_structure">
106             <section class="mb0">
107                 <div class="container">
108                     <div class="row">
109                         <t t-call="website.pager" >
110                             <t t-set="classname">pull-right</t>
111                         </t>
112                         <div class="col-md-12 mb32 mt16 text-center">
113                             <h1 t-field="blog.name"/>
114                             <h3 class="text-muted" t-field="blog.subtitle"/>
115                         </div>
116                     </div>
117                 </div>
118             </section>
119         </div>
120         <div class="container">
121             <div class="row">
122               <div class="col-md-8 col-md-offset-2" t-ignore="True" id="main_column">
123
124                 <div t-if="not blog_posts" class="container mb64">
125                   <p class="css_editable_hidden">
126                     <h1>No blog post yet.</h1>
127                   </p>
128                   <p groups="base.group_document_user">
129                     Click on "Content" on the top menu to write your first blog post.
130                   </p>
131                 </div>
132
133                 <div t-foreach="blog_posts" t-as="blog_post" class="mb32">
134                   <span t-field="blog_post.author_avatar" t-field-options='{"widget": "image", "class": "img-circle pull-right mt16 media-object"}' />
135                   <a t-attf-href="/blog/#{ slug(blog_post.blog_id) }/post/#{ slug(blog_post) }">
136                       <h2 t-field="blog_post.name" class="mb4"/>
137                   </a>
138
139                   <div class="text-muted">
140                       <h4
141                         t-field="blog_post.subtitle"
142                         class="mb4 mt4"/>
143                     <div name='blog_post_data' class='mb0'>
144                          <span t-field="blog_post.author_id" style="display: inline-block;" t-field-options='{
145                                 "widget": "contact",
146                                 "fields": ["name"]
147                             }'/>
148                         &#5760; <span t-field="blog_post.create_date" t-field-options='{"format": "MMMM yyyy"}'/>
149                         <span t-if="len(blog_post.message_ids) &gt; 0">
150                             &#5760; <t t-esc="len(blog_post.message_ids)"/>
151                             <t t-if="len(blog_post.message_ids) &lt;= 1" >comment</t>
152                             <t t-if="len(blog_post.message_ids) > 1">comments</t>
153                         </span>
154
155                         <span t-if="not blog_post.website_published" class="label label-danger">not published</span>
156                     </div>
157                   </div>
158
159                 </div>
160               </div>
161             </div>
162         </div>
163
164         <div class="oe_structure"/>
165     </t>
166 </template>
167
168 <!-- Option: Blog Post List: show tags -->
169 <template id="opt_blog_post_short_tags" name="Tags"
170         customize_show="True" inherit_id="website_blog.blog_post_short">
171     <xpath expr="//*[@name='blog_post_data']" position="inside">
172         <p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
173             <span class="fa fa-tags"/>
174             <t t-foreach="blog_post.tag_ids" t-as="tag">
175                 <a t-attf-href="#{blog_url(tag=tag)}" t-esc="tag.name"/> &amp;nbsp;
176             </t>
177         </p>
178     </xpath>
179 </template>
180
181 <!-- Blog Post Complete -->
182 <template id="blog_post_complete" name="Blog Post">
183   <t t-call="website_blog.index">
184
185     <div class="cover js_fullheight" id="title" t-attf-style="background-image: url(#{blog_post.background_image})" t-ignore="True">
186         <div class="container">
187           <div class="container text-right mt16">
188             <div class="btn-group css_non_editable_mode_hidden">
189                 <a id="change_cover" class="btn btn-primary">
190                     Change Cover
191                 </a>
192                 <a id="clear_cover" class="btn btn-danger">
193                     <span class="fa fa-times"/>
194                 </a>
195             </div>
196             <div class="cover-storage oe_hidden"></div>
197             <t t-call="website.publish_management">
198                 <t t-set="object" t-value="blog_post"/>
199                 <t t-set="publish_edit" t-value="True"/>
200                 <li>
201                     <form class="duplicate hidden" action="/blogpost/duplicate">
202                         <input name="blog_post_id" t-att-value="blog_post.id"/>
203                     </form>
204                     <a href="#" class="duplicate" onclick="$(this).prev('form').submit()">Duplicate</a>
205                 </li>
206             </t>
207           </div>
208         </div>
209         <div class="blog_title">
210             <h1 t-field="blog_post.name" id="blog_post_name" t-att-data-blog-id="blog_post.id"/>
211             <h2 t-field="blog_post.subtitle"/>
212             <p class="post-meta text-muted text-center" name="blog_post_data"/>
213             <div>
214                 <span t-field="blog_post.author_avatar" t-field-options='{"widget": "image", "class": "img-circle", "style":"width: 30px; margin-right: 10px; display:inline"}' />
215                 <span t-field="blog_post.author_id" style="display: inline-block;" t-field-options='{
216                     "widget": "contact",
217                     "fields": ["name"]
218                 }'/>
219             </div>
220             <div t-if="blog_post.background_image" id="blog_angle_down">
221                 <strong><a href="#blog_content" class="fa fa-angle-down fa-3x fa-inverse mt32"/></strong>
222             </div>
223         </div>
224     </div>
225
226     <div id="blog_content" t-field="blog_post.content" class="mt32"/>
227
228     <section id="comments" class="read_width">
229         <hr/>
230         <ul class="media-list" id="comments-list">
231             <li t-foreach="comments" t-as="message" class="media">
232                 <span class="pull-left">
233                     <img class="media-object img img-circle" t-att-src="website.image_url(message, 'author_avatar')" style="width: 30px"/>
234                 </span>
235                 <div class="media-body">
236                     <t t-call="website.publish_short">
237                         <t t-set="object" t-value="message"/>
238                     </t>
239                     <!-- <strong t-field="message.author_id"/> -->
240                     <span t-field="message.author_id" style="display: inline-block;" t-field-options='{
241                             "widget": "contact",
242                             "fields": ["name"]
243                         }'/>
244                     <span class="text-muted">on <span t-field="message.date"/></span>
245                     <div t-field="message.body" class="discussion_scroll_post"/>
246                 </div>
247             </li>
248         </ul>
249     </section>
250
251     <t t-if="next_post">
252         <div class="cover cover_footer mb0 text-center" t-attf-style="background-image: url(#{next_post.background_image})" t-ignore="True">
253             <div class="blog_title">
254                 <a class="hidden js_next" t-attf-href="/blog/#{ slug(next_post.blog_id) }/post/#{ slug(next_post) }/#wrap"/>
255                 <h1 t-field="next_post.name"/>
256                 <h2 t-field="next_post.subtitle"/>
257                 <div>
258                     <span t-field="next_post.author_avatar" t-field-options='{"widget": "image", "class": "img-circle", "style":"width: 30px; margin-right: 10px; display:inline"}' />
259                     <span t-field="next_post.author_id" style="display: inline-block;" t-field-options='{
260                             "widget": "contact",
261                             "fields": ["name"]
262                         }'/>
263                 </div>
264                 <p class="mt32">Read Next <span class="fa fa-long-arrow-right"/></p>
265             </div>
266         </div>
267     </t>
268
269   </t>
270 </template>
271
272 <!-- Options: Blog Post: breadcrumb -->
273 <template id="blog_breadcrumb" name="Breadcrumb"
274         inherit_id="website_blog.blog_post_complete" active="False" customize_show="True">
275     <xpath expr="//div[@id='title']" position="before">
276         <div class="container">
277           <div class="row">
278             <div class="col-sm-9">
279                 <ol class="breadcrumb">
280                     <li><a t-attf-href="#{blog_url(tag=None, date_begin=None, date_end=None)}"><span t-field="blog.name"/></a></li>
281                     <li t-if="tag"><a t-attf-href="#{blog_url(date_begin=None, date_end=None)}"><span t-field="tag.name"/></a></li>
282                     <li t-if="date"><a t-attf-href="#{blog_url(tag=None)}" t-esc="date"/></li>
283                     <li class="active"><span t-field="blog_post.name"/></li>
284                 </ol>
285             </div><div class="col-sm-3">
286             </div>
287           </div>
288         </div>
289     </xpath>
290 </template>
291
292 <!-- Options: Blog Post: user can reply -->
293 <template id="opt_blog_post_complete_comment" name="Allow blog post comment"
294         inherit_id="website_blog.blog_post_complete" active="False" customize_show="True"
295         groups="website_mail.group_comment">
296     <xpath expr="//ul[@id='comments-list']" position="before">
297         <section class="mb32 read_width css_editable_mode_hidden">
298             <form id="comment" t-attf-action="/blogpost/comment" method="POST">
299                 <div class="media">
300                     <span class="pull-left">
301                         <img class="img img-circle media-object" t-att-src="website.image_url(user_id.partner_id, 'image_small')" style="width: 30px"/>
302                     </span>
303                     <div class="media-body">
304                         <input name="blog_post_id" t-att-value="blog_post.id" type="hidden"/>
305                         <textarea rows="3" name="comment" class="form-control" placeholder="Write a comment..."></textarea>
306                         <button type="submit" class="btn btn-primary mt8">Post</button>
307                     </div>
308                 </div>
309             </form>
310         </section>
311     </xpath>
312 </template>
313
314 <!-- Options: Blog Post: user can select text for tweet -->
315 <template id="opt_blog_post_select_to_tweet" name="Select to Tweet"
316         inherit_id="website_blog.blog_post_complete" active="False" customize_show="True">
317     <xpath expr="//div[@id='blog_content']" position="attributes">
318         <attribute name="class">js_tweet mt32</attribute>
319     </xpath>
320     <xpath expr="//div[@id='title']//div[@class='blog_title']" position="attributes">
321         <attribute name="class">blog_title js_tweet</attribute>
322     </xpath>
323 </template>
324
325 <!-- Options: Blog Post: user can add Inline Discussion -->
326 <template id="opt_blog_post_inline_discussion" name="Allow comment in text"
327         inherit_id="website_blog.blog_post_complete" active="False" customize_show="True">
328     <xpath expr="//div[@id='blog_content']" position="attributes">
329         <attribute name="enable_chatter_discuss">True</attribute>
330     </xpath>
331 </template>
332
333 <!-- Options: Blog Post: show tags -->
334 <template id="opt_blog_post_complete_tags" name="Tags"
335         customize_show="True" inherit_id="website_blog.blog_post_complete">
336     <xpath expr="//p[@name='blog_post_data']" position="after">
337         <p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
338             <span class="fa fa-tags"/>
339             <t t-foreach="blog_post.tag_ids" t-as="tag">
340                 <a t-attf-href="#{blog_url(tag=tag)}" t-esc="tag.name"/> &amp;nbsp;
341             </t>
342         </p>
343     </xpath>
344 </template>
345
346 <!-- Page -->
347 <template id="index" name="Blog Navigation">
348     <t t-call="website.layout">
349         <div id="wrap" class="js_blog website_blog">
350             <t t-raw="0"/>
351         </div>
352     </t>
353 </template>
354
355 <!-- Option:Right Column for extra info -->
356
357 <template id="index_right" name="Right Column"
358         inherit_id="website_blog.blog_post_short" active="False" customize_show="True">
359     <xpath expr="//div[@id='main_column']" position="attributes">
360         <attribute name="class">col-sm-8</attribute>
361     </xpath>
362     <xpath expr="//div[@id='main_column']" position="after">
363         <div class="col-lg-3 col-lg-offset-1 col-sm-4" id="blog_right_column"/>
364     </xpath>
365 </template>
366
367 <!-- Option:Right Column: tags -->
368 <template id="opt_blog_rc_tags" name="Tags"
369         inherit_id="website_blog.index_right" active="False" customize_show="True">
370     <xpath expr="//div[@id='blog_right_column']" position="inside">
371         <section class="mt32">
372         <h4>Tags</h4>
373         <ul class="nav nav-pills nav-stacked">
374             <t t-foreach="tags" t-as="nav_tag">
375             <li t-att-class="tag and tag.id == nav_tag.id and 'active' or None" style="display: inline-block;">
376                 <a t-attf-href="#{blog_url(tag=nav_tag)}"><span t-field="nav_tag.name"/></a>
377             </li>
378             </t>
379         </ul>
380         </section>
381     </xpath>
382 </template>
383
384 <!-- Option:Right Column: archives -->
385 <template id="opt_blog_rc_history" name="Archives"
386         inherit_id="website_blog.index_right" active="False" customize_show="True">
387     <xpath expr="//div[@id='blog_right_column']" position="inside">
388         <section class="mt32">
389         <h4>Archives</h4>
390         <ul class="nav nav-pills nav-stacked">
391             <t t-foreach="nav_list" t-as="months">
392             <li t-att-class="months['date_begin'] == date and 'active' or None">
393                 <a t-ignore="True" t-attf-href="#{blog_url(date_begin=months['date_begin'], date_end=months['date_end'])}"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
394             </li>
395             </t>
396         </ul>
397         </section>
398     </xpath>
399 </template>
400
401 <!-- Option:Right Column: about us -->
402 <template id="opt_blog_rc_about_us" name="About Us" priority="2"
403         inherit_id="website_blog.index_right" active="False" customize_show="True">
404     <xpath expr="//div[@id='blog_right_column']" position="inside">
405         <section class="mt32">
406         <h4>About us</h4>
407         <p>
408             Write a small text here for when <b>new visitors</b> find your website
409             through your <b>blog entries</b>, referenced in Google.
410         </p>
411         <div>
412             <a href="/page/website.contactus"><button class="btn btn-primary">Contact us</button></a>
413         </div>
414         </section>
415     </xpath>
416 </template>
417
418 <!-- Option:Right Column: follow us -->
419 <template id="opt_blog_rc_follow_us" name="Follow us" priority="4"
420         inherit_id="website_blog.index_right" active="False" customize_show="True">
421     <xpath expr="//div[@id='blog_right_column']" position="inside">
422         <section class="mt32">
423             <h4>Follow us<small t-if="blog">: <t t-esc="blog.name"/></small></h4>
424             <t t-if="blog">
425                 <t t-call="website_mail.follow">
426                     <t t-set="email" t-value="user_id.email"/>
427                     <t t-set="object" t-value="blog"/>
428                 </t>
429             </t>
430             <p class="text-muted mb0 mt16">
431                 Participate on our social stream.
432             </p>
433             <h2 class="mt4">
434                 <a t-att-href="website.social_facebook" t-if="website.social_facebook"><i class="fa fa-facebook-square"/></a>
435                 <a t-att-href="website.social_twitter" t-if="website.social_twitter"><i class="fa fa-twitter"/></a>
436                 <a t-att-href="website.social_linkedin" t-if="website.social_linkedin"><i class="fa fa-linkedin"/></a>
437                 <a t-att-href="website.social_youtube" t-if="website.social_youtube"><i class="fa fa-youtube-play"/></a>
438                 <a t-att-href="website.social_googleplus" t-if="website.social_googleplus"><i class="fa fa-google-plus-square"/></a>
439                 <a t-att-href="website.social_github" t-if="website.social_github"><i class="fa fa-github"/></a>
440             </h2>
441         </section>
442     </xpath>
443 </template>
444
445 <!-- Option:Right Column: blogs -->
446 <template id="opt_blog_rc_blogs" name="Our Blogs" priority="6"
447         inherit_id="website_blog.index_right" active="False" customize_show="True">
448     <xpath expr="//div[@id='blog_right_column']" position="inside">
449         <section class="mt32 mb32">
450         <h4>Our Blogs</h4>
451         <ul class="nav nav-pills nav-stacked">
452             <t t-foreach="blogs" t-as="nav_blog">
453                 <li t-att-class="nav_blog.id == blog.id and 'active' or ''">
454                     <a t-attf-href="#{blog_url(blog=nav_blog)}">
455                         <span t-field="nav_blog.name"/>
456                     </a>
457                 </li>
458             </t>
459         </ul>
460         </section>
461     </xpath>
462 </template>
463
464 <!-- User Navbar -->
465 <template id="content_new_blogpost" inherit_id="website.user_navbar" groups="base.group_document_user">
466     <xpath expr="//ul[@id='oe_systray']/li/ul[@class='dropdown-menu oe_content_menu']" position="inside">
467          <li><a href="#" data-action="new_blog_post">New Blog Post</a></li>
468     </xpath>
469 </template>
470 </data>
471 </openerp>