odoo/addons/website_forum/views/website_forum.xml

652 lines
32 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="editor_head" inherit_id="website.editor_head"
name="Event Editor">
<xpath expr="//script[@id='website_tour_js']" position="after">
<script type="text/javascript"
src="/website_forum/static/src/js/website.tour.forum.js"></script>
<!--
FP Note: Why do we need this ? Can we remove this code?
The problem is that you add your script for every page, not only for the forum
-->
<script type="text/javascript"
src="/website_forum/static/src/js/website_forum.editor.js"></script>
<script type="text/javascript">
CKEDITOR.config.toolbar = [['Bold','Italic','Underline','Strike'],['NumberedList','BulletedList']
,['Outdent','Indent','Link','Unlink'],] ;
</script>
</xpath>
</template>
<!-- Layout add nav and footer -->
<template id="header_footer_custom" inherit_id="website.layout"
name="Footer Questions Link">
<xpath expr="//footer//ul[@name='products']" position="inside">
<li>
<a t-attf-href="/forum/%(website_forum.forum_help)d/">Q&amp;A</a>
</li>
</xpath>
</template>
<!-- List of Questions -->
<template id="post_list">
<div class="question clearfix">
<div class="pull-left text-center">
<div t-attf-class="box #{len(question.child_ids) and 'oe_green' or 'oe_grey'}">
<span t-esc="len(question.child_ids)"/>
<div t-if="len(question.child_ids)&gt;1">Answers</div>
<div t-if="len(question.child_ids)&lt;=1">Answer</div>
</div>
<div class="text-muted text-center">
<span t-field="question.views"/> Views
</div>
</div>
<div style="margin-left: 95px;">
<div class="question-name">
<a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }" t-field="question.name"/>
</div>
<div class="text-muted">
by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.create_uid.id }" t-field="question.create_uid"/>,
on <span t-field="question.write_date"/>
<div t-if="len(question.vote_ids)">
<strong>with <span t-esc="len(question.vote_ids)"/> votes</strong>
</div>
</div>
<t t-foreach="question.tags" t-as="tag">
<a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }" class="badge" t-field="tag.name"/>
</t>
</div>
</div>
</template>
<!-- Page Index -->
<template id="header" name="Forum Index">
<t t-call="website.layout">
<t t-set="head">
<link rel='stylesheet' href='/website_forum/static/src/css/website_forum.css' />
</t>
<div class="container mt16">
<div class="navbar navbar-default">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#oe-help-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/forum">Help</a>
<!-- FP Note: Replace by this when controllers have changed
<a class="navbar-brand" t-attf-href="/forum/#{slug(forum)}">
<span t-field="forum.name"/>
</a>
-->
</div>
<div class="collapse navbar-collapse" id="oe-help-navbar-collapse">
<ul class="nav navbar-nav">
<li t-att-class="searches.get('type') in ('all', 'unanswered','followed') and 'active' or '' ">
<a t-attf-href="/forum/#{ slug(forum) }">Questions</a>
</li>
<li t-att-class="searches.get('users') and 'active' or '' ">
<a t-attf-href="/forum/#{ slug(forum) }/users">People</a>
</li>
<li t-att-class="searches.get('tags') and 'active' or '' ">
<a t-attf-href="/forum/#{ slug(forum) }/tags">Tags</a>
</li>
<li t-att-class="searches.get('badges') and 'active' or '' ">
<a t-attf-href="/forum/#{ slug(forum) }/badges">Badges</a>
</li>
</ul>
<form class="navbar-form navbar-right" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
<div class="form-group">
<input type="search" class="form-control"
name="search" placeholder="Search a question..."
t-att-value="searches.get('search') or ''" />
<button type="submit" class="btn btn-default">Search</button>
</div>
</form>
</div>
</div>
</div>
<div id="wrap" class="container">
<div class="row">
<div class="col-sm-9">
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
<strong>Congratulation!</strong> You received the <em>New Author</em> badge!<br/>
<a t-attf-href="/forum/#{ slug(forum) }/badge" class="fa fa-arrow-right">View Your Badges</a>
</div>
<t t-raw="0"/>
</div><div class="col-sm-3" id="right-column">
<a class="btn btn-primary btn-lg btn-block mb16" t-attf-href="/forum/#{ slug(forum) }/ask">Ask a Question</a>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">About This Forum</h3>
</div>
<div class="panel-body">
This community is for professional and enthusiast about our
products and services.<br/>
<a t-attf-href="/forum/#{ slug(forum) }/faq" class="fa fa-arrow-right"> Read Guidelines</a>
</div>
</div>
</div>
</div>
</div>
</t>
</template>
<template id="faq">
<t t-call="website_forum.header">
<!--TODO: Improve template -->
<div>
<h1>F.A.Q</h1>
</div>
</t>
</template>
<template id="forum_index">
<t t-call="website.layout">
<!--TODO: Improve template -->
<t t-foreach="forum_ids" t-as="forum">
<a t-attf-href="/forum/#{ slug(forum) }" class="box oe_green" t-field="forum.name"/>
</t>
<!--t t-call="website_forum.faq">
<div t-field="forum.faq"/>
</t-->
</t>
</template>
<template id="forum">
<t t-call="website.layout">
<!--TODO: Improve template -->
<div class="row">
<h1 class="text-center" t-attf-href="/forum/#{ slug(forum) }" t-field="forum.name"/>
</div>
<div class="row">
<h1 class="text-center" t-attf-href="/forum/#{ slug(forum) }/faq" t-field="forum.faq"/>
</div>
</t>
</template>
<template id="index">
<t t-call="website_forum.header">
<h1 class="page-header mt0">
<t t-esc="total_questions"/>
<span>Questions</span>
<small class="dropdown" t-if="searches.get('type') in ('all', 'unanswered','followed')">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<t t-if="searches.get('type') == 'all'">No filter</t>
<t t-if="searches.get('type') == 'unanswered'">Filter: Unanswered</t>
<t t-if="searches.get('type') == 'followed'">Filter: Followed</t>
<b class="caret"/>
</a>
<ul class="dropdown-menu">
<li class="dropdown-header">Filter on</li>
<li t-att-class="searches.get('type') == 'all' and 'active' or '' ">
<a t-attf-href="/forum/#{ slug(forum) }/?{{ keep_query( type='all') }}">All</a>
</li>
<li t-att-class="searches.get('type') == 'unanswered' and 'active' or '' ">
<a t-attf-href="/forum/#{ slug(forum) }/?{{ keep_query( type='unanswered') }}">Unanswered</a>
</li>
<li t-att-class="searches.get('type') == 'followed' and 'active' or '' ">
<a t-attf-href="/forum/#{ slug(forum) }/?{{ keep_query( type='followed') }}">Followed</a>
</li>
<li class="dropdown-header">Sort by</li>
<li>
<a href="#" class="active">Last activity date</a> <!-- default order to implement -->
</li>
<li>
<a href="#">Most answered</a>
</li>
<li>
<a href="#">Most voted</a>
</li>
</ul>
</small>
</h1>
<div t-foreach="question_ids" t-as="question" class="mb16">
<t t-call="website_forum.post_list" />
</div>
<t t-call="website.pager" />
</t>
</template>
<template id="404">
<t t-call="website_forum.header">
<div class="oe_structure oe_empty"/>
<h1 class="mt32">Question not found!</h1>
<p>Sorry, this question is not available anymore.</p>
<p>
<a t-attf-href="/forum">Return to the question list.</a>
</p>
</t>
</template>
<template id="user_detail">
<div>
<span t-field="user.image" t-field-options='{"widget": "image", "class":"pull-left img img-circle img-avatar"}'/>
<div>
<a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(user) }" t-field="user.name"/>
<t t-raw="separator or ', '"/>
<b><t t-esc="len(user.badges)"/> badges:</b>
<span class="fa fa-certificate badge-gold"/>
<t t-esc="user.gold_badge"/>
<span class="fa fa-certificate badge-silver"/>
<t t-esc="user.silver_badge"/>
<span class="fa fa-certificate badge-bronze"/>
<t t-esc="user.bronze_badge"/>
<br/>
<t t-raw="0"/>
</div>
</div>
</template>
<template id="ask_question">
<t t-call="website_forum.header">
<h1 class="mt0">Ask your Question</h1>
<ul>
<li> please, try to make your question interesting to others </li>
<li> provide enough details and, if possible, give an example </li>
<li> be clear and concise, avoid unnecessary introductions (Hi, ... Thanks...) </li>
</ul>
<form t-attf-action="/forum/#{ slug(forum) }/question/ask/" method="post" role="form">
<input type="text" name="question_name" required="True" t-attf-value="#{question_name or ''}"
class="form-control" placeholder="Enter your Question"/>
<h5 class="mt20">Please enter a descriptive question (should finish by a '?')</h5>
<textarea name="question_content" required="True" class="form-control"
t-attf-value="#{question_content or ''}" id="textarea_ckeditor"/>
<input type="text" name="question_tag" t-attf-value="#{question_tag or ''}"
class="form-control" style="margin-top: 10px" placeholder="Tags"/>
<button class="btn btn-default forum_button" id="btn_ask_your_question"> Post Your Question </button>
</form>
<script type="text/javascript">
CKEDITOR.replace("textarea_ckeditor");
</script>
</t>
</template>
<template id="post_answer">
<h3 class="mt10">Your answer</h3>
<p>
<b>Please try to give a substantial answer.</b> If you wanted to comment on the question or answer, just
<b>use the commenting tool.</b> Please remember that you can always <b>revise your answers</b>
- no need to answer the same question twice. Also, please <b>don't forget to vote</b>
- it really helps to select the best questions and answers!
</p>
<form t-attf-action="/forum/#{ slug(forum) }/question/postanswer/" method="post" role="form">
<textarea name="answer_content" t-attf-value="#{answer_content or ''}"
class="form-control" id="textarea_ckeditor" required="True"/>
<input name="post_id" t-att-value="question.id" type="hidden"/>
<button class="btn btn-default forum_button" id="btn_ask_your_question"> Post Your Answer </button>
</form>
<script type="text/javascript">
CKEDITOR.replace("textarea_ckeditor");
</script>
</template>
<template id="edit_answer">
<t t-call="website_forum.header">
<h3>Edit answer</h3>
<form t-attf-action="/forum/#{ slug(forum) }/question/saveanswer/" method="post" role="form">
<textarea name="answer_content" required="True" value="content" class="form-control" id="textarea_ckeditor"/>
<input name="post_id" t-att-value="post.id" type="hidden"/>
<input name="answer_id" t-att-value="post_answer.id" type="hidden"/>
<button class="btn btn-default btn-lg forum_button"> Save edit </button>
</form>
<script type="text/javascript">
CKEDITOR.replace("textarea_ckeditor");
</script>
</t>
</template>
<template id="post_description_full" name="Question Navigation">
<t t-call="website_forum.header">
<form t-attf-action="/forum/#{ slug(forum) }/post_vote/" enctype="multipart/form-data" method="post" id="post_vote" role="form">
<input name="question_id" t-att-value="question.id" type="hidden"/>
<script type="text/javascript">
{
function getsupport (post_value, up_down)
{
var f=document.getElementById("post_vote")
var input = document.createElement("input");
input.name= "post_id";
input.type = "hidden";
input.value = post_value;
var vote = document.createElement("input");
vote.name= "vote";
vote.type = "hidden";
vote.value = up_down;
f.appendChild(input);
f.appendChild(vote);
document.getElementById('post_vote').submit();
}
}
</script>
</form>
<div class="question">
<div class="text-center pull-left">
<div t-attf-class="box oe_grey">
<a t-attf-class="fa fa-thumbs-up #{question.user_vote == 1 and 'text-success' or ''}"
t-attf-href="javascript:getsupport(#{ question.id },#{ 1 });"/>
<span t-esc="question.vote_count"/>
<a t-attf-class="fa fa-thumbs-down #{question.user_vote == -1 and 'text-warning' or ''}"
t-attf-href="javascript:getsupport(#{ question.id },#{ -1 });"/>
<div>
votes
</div>
</div>
<div class="text-muted">
<span t-esc="len(question.child_ids)"/>
<span t-if="len(question.child_ids)&gt;1">Answers</span>
<span t-if="len(question.child_ids)&lt;=1">Answer</span>
</div>
</div>
<div style="margin-left: 95px;">
<h1 t-field="question.name" class="mt0"/>
<t t-raw="question.content"/>
<div class="mt16 clearfix">
<div class="pull-right">
<t t-foreach="question.tags" t-as="tag">
<a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }" class="badge" t-field="tag.name"/>
</t>
</div>
<t t-set="user" t-value="question.create_uid"/>
<t t-call="website_forum.user_detail">
<span class="text-muted">Asked on <span t-field="question.write_date"/></span>
</t>
</div>
<t t-call="website_forum.comments">
<t t-set="object" t-value="question"/>
</t>
</div>
</div>
<hr/>
<div t-foreach="question.child_ids" t-as="answer" class="mt16 mb32">
<div class="text-center pull-left">
<div t-attf-class="box oe_grey">
<a t-attf-class="fa fa-thumbs-up #{answer.user_vote == 1 and 'text-success' or ''}"
t-attf-href="javascript:getsupport(#{ answer.id },#{ 1 });"/>
<span t-esc="answer.vote_count"/>
<a t-attf-class="fa fa-thumbs-down #{answer.user_vote == -1 and 'text-warning' or ''}"
t-attf-href="javascript:getsupport(#{ answer.id },#{ -1 });"/>
<div>
votes
</div>
</div>
<div class="text-muted">
<a href="#" class="fa fa-2x fa-check"/>
</div>
</div>
<div style="margin-left: 95px;" class="clearfix">
<t t-raw="answer.content" />
<div class="mt16">
<div class="pull-right">
<a class="action-links" href="">
<span class="fa fa-edit"></span>
</a>
<a class="action-links" href="">
<span class="fa fa-flag"></span>
</a>
<a class="action-links" href="">
<span class="fa-trash-o"></span>
</a>
<a class="action-links" href="">
<span class="fa fa-link"></span>
</a>
</div>
<t t-set="user" t-value="answer.create_uid"/>
<t t-call="website_forum.user_detail">
<span class="text-muted">Answered on <span t-field="answer.create_date"/></span>
</t>
</div>
<t t-call="website_forum.comments">
<t t-set="object" t-value="answer"/>
</t>
</div>
</div>
<div t-if="not answer_done">
<t t-call="website_forum.post_answer"/>
</div>
<div t-if="answer_done">
<a class="btn btn-primary mb16" t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/editanswer">Edit Your Previous Answer</a>
<span style="margin-bottom: 10px;">(only one answer per question is allowed)</span>
</div>
</t>
</template>
<template id="comments">
<h4 class="mt10"> <b>Comments</b> </h4>
<div class="mb10 css_editable_mode_hidden">
<form id="comment" t-attf-action="/forum/#{ slug(forum) }/comment" method="POST">
<input name="post_id" t-att-value="object.id" type="hidden"/>
<textarea rows="2" name="comment" class="form-control" placeholder="Write a comment..."></textarea>
<button type="submit" class="btn btn-primary mt8">Post</button>
</form>
</div>
<div class="clearfix"/>
<ul class="media-list" id="comments-list">
<li t-foreach="object.website_message_ids" t-as="message" class="media">
<div class="media-body">
<div t-field="message.body"/>
<h5 class="media-heading">
<a t-attf-href="/forum/#{ slug(forum) }/user/#{ message.author_id.id }" t-field="message.author_id"/>
<small>on <span t-field="message.date"/></small>
</h5>
</div>
</li>
</ul>
</template>
<template id="tag">
<t t-call="website_forum.header">
<h1 class="mt0">
Question by Tags
</h1>
<div class="row">
<div class="col-sm-3 mt16" t-foreach="tags" t-as="tag">
<a t-attf-href="/forum/#{ slug(forum) }/tag/#{ slug(tag) }" class="badge">
<span t-field="tag.name" />
</a>
<span>
X <t t-esc="len(tag.post_ids)"/>
</span>
</div>
</div>
</t>
</template>
<template id="badge">
<t t-call="website_forum.header">
<h1 class="mt0">
Users with Badges
</h1>
<div class="mt16" t-foreach="badges" t-as="badge">
<a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge) }" class="badge pull-left">
<span t-field="badge.name" />
</a>
<span style="margin-left:5px">
X <t t-esc="len(badge.owner_ids)"/>
</span>
<span t-field="badge.description" style="margin-left:20px"/>
</div>
</t>
</template>
<template id="badge_user">
<t t-call="website_forum.header">
<h3 class="mt32 mb32">
<b>Badge "<span t-field="badge.name"/>"</b>
</h3>
<div>
<span class="pull-left badge" t-field="badge.name"/>
<span t-field="badge.description" style="margin-left:20px"/>
</div>
<h4 class="mt32">
<t class="pull-left" t-esc="len(badge.owner_ids)"/>
<span t-if="len(badge.owner_ids)&gt;1">users</span>
<span t-if="len(badge.owner_ids)&lt;=1">user</span>
received this badge:
</h4>
<div class="row">
<div class="col-sm-3 mt16" t-foreach="users" t-as="user">
<span t-field="user.image" t-field-options='{"widget": "image", "class":"pull-left img img-circle img-avatar"}'/>
<div>
<a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(user) }" t-field="user.name"/>
</div>
</div>
</div>
</t>
</template>
<template id="users">
<t t-call="website_forum.header">
<div class="row">
<div t-foreach="users" t-as="user" class="col-sm-4">
<t t-set="separator"><br/></t>
<t t-call="website_forum.user_detail"/>
<span class="text-muted">Joined on <span t-field="user.create_date"/></span>
</div>
</div>
<div class="pull-left">
<t t-call="website.pager" />
</div>
</t>
</template>
<template id="user_detail_full">
<t t-call="website_forum.header">
<h1 class="mt0 page-header">
<span t-field="user.name" />
<small>profile</small>
</h1>
<div class="row">
<div class="col-sm-2">
<span t-field="user.image"
t-field-options='{"widget": "image", "class": "img img-responsive img-circle"}'/>
</div>
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
Karma :
</div>
<div class="col-sm-6">
<b t-field="user.karma" />
</div>
<div class="col-sm-6">
Member since :
</div>
<div class="col-sm-6">
<b>
<t t-esc="user.create_date" />
3
</b>
</div>
<div class="col-sm-6">
Last Seen :
</div>
<div class="col-sm-6">
<b>Feb 15'14</b>
</div>
<div class="col-sm-12">
Todays unused votes 30 votes left
</div>
</div>
<h2>
<t t-esc="total_votes"/>
<span>Votes</span>
</h2>
<h3>
<span class="glyphicon glyphicon-thumbs-up"></span>
<b> <t t-esc="up_votes" /> </b>
</h3>
<h3>
<span class="glyphicon glyphicon-thumbs-down"></span>
<b> <t t-esc="down_votes" /> </b>
</h3>
</div>
</div>
<ul class="nav nav-tabs">
<li class="active">
<a href="#questions" data-toggle="tab"><t t-esc="len(questions)"/> Questions</a>
</li>
<li>
<a href="#answers" data-toggle="tab"><t t-esc="len(answers)"/> Answers</a>
</li>
<li>
<a href="#activity" data-toggle="tab">Activity</a>
</li>
<li>
<a href="#badges" data-toggle="tab">Badges</a>
</li>
<li>
<a href="#followed_question" data-toggle="tab">Followed Question</a>
</li>
</ul>
<div class="tab-content mt16">
<div class="tab-pane active" id="questions">
<div t-foreach="questions" t-as="question">
<t t-call="website_forum.post_list" />
</div>
</div><div class="tab-pane" id="answers">
<div t-foreach="answers" t-as="question">
<t t-call="website_forum.post_list" />
</div>
</div>
<div class="tab-pane" id="karma">
<h1>Karma</h1>
</div>
<div class="tab-pane" id="badges">
<t t-call="website_forum.user_badges" />
</div>
<div class="tab-pane" id="followed_question">
<h1>Followed Questions</h1>
</div>
<div class="tab-pane" id="activity">
<t t-call="website_forum.user_activity" />
</div>
</div>
</t>
</template>
<template id="user_activity">
<ul class="media-list">
<li t-foreach="activities" t-as="activity" class="media">
<small t-esc="activity.create_date" class="pull-left"/>
<span t-field="activity.type" class="label label-info"/>
<a t-esc="activity.name" t-if="not activity.post_id.parent_id"
t-attf-href="/forum/#{ slug(forum) }/question/#{ activity.post_id.id }"/>
<t t-if="activity.post_id.parent_id">
<a t-esc="activity.post_id.parent_id.name"
t-attf-href="/forum/#{ slug(forum) }/question/#{ activity.post_id.parent_id.id }"/>
<span class="glyphicon glyphicon-play"/>
<t t-esc="activity.post_id.content[0:100]"/>
<strong> ... </strong>
</t>
</li>
</ul>
</template>
<template id="user_badges">
<div class="col-sm-3 mt16" t-foreach="user.badges" t-as="badge">
<a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge.badge_id) }" class="badge">
<span t-field="badge.badge_id.name" />
</a>
<span>
X <t t-esc="len(badge.badge_id.owner_ids)"/>
</span>
</div>
</template>
</data>
</openerp>