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