odoo/addons/website_blog/views/website_blog_templates.xml

335 lines
16 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="website_blog_script" inherit_id="website.layout" name="Website Blog script">
<xpath expr="//t[@id='editable_scripts_hook']" position="inside">
<script type="text/javascript" src="/website_blog/static/src/js/website_blog.editor.js" t-ignore="true"></script>
</xpath>
</template>
<!-- Layout add nav and footer -->
<template id="header_footer_custom" inherit_id="website.layout" name="Footer News Blog Link">
<xpath expr="//footer//div[@name='info']/ul" position="inside">
<li><a t-href="/blog/cat/%(website_blog.blog_category_1)d/">News</a></li>
</xpath>
</template>
<!-- Blog Post Summary -->
<template id="blog_post_short" name="Blog Post Summary">
<div>
<div class="pull-right">
<t t-call="website.publish_management">
<t t-set="object" t-value="blog_post"/>
<t t-set="publish_edit" t-value="True"/>
<li>
<a href="#" t-attf-data-href="/blog/#{blog_post.id}/duplicate">Duplicate</a>
<script>
var $a=$("[data-href$='/duplicate']");
$a.attr("href", $a.data('href')).removeAttr('data-href');
$a.next("script").remove();
</script>
</li>
</t>
</div>
<h2 class="text-center">
<a t-href="/blog/#{blog_post.id}" t-field="blog_post.name"></a>
</h2>
<p class="post-meta text-muted text-center" name='blog_post_data'>
<span class="icon-calendar"> <span t-field="blog_post.create_date"/></span> &amp;nbsp;
<span class="icon-user"> By <span t-field="blog_post.create_uid"/> &amp;nbsp;</span>
<span t-if="len(blog_post.message_ids) &gt; 0" class="icon-comment">
<a t-href="/blog/#{blog_post.id}/#comment">
<t t-if="len(blog_post.message_ids) &lt;= 1" ><t t-esc="len(blog_post.message_ids)"/> comment</t>
<t t-if="len(blog_post.message_ids) > 1"><t t-esc="len(blog_post.message_ids)"/> comments</t>
</a>
</span>
</p>
<div t-field="blog_post.shortened_content" class="blog_content"/>
<hr/>
</div>
</template>
<!-- Options: Blog Post Summary: hide author -->
<template id="opt_blog_post_short_author" name="Hide Authors"
inherit_option_id="website_blog.blog_post_short">
<xpath expr="//span[@class='icon-user']" position="attributes">
<attribute name="class">hidden</attribute>
</xpath>
</template>
<!-- Options: Blog Post Summary: show category -->
<template id="opt_blog_post_short_category" name="Blog Name"
inherit_option_id="website_blog.blog_post_short">
<xpath expr="//span[@class='icon-user']" position="after">
<span class="icon-folder-open"> In <span t-field="blog_post.category_id"/> &amp;nbsp;</span>
</xpath>
</template>
<!-- Option: Blog Post Summary: show tags -->
<template id="opt_blog_post_short_tags" name="Tags"
inherit_option_id="website_blog.blog_post_short" inherit_id="website_blog.blog_post_short">
<xpath expr="//p[@name='blog_post_data']" position="after">
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
<span class="icon-tags"/>
<t t-foreach="blog_post.tag_ids" t-as="tag">
<a t-href="/blog/tag/#{tag.id}" t-esc="tag.name"/> &amp;nbsp;
</t>
</p>
</xpath>
</template>
<!-- Blog Post Complete -->
<template id="blog_post_complete" name="Blog Post">
<div>
<t t-call="website.publish_management">
<t t-set="object" t-value="blog_post"/>
<t t-set="publish_edit" t-value="True"/>
<li>
<a href="#" t-attf-data-href="/blog/#{blog_post.id}/duplicate">Duplicate</a>
<script>
var $a=$("[data-href$='/duplicate']");
$a.attr("href", $a.data('href')).removeAttr('data-href');
$a.next("script").remove();
</script>
</li>
</t>
</div>
<div class="clearfix"/>
<h1 class="text-center" t-field="blog_post.name"/>
<p class="post-meta text-muted text-center" name="blog_post_data">
<span class="icon-calendar"> <span t-field="blog_post.create_date"/></span> &amp;nbsp;
<span class="icon-user"> By <span t-field="blog_post.create_uid"/> &amp;nbsp;</span>
<span t-if="len(blog_post.message_ids) &gt; 0" class="icon-comment"> With
<a t-attf-href="#comments">
<t t-if="len(blog_post.message_ids) &lt;= 1" ><t t-esc="len(blog_post.message_ids)"/> comment</t>
<t t-if="len(blog_post.message_ids) > 1"><t t-esc="len(blog_post.message_ids)"/> comments</t>
</a>
</span>
</p>
<div t-field="blog_post.content" class="mt16"/>
<hr class="mb32"/>
<a id="comments"/>
<h4 t-if="len(blog_post.website_message_ids)" class="mb16">
<t t-if="len(blog_post.website_message_ids) &lt;= 1">
1 Comment
</t>
<t t-if="len(blog_post.website_message_ids) > 1">
<t t-esc="len(blog_post.website_message_ids)"/> Comments
</t>
</h4>
<ul class="media-list">
<li t-foreach="blog_post.website_message_ids" t-as="message" class="media">
<div class="media-body">
<img class="media-object pull-left" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(message.author_id.id)" style="width: 50px; margin-right: 10px;"/>
<div class="media-body">
<t t-call="website.publish_short">
<t t-set="object" t-value="message"/>
</t>
<h5 class="media-heading">
<span t-field="message.author_id"/> <small>on <span t-field="message.date"/></small>
</h5>
<div t-field="message.body"/>
</div>
</div>
</li>
</ul>
</template>
<!-- Options: Blog Post: user can reply -->
<template id="opt_blog_post_complete_comment" name="Comment Form"
inherit_option_id="website_blog.blog_post_complete" inherit_id="website_blog.blog_post_complete">
<xpath expr="//ul[last()]" position="after">
<t t-if="not is_public_user">
<section groups="group_website_blog_reply" class="mb32">
<h4>Leave a Comment</h4>
<form id="comment" t-attf-action="/blog/#{blog_post.id}/comment"
method="POST">
<img class="img pull-left img-rounded" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(user_id.partner_id.id)" style="width: 50px; margin-right: 10px;"/>
<div class="pull-left mb32" style="width: 75%%">
<textarea rows="3" name="comment" class="form-control" placeholder="Write a comment..."></textarea>
<button type="submit" class="btn btn-danger mt8">Post</button>
</div>
</form>
</section>
</t>
</xpath>
</template>
<!-- Options: Blog Post: hide author -->
<template id="opt_blog_post_complete_author" name="Hide Authors"
inherit_option_id="website_blog.blog_post_complete">
<xpath expr="//span[@class='icon-user']" position="attributes">
<attribute name="class">hidden</attribute>
</xpath>
</template>
<!-- Options: Blog Post: show category -->
<template id="opt_blog_post_complete_category" name="Blog Name"
inherit_option_id="website_blog.blog_post_complete">
<xpath expr="//span[@class='icon-user']" position="after">
<span class="icon-folder-open"> In <span t-field="blog_post.category_id"/> &amp;nbsp;</span>
</xpath>
</template>
<!-- Options: Blog Post: show tags -->
<template id="opt_blog_post_complete_tags" name="Tags"
inherit_option_id="website_blog.blog_post_complete" inherit_id="website_blog.blog_post_complete">
<xpath expr="//p[@name='blog_post_data']" position="after">
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
<span class="icon-tags"/>
<t t-foreach="blog_post.tag_ids" t-as="tag">
<a t-href="/blog/tag/#{tag.id}" t-esc="tag.name"/> &amp;nbsp;
</t>
</p>
</xpath>
</template>
<!-- Page -->
<template id="index" name="Blog">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/website_blog/static/src/js/website_blog.js"></script>
<link rel='stylesheet' href='/website_blog/static/src/css/website_blog.css'/>
</t>
<div id="wrap">
<div class="container mt16 js_website_blog">
<div class="row">
<div class="col-lg-12 col-sm-12" t-if="not blog_post" id="blog_post">
<t t-if="category and editable">
<div class="row hidden-xs">
<a t-href="/blog/#{category.id}/new" class="btn btn-primary pull-right">New Blog Post</a>
</div>
</t>
<t t-foreach="blog_posts" t-as="blog_post" data-publish="">
<t t-call="website_blog.blog_post_short"/>
</t>
<div class="pull-right" t-call="website.pager"/>
</div>
<div class="col-lg-12 col-sm-12" t-if="blog_post" id="blog_posts_summary">
<t t-call="website_blog.blog_post_complete">
<t t-set="blog_post" t-value="blog_post"/>
</t>
</div>
</div>
</div>
</div>
</t>
</template>
<!-- Option: Blog: Right Column -->
<template id="blog_right_column" name="Right Column"
inherit_option_id="website_blog.index" inherit_id="website_blog.index">
<xpath expr="//div[@class='row']" position="inside">
<div class="col-lg-3 col-sm-3 hidden-xs col-lg-offset-1 mb32" id="right_column">
</div>
</xpath>
<xpath expr="//div[@id='blog_post']" position="attributes">
<attribute name="class">col-lg-8 col-sm-8</attribute>
</xpath>
<xpath expr="//div[@id='blog_posts_summary']" position="attributes">
<attribute name="class">col-lg-8 col-sm-8</attribute>
</xpath>
</template>
<!-- Option: Right Column: archives -->
<template id="opt_blog_rc_history" name="Archives"
inherit_option_id="website_blog.blog_right_column" inherit_id="website_blog.blog_right_column">
<xpath expr="//div[@id='right_column']" position="inside">
<section>
<h4>Archives</h4>
<ul class="nav nav-pills nav-stacked">
<li t-foreach="nav_list" t-as="year" class="js_nav_year">
<t t-set="year" t-value="nav_list[year]"/>
<a href="#"><t t-esc="year['name']"/> <small>(<t t-esc="year['create_date_count']"/>)</small></a>
<ul class="nav list-group css_nav_month nav-stacked nav-hierarchy">
<t t-foreach="year['months']">
<li class="js_nav_month"><a href="#" t-att-data-domain="__domain"><t t-esc="create_date"/> <small>(<t t-esc="create_date_count"/>)</small></a>
<ul class="nav list-group nav-stacked nav-hierarchy"/>
</li>
</t>
</ul>
</li>
</ul>
</section>
</xpath>
</template>
<!-- Option: Right Column: about us -->
<template id="opt_blog_rc_about_us" name="About Us" priority="4"
inherit_option_id="website_blog.blog_right_column" inherit_id="website_blog.blog_right_column">
<xpath expr="//div[@id='right_column']" position="inside">
<section class="mb16">
<h4>About us</h4>
<p>
Write here a small text for <b>new visitors</b> finding your website
through your <b>blog entries</b>, referenced in Google.
</p>
<div>
<a href="/page/website.contactus"><button class="btn btn-primary">Contact us</button></a>
</div>
</section>
</xpath>
</template>
<!-- Option: Right Column: follow us -->
<template id="opt_blog_rc_follow_us" name="Follow us" priority="2"
inherit_option_id="website_blog.blog_right_column" inherit_id="website_blog.blog_right_column">
<xpath expr="//div[@id='right_column']" position="inside">
<section class="mb16">
<h4>Follow us</h4>
<t t-if="category">
<p class="text-muted">
Be notified of new blog posts in <t t-esc="category.name"/>
</p>
<t t-call="website_mail.follow">
<t t-set="email" t-value="user_id.email"/>
<t t-set="object" t-value="category"/>
</t>
</t>
<p class="text-muted">
Participate on our social stream.
</p>
<h2>
<a t-att-href="website.social_facebook" t-if="website.social_facebook"><i class="icon-facebook-sign"/></a>
<a t-att-href="website.social_twitter" t-if="website.social_twitter"><i class="icon-twitter-sign"/></a>
<a t-att-href="website.social_linkedin" t-if="website.social_linkedin"><i class="icon-linkedin-sign"/></a>
<a t-att-href="website.social_youtube" t-if="website.social_youtube"><i class="icon-youtube-sign"/></a>
<a t-att-href="website.social_googleplus" t-if="website.social_googleplus"><i class="icon-google-plus-sign"/></a>
<a t-att-href="website.social_github" t-if="website.social_github"><i class="icon-github-sign"/></a>
</h2>
</section>
</xpath>
</template>
<!-- Option: Right Column: categories -->
<template id="opt_blog_rc_categories" name="Other Blogs" priority="6"
inherit_option_id="website_blog.blog_right_column">
<xpath expr="//div[@id='right_column']" position="inside">
<section class="mb16">
<h4>Other Blogs</h4>
<ul class="nav nav-pills nav-stacked">
<t t-foreach="categories" t-as="nav_category">
<li>
<a t-href="/blog/#{nav_category.id}">
<span t-field="nav_category.name"/>
</a>
</li>
</t>
</ul>
</section>
</xpath>
</template>
<template id="blog_archive_link">
<li>
<a t-href="/blog/#{blog_post.id}"><t t-esc="blog_post.name"/></a>
</li>
</template>
</data>
</openerp>