[MERGE] forward port of branch 8.0 up to ed1c173
[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_document_user" -->
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
135                   <img class="img-circle pull-right mt16"
136                     t-attf-src="/website/image/res.partner/{{ blog_post.author_id.id }}/image_small"
137                     style="width: 50px;"/>
138
139                   <a t-attf-href="/blog/#{ slug(blog_post.blog_id) }/post/#{ slug(blog_post) }">
140                       <h2 t-field="blog_post.name" class="mb4"/>
141                   </a>
142
143                   <div class="text-muted">
144                       <h4
145                         t-field="blog_post.subtitle"
146                         class="mb4 mt4"/>
147                     <div name='blog_post_data' class='mb0'>
148                          <span t-field="blog_post.author_id" style="display: inline-block;" t-field-options='{
149                                 "widget": "contact",
150                                 "fields": ["name"]
151                             }'/>
152                         &#5760; <span t-field="blog_post.create_date" t-field-options='{"format": "MMMM yyyy"}'/>
153                         <span t-if="len(blog_post.message_ids) &gt; 0">
154                             &#5760; <t t-esc="len(blog_post.message_ids)"/>
155                             <t t-if="len(blog_post.message_ids) &lt;= 1" >comment</t>
156                             <t t-if="len(blog_post.message_ids) > 1">comments</t>
157                         </span>
158
159                         <span t-if="not blog_post.website_published" class="label label-danger">not published</span>
160                     </div>
161                   </div>
162
163                 </div>
164               </div>
165             </div>
166         </div>
167
168         <div class="oe_structure"/>
169     </t>
170 </template>
171
172 <!-- Option: Blog Post List: show tags -->
173 <template id="opt_blog_post_short_tags" name="Tags"
174         customize_show="True" inherit_id="website_blog.blog_post_short">
175     <xpath expr="//div[@name='blog_post_data']" position="inside">
176         <p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
177             <span class="fa fa-tags"/>
178             <t t-foreach="blog_post.tag_ids" t-as="tag">
179                 <a t-attf-href="#{blog_url(tag=tag)}" t-esc="tag.name"/> &amp;nbsp;
180             </t>
181         </p>
182     </xpath>
183 </template>
184
185 <!-- Blog Post Complete -->
186 <template id="blog_post_complete" name="Blog Post">
187   <t t-call="website_blog.index">
188
189     <div class="cover js_fullheight" id="title" t-attf-style="background-image: url(#{blog_post.background_image})" t-ignore="True">
190         <div class="container">
191           <div class="container text-right mt16">
192             <div class="btn-group css_non_editable_mode_hidden">
193                 <a id="change_cover" class="btn btn-primary">
194                     Change Cover
195                 </a>
196                 <a id="clear_cover" class="btn btn-danger">
197                     <span class="fa fa-times"/>
198                 </a>
199             </div>
200             <div class="cover-storage oe_hidden"></div>
201             <t t-call="website.publish_management">
202                 <t t-set="object" t-value="blog_post"/>
203                 <t t-set="publish_edit" t-value="True"/>
204                 <li>
205                     <form class="duplicate hidden" action="/blogpost/duplicate">
206                         <input name="blog_post_id" t-att-value="blog_post.id"/>
207                     </form>
208                     <a href="#" class="duplicate" onclick="$(this).prev('form').submit()">Duplicate</a>
209                 </li>
210             </t>
211           </div>
212         </div>
213         <div class="blog_title">
214             <h1 t-field="blog_post.name" id="blog_post_name" t-att-data-blog-id="blog_post.id"/>
215             <h2 t-field="blog_post.subtitle"/>
216             <p class="post-meta text-muted text-center" name="blog_post_data"/>
217             <div>
218                 <img class="img-circle" t-attf-src="/website/image/res.partner/{{ blog_post.author_id.id }}/image_small" style="width: 30px; margin-right: 10px;"/>
219                 <span t-field="blog_post.author_id" style="display: inline-block;" t-field-options='{
220                     "widget": "contact",
221                     "fields": ["name"]
222                 }'/>
223             </div>
224             <div t-if="blog_post.background_image" id="blog_angle_down">
225                 <strong><a href="#blog_content" class="fa fa-angle-down fa-3x fa-inverse mt32"/></strong>
226             </div>
227         </div>
228     </div>
229
230     <div id="blog_content" t-field="blog_post.content" class="mt32"/>
231
232     <section id="comments" class="read_width">
233         <hr/>
234         <ul class="media-list" id="comments-list">
235             <li t-foreach="comments" t-as="message" class="media">
236                 <span class="pull-left">
237                     <img class="media-object img img-circle" t-attf-src="/website/image/mail.message/{{ message.id }}/author_avatar" style="width: 30px"/>
238                 </span>
239                 <div class="media-body">
240                     <t t-call="website.publish_short">
241                         <t t-set="object" t-value="message"/>
242                     </t>
243                     <!-- <strong t-field="message.author_id"/> -->
244                     <span t-field="message.author_id" style="display: inline-block;" t-field-options='{
245                             "widget": "contact",
246                             "fields": ["name"]
247                         }'/>
248                     <span class="text-muted">on <span t-field="message.date"/></span>
249                     <div t-field="message.body" class="discussion_scroll_post"/>
250                 </div>
251             </li>
252         </ul>
253     </section>
254
255     <t t-if="next_post">
256         <div class="cover cover_footer mb0 text-center" t-attf-style="background-image: url(#{next_post.background_image})" t-ignore="True">
257             <div class="blog_title">
258                 <a class="hidden js_next" t-attf-href="/blog/#{ slug(next_post.blog_id) }/post/#{ slug(next_post) }/#wrap"/>
259                 <h1 t-field="next_post.name"/>
260                 <h2 t-field="next_post.subtitle"/>
261                 <div>
262                     <img class="img-circle" t-attf-src="'/website/image/res.partner/{{ next_post.author_id.id }}/image_small" style="width: 30px; margin-right: 10px;"/>
263                     <span t-field="next_post.author_id" style="display: inline-block;" t-field-options='{
264                             "widget": "contact",
265                             "fields": ["name"]
266                         }'/>
267                 </div>
268                 <p class="mt32">Read Next <span class="fa fa-long-arrow-right"/></p>
269             </div>
270         </div>
271     </t>
272
273   </t>
274 </template>
275
276 <!-- Options: Blog Post: breadcrumb -->
277 <template id="blog_breadcrumb" name="Breadcrumb"
278         inherit_id="website_blog.blog_post_complete" active="False" customize_show="True">
279     <xpath expr="//div[@id='title']" position="before">
280         <div class="container">
281           <div class="row">
282             <div class="col-sm-9">
283                 <ol class="breadcrumb">
284                     <li><a t-attf-href="#{blog_url(tag=None, date_begin=None, date_end=None)}"><span t-field="blog.name"/></a></li>
285                     <li t-if="tag"><a t-attf-href="#{blog_url(date_begin=None, date_end=None)}"><span t-field="tag.name"/></a></li>
286                     <li t-if="date"><a t-attf-href="#{blog_url(tag=None)}" t-esc="date"/></li>
287                     <li class="active"><span t-field="blog_post.name"/></li>
288                 </ol>
289             </div><div class="col-sm-3">
290             </div>
291           </div>
292         </div>
293     </xpath>
294 </template>
295
296 <!-- Options: Blog Post: user can reply -->
297 <template id="opt_blog_post_complete_comment" name="Allow blog post comment"
298         inherit_id="website_blog.blog_post_complete" active="False" customize_show="True"
299         groups="website_mail.group_comment">
300     <xpath expr="//ul[@id='comments-list']" position="before">
301         <section class="mb32 read_width css_editable_mode_hidden">
302             <form id="comment" t-attf-action="/blogpost/comment" method="POST">
303                 <div class="media">
304                     <span class="pull-left">
305                         <img class="img img-circle media-object" t-attf-src="/website/image/res.partner/{{ user_id.partner_id.id }}/image_small" style="width: 30px"/>
306                     </span>
307                     <div class="media-body">
308                         <input name="blog_post_id" t-att-value="blog_post.id" type="hidden"/>
309                         <textarea rows="3" name="comment" class="form-control" placeholder="Write a comment..."></textarea>
310                         <button type="submit" class="btn btn-primary mt8">Post</button>
311                     </div>
312                 </div>
313             </form>
314         </section>
315     </xpath>
316 </template>
317
318 <!-- Options: Blog Post: user can select text for tweet -->
319 <template id="opt_blog_post_select_to_tweet" name="Select to Tweet"
320         inherit_id="website_blog.blog_post_complete" active="False" customize_show="True">
321     <xpath expr="//div[@id='blog_content']" position="attributes">
322         <attribute name="class">js_tweet mt32</attribute>
323     </xpath>
324     <xpath expr="//div[@id='title']//div[@class='blog_title']" position="attributes">
325         <attribute name="class">blog_title js_tweet</attribute>
326     </xpath>
327 </template>
328
329 <!-- Options: Blog Post: user can add Inline Discussion -->
330 <template id="opt_blog_post_inline_discussion" name="Allow comment in text"
331         inherit_id="website_blog.blog_post_complete" active="False" customize_show="True">
332     <xpath expr="//div[@id='blog_content']" position="attributes">
333         <attribute name="enable_chatter_discuss">True</attribute>
334     </xpath>
335 </template>
336
337 <!-- Options: Blog Post: show tags -->
338 <template id="opt_blog_post_complete_tags" name="Tags"
339         customize_show="True" inherit_id="website_blog.blog_post_complete">
340     <xpath expr="//p[@name='blog_post_data']" position="after">
341         <p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
342             <span class="fa fa-tags"/>
343             <t t-foreach="blog_post.tag_ids" t-as="tag">
344                 <a t-attf-href="#{blog_url(tag=tag)}" t-esc="tag.name"/> &amp;nbsp;
345             </t>
346         </p>
347     </xpath>
348 </template>
349
350 <!-- Page -->
351 <template id="index" name="Blog Navigation">
352     <t t-call="website.layout">
353         <div id="wrap" class="js_blog website_blog">
354             <t t-raw="0"/>
355         </div>
356     </t>
357 </template>
358
359 <!-- Option:Right Column for extra info -->
360
361 <template id="index_right" name="Right Column"
362         inherit_id="website_blog.blog_post_short" active="False" customize_show="True">
363     <xpath expr="//div[@id='main_column']" position="attributes">
364         <attribute name="class">col-sm-8</attribute>
365     </xpath>
366     <xpath expr="//div[@id='main_column']" position="after">
367         <div class="col-lg-3 col-lg-offset-1 col-sm-4" id="blog_right_column"/>
368     </xpath>
369 </template>
370
371 <!-- Option:Right Column: tags -->
372 <template id="opt_blog_rc_tags" name="Tags"
373         inherit_id="website_blog.index_right" active="False" customize_show="True">
374     <xpath expr="//div[@id='blog_right_column']" position="inside">
375         <section class="mt32">
376         <h4>Tags</h4>
377         <ul class="nav nav-pills nav-stacked">
378             <t t-foreach="tags" t-as="nav_tag">
379             <li t-att-class="tag and tag.id == nav_tag.id and 'active' or None" style="display: inline-block;">
380                 <a t-attf-href="#{blog_url(tag=nav_tag)}"><span t-field="nav_tag.name"/></a>
381             </li>
382             </t>
383         </ul>
384         </section>
385     </xpath>
386 </template>
387
388 <!-- Option:Right Column: archives -->
389 <template id="opt_blog_rc_history" name="Archives"
390         inherit_id="website_blog.index_right" active="False" customize_show="True">
391     <xpath expr="//div[@id='blog_right_column']" position="inside">
392         <section class="mt32">
393         <h4>Archives</h4>
394         <ul class="nav nav-pills nav-stacked">
395             <t t-foreach="nav_list" t-as="months">
396             <li t-att-class="months['date_begin'] == date and 'active' or None">
397                 <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>
398             </li>
399             </t>
400         </ul>
401         </section>
402     </xpath>
403 </template>
404
405 <!-- Option:Right Column: about us -->
406 <template id="opt_blog_rc_about_us" name="About Us" priority="2"
407         inherit_id="website_blog.index_right" active="False" customize_show="True">
408     <xpath expr="//div[@id='blog_right_column']" position="inside">
409         <section class="mt32">
410         <h4>About us</h4>
411         <p>
412             Write a small text here for when <b>new visitors</b> find your website
413             through your <b>blog entries</b>, referenced in Google.
414         </p>
415         <div>
416             <a href="/page/website.contactus"><button class="btn btn-primary">Contact us</button></a>
417         </div>
418         </section>
419     </xpath>
420 </template>
421
422 <!-- Option:Right Column: follow us -->
423 <template id="opt_blog_rc_follow_us" name="Follow us" priority="4"
424         inherit_id="website_blog.index_right" active="False" customize_show="True">
425     <xpath expr="//div[@id='blog_right_column']" position="inside">
426         <section class="mt32">
427             <h4>Follow us<small t-if="blog">: <t t-esc="blog.name"/></small></h4>
428             <t t-if="blog">
429                 <t t-call="website_mail.follow">
430                     <t t-set="email" t-value="user_id.email"/>
431                     <t t-set="object" t-value="blog"/>
432                 </t>
433             </t>
434             <p class="text-muted mb0 mt16">
435                 Participate on our social stream.
436             </p>
437             <h2 class="mt4">
438                 <a t-att-href="website.social_facebook" t-if="website.social_facebook"><i class="fa fa-facebook-square"/></a>
439                 <a t-att-href="website.social_twitter" t-if="website.social_twitter"><i class="fa fa-twitter"/></a>
440                 <a t-att-href="website.social_linkedin" t-if="website.social_linkedin"><i class="fa fa-linkedin"/></a>
441                 <a t-att-href="website.social_youtube" t-if="website.social_youtube"><i class="fa fa-youtube-play"/></a>
442                 <a t-att-href="website.social_googleplus" t-if="website.social_googleplus"><i class="fa fa-google-plus-square"/></a>
443                 <a t-att-href="website.social_github" t-if="website.social_github"><i class="fa fa-github"/></a>
444             </h2>
445         </section>
446     </xpath>
447 </template>
448
449 <!-- Option:Right Column: blogs -->
450 <template id="opt_blog_rc_blogs" name="Our Blogs" priority="6"
451         inherit_id="website_blog.index_right" active="False" customize_show="True">
452     <xpath expr="//div[@id='blog_right_column']" position="inside">
453         <section class="mt32 mb32">
454         <h4>Our Blogs</h4>
455         <ul class="nav nav-pills nav-stacked">
456             <t t-foreach="blogs" t-as="nav_blog">
457                 <li t-att-class="nav_blog.id == blog.id and 'active' or ''">
458                     <a t-attf-href="#{blog_url(blog=nav_blog)}">
459                         <span t-field="nav_blog.name"/>
460                     </a>
461                 </li>
462             </t>
463         </ul>
464         </section>
465     </xpath>
466 </template>
467
468 <!-- User Navbar -->
469 <template id="content_new_blogpost" inherit_id="website.user_navbar" groups="base.group_document_user">
470     <xpath expr="//ul[@id='oe_systray']/li/ul[@class='dropdown-menu oe_content_menu']" position="inside">
471          <li><a href="#" data-action="new_blog_post">New Blog Post</a></li>
472     </xpath>
473 </template>
474 </data>
475 </openerp>