[CLEAN] website_forum: cleaning before merging
- cleaned models - cleaned controllers: lots of cleaning, rewriting, simplfiication + updated in views - added an override of the contact widget, to be able to display partner-related stuff about karma and badges - some css tweaking - badges cleaning bzr revid: tde@openerp.com-20140411132939-bmvyc9bqpqpkk843
This commit is contained in:
parent
4b776a90c0
commit
cd4afee17e
|
@ -39,6 +39,7 @@ Ask questions, get answers, no distractions
|
|||
'views/forum.xml',
|
||||
'views/res_users.xml',
|
||||
'views/website_forum.xml',
|
||||
'views/ir_qweb.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'data/badges_question.xml',
|
||||
'data/badges_answer.xml',
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 3)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 3)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_teacher">
|
||||
|
@ -45,7 +45,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 4)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 4)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_nice_answer">
|
||||
|
@ -75,7 +75,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 6)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 6)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_good_answer">
|
||||
|
@ -105,7 +105,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 15)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 15)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_great_answer">
|
||||
|
@ -137,7 +137,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')"/>
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 3), ('is_correct', '=', True)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 3), ('is_correct', '=', True)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_enlightened">
|
||||
|
@ -167,7 +167,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 15), ('is_correct', '=', True)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '!=', False), ('vote_count', '>=', 15), ('is_correct', '=', True)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_guru">
|
||||
|
@ -199,7 +199,7 @@
|
|||
<field name="compute_code">def get_posts(cr, uid, context=None):
|
||||
res = 1
|
||||
Post = self.pool['website.forum.post']
|
||||
user_posts = Post.search(cr, uid, [('user_id','=',object.user_id.id), ('parent_id', '!=', False), ('vote_count', '>=', 2)], context=context)
|
||||
user_posts = Post.search(cr, uid, [('create_uid','=',object.user_id.id), ('parent_id', '!=', False), ('vote_count', '>=', 2)], context=context)
|
||||
for post in Post.browse(cr, uid, user_posts, context=context):
|
||||
print post.parent_id.create_date
|
||||
question_date = datetime.strptime(post.parent_id.create_date, "%Y-%m-%d %H:%M:%S")
|
||||
|
@ -240,7 +240,7 @@ result = get_posts(cr, uid, context=context)
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '!=', False), ('parent_id.user_id', '=', user.id), ('vote_count', '>=', 3)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '!=', False), ('parent_id.create_uid', '=', user.id), ('vote_count', '>=', 3)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_self_learner">
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post_vote')"/>
|
||||
<field name="domain">[('user_id', '=', user.id), ('vote', '=', '-1')]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('vote', '=', '-1')]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_critic">
|
||||
|
@ -76,7 +76,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('vote_count', '>=', 3), ('active', '=', False)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('vote_count', '>=', 3), ('active', '=', False)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_disciplined">
|
||||
|
@ -107,7 +107,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('mail.model_mail_message')" />
|
||||
<field name="domain">[('user_id','=',user.id), '|', ('name','!=',False), ('content','!=',False)]</field>
|
||||
<field name="domain">[('create_uid','=',user.id), '|', ('name','!=',False), ('content','!=',False)]</field>
|
||||
<field name="domain" eval="[('author_id', '=', user.partner_id.id), ('model', '=', 'forum.post'), ('subtype_id', 'in', [ref('website_forum.mt_answer_edit'), ref('website_forum.mt_question_edit')])]"/>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
|
@ -140,7 +140,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_website_forum_post_history')" />
|
||||
<field name="domain">[('user_id','=',user.id), ('tags','!=',False)]</field>
|
||||
<field name="domain">[('create_uid','=',user.id), ('tags','!=',False)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record> -->
|
||||
|
||||
|
@ -176,7 +176,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_website_forum_post_history')" />
|
||||
<field name="domain">[('user_id','=',user.id), '|', ('name','!=',False), ('content','!=',False)]</field>
|
||||
<field name="domain">[('create_uid','=',user.id), '|', ('name','!=',False), ('content','!=',False)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record> -->
|
||||
|
||||
|
@ -211,8 +211,7 @@
|
|||
end_date = date.today() - timedelta(days=1)
|
||||
cr.execute('SELECT COUNT(id), create_date from forum_post_vote where create_date >= %s and create_date <= %s and user_id = %s GROUP BY create_date',(start_date,end_date, object.user_id.id,))
|
||||
data = cr.dictfetchall()
|
||||
result = int(len(data) >= 15)
|
||||
</field>
|
||||
result = int(len(data) >= 15)</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
|
@ -278,7 +277,7 @@ result = int(len(data) >= 15)
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id','=',user.id), ('vote_count', '<=', -3), ('active', '=', False)]</field>
|
||||
<field name="domain">[('create_uid','=',user.id), ('vote_count', '<=', -3), ('active', '=', False)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- <?xml version="1.0" encoding="utf-8"?> -->
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
@ -107,7 +107,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('favorite_count', '>=', 1)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('favourite_count', '>=', 1)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_favorite_question">
|
||||
|
@ -137,7 +137,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('favorite_count', '>=', 5)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('favourite_count', '>=', 5)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_favorite_question">
|
||||
|
@ -167,7 +167,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('favorite_count', '>=', 25)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('favourite_count', '>=', 25)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_stellar_question">
|
||||
|
@ -199,7 +199,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '=', False), ('vote_count', '>=', 1)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('vote_count', '>=', 1)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_student">
|
||||
|
@ -229,7 +229,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')"/>
|
||||
<field name="domain">[('user_id','=',user.id), ('parent_id', '=', False), ('vote_count', '>=', 4)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('vote_count', '>=', 4)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_nice_question">
|
||||
|
@ -259,7 +259,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id', '=', user.id), ('parent_id', '=', False), ('vote_count', '>=', 6)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('vote_count', '>=', 6)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_good_question">
|
||||
|
@ -289,7 +289,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id','=',user.id), ('parent_id', '=', False), ('vote_count', '>=', 15)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('vote_count', '>=', 15)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_great_question">
|
||||
|
@ -320,7 +320,7 @@
|
|||
<field name="computation_mode">count</field>
|
||||
<field name="display_mode">boolean</field>
|
||||
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
|
||||
<field name="domain">[('user_id','=',user.id), ('parent_id', '=', False), ('is_correct', '=', True)]</field>
|
||||
<field name="domain">[('create_uid', '=', user.id), ('parent_id', '=', False), ('is_correct', '=', True)]</field>
|
||||
<field name="condition">higher</field>
|
||||
</record>
|
||||
<record model="gamification.challenge" id="challenge_scholar">
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
<field name="forum_id" ref="website_forum.forum_help"/>
|
||||
<field name="views">5</field>
|
||||
<field name="tag_ids" eval="[(4,ref('website_forum.tags_0')),(4,ref('website_forum.tags_1')),(4,ref('website_forum.tags_2'))]"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="question_1" model="forum.post">
|
||||
<field name="name">CMS replacement for ERP and eCommerce</field>
|
||||
|
@ -38,7 +37,6 @@ Can I use OpenERP as a replacement CMS of Wordpress + eCommerce plugin?
|
|||
|
||||
In simple words does OpenERP became CMS+ERP platform?</field>
|
||||
<field name="tag_ids" eval="[(4,ref('website_forum.tags_3'))]"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
</record>
|
||||
|
||||
<!-- Answer -->
|
||||
|
@ -53,7 +51,7 @@ In simple words does OpenERP became CMS+ERP platform?</field>
|
|||
Step 5. Go to Scheduled Actions.. Set interval number to 1. Interval Unit to Minutes. Then Set the Next Execution date to 2 minutes from now. If your SMTP is configured correctly you will start to get a mail every minute with the reminder.
|
||||
</field>
|
||||
<field name="parent_id" ref="question_0" />
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="create_uid" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="answer_1" model="forum.post">
|
||||
<field name="forum_id" ref="website_forum.forum_help"/>
|
||||
|
@ -61,7 +59,7 @@ In simple words does OpenERP became CMS+ERP platform?</field>
|
|||
The CMS editor in OpernERP web is nice but I prefer drupal for customization and there is a drupal module for OpenERP. I think WP is better than OpenERP web too.
|
||||
</field>
|
||||
<field name="parent_id" ref="question_1"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="create_uid" ref="base.user_root"/>
|
||||
</record>
|
||||
|
||||
<!-- Post Vote -->
|
||||
|
|
|
@ -65,14 +65,14 @@ class Post(osv.Model):
|
|||
def _get_user_favourite(self, cr, uid, ids, field_name, arg, context):
|
||||
res = dict.fromkeys(ids, False)
|
||||
for post in self.browse(cr, uid, ids, context=context):
|
||||
if uid in [f.user_id.id for f in post.favourite_ids]:
|
||||
if uid in [f.id for f in post.favourite_ids]:
|
||||
res[post.id] = True
|
||||
return res
|
||||
|
||||
def _get_favorite_count(self, cr, uid, ids, field_name, arg, context):
|
||||
res = dict.fromkeys(ids, 0)
|
||||
for post in self.browse(cr, uid, ids, context=context):
|
||||
res[post.id] += len(post.favorite_ids)
|
||||
res[post.id] += len(post.favourite_ids)
|
||||
return res
|
||||
|
||||
def _get_post_from_hierarchy(self, cr, uid, ids, context=None):
|
||||
|
@ -91,6 +91,12 @@ class Post(osv.Model):
|
|||
res[post.id] = len(post.child_ids)
|
||||
return res
|
||||
|
||||
def _get_uid_answered(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict.fromkeys(ids, False)
|
||||
for post in self.browse(cr, uid, ids, context=context):
|
||||
res[post.id] = any(answer.create_uid.id == uid for answer in post.child_ids)
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Title', size=128),
|
||||
'forum_id': fields.many2one('forum.forum', 'Forum', required=True),
|
||||
|
@ -122,12 +128,12 @@ class Post(osv.Model):
|
|||
'forum.post.vote': (_get_post_from_vote, [], 10),
|
||||
}),
|
||||
# favorite fields
|
||||
'favourite_ids': fields.many2many('res.users', 'Favourite'),
|
||||
'favourite_ids': fields.many2many('res.users', string='Favourite'),
|
||||
'user_favourite': fields.function(_get_user_favourite, string="My Favourite", type='boolean'),
|
||||
'favorite_count': fields.function(
|
||||
'favourite_count': fields.function(
|
||||
_get_favorite_count, string='Favorite Count', type='integer',
|
||||
store={
|
||||
'forum.post': (lambda self, cr, uid, ids, c={}: ids, ['favorite_ids'], 10),
|
||||
'forum.post': (lambda self, cr, uid, ids, c={}: ids, ['favourite_ids'], 10),
|
||||
}),
|
||||
# hierarchy
|
||||
'parent_id': fields.many2one('forum.post', 'Question', ondelete='cascade'),
|
||||
|
@ -137,6 +143,9 @@ class Post(osv.Model):
|
|||
store={
|
||||
'forum.post': (_get_post_from_hierarchy, ['parent_id', 'child_ids'], 10),
|
||||
}),
|
||||
'uid_has_answered': fields.function(
|
||||
_get_uid_answered, string='Has Answered', type='boolean',
|
||||
),
|
||||
# closing
|
||||
'closed_reason_id': fields.many2one('forum.post.reason', 'Reason'),
|
||||
'closed_uid': fields.many2one('res.users', 'Closed by', select=1),
|
||||
|
@ -195,8 +204,8 @@ class Post(osv.Model):
|
|||
return {'error': 'lessthen_10_karma'}
|
||||
# user can not vote on own post
|
||||
posts = self.browse(cr, uid, ids, context=context)
|
||||
if any(post.create_uid.id == uid for post in posts):
|
||||
return {'error': 'own_post'}
|
||||
# if any(post.create_uid.id == uid for post in posts):
|
||||
# return {'error': 'own_post'}
|
||||
|
||||
vote_ids = Vote.search(cr, uid, [('post_id', 'in', ids), ('user_id', '=', uid)], context=context)
|
||||
if vote_ids:
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
sass:
|
||||
sass --compass --unix-newlines -t expanded website_forum.sass:website_forum.css
|
||||
all: website_forum.css
|
||||
%.css: %.sass
|
||||
sass -t expanded --compass --unix-newlines $< $@
|
||||
watch:
|
||||
sass -t expanded --compass --unix-newlines --watch .:.
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
.box {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
margin-left: 4px;
|
||||
margin-right: 4px;
|
||||
border-radius: 4px;
|
||||
min-width: 80px;
|
||||
}
|
||||
.box span {
|
||||
font-size: 200%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.question div.pull-left {
|
||||
margin-right: 14px;
|
||||
min-width: 80px;
|
||||
}
|
||||
.question .question-name {
|
||||
font-size: 150%;
|
||||
}
|
||||
|
@ -64,13 +63,11 @@ a.no-decoration {
|
|||
}
|
||||
|
||||
.oe_comment_grey {
|
||||
-moz-box-shadow: 0px 4px 6px 2px #eeeeee;
|
||||
-webkit-box-shadow: 0px 4px 6px 2px #eeeeee;
|
||||
box-shadow: 0px 4px 6px 2px #eeeeee;
|
||||
color: whitesmoke;
|
||||
}
|
||||
|
||||
.forum_user_flag {
|
||||
max-width: 25px;
|
||||
.country_flag {
|
||||
max-height: 16px;
|
||||
display: inline-block;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
.box
|
||||
padding-left: 8px
|
||||
padding-right: 8px
|
||||
margin-left: 4px
|
||||
margin-right: 4px
|
||||
border-radius: 4px
|
||||
min-width: 80px
|
||||
span
|
||||
font-size: 200%
|
||||
font-weight: bold
|
||||
|
||||
.question
|
||||
div.pull-left
|
||||
margin-right: 14px
|
||||
min-width: 80px
|
||||
.question-name
|
||||
font-size: 150%
|
||||
|
||||
|
@ -52,8 +52,8 @@ a.no-decoration
|
|||
.oe_comment_grey
|
||||
color: #f5f5f5
|
||||
|
||||
.forum_user_flag
|
||||
max-width: 25px
|
||||
.country_flag
|
||||
max-height: 16px
|
||||
display: inline-block
|
||||
margin-left: 2px
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ $(document).ready(function () {
|
|||
$('.vote_up ,.vote_down').on('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
var $link = $(ev.currentTarget);
|
||||
var value = $link.attr("value")
|
||||
var url_target = $link.data("value") == '1' ? 'upvote' : 'downvote';
|
||||
var forum_id = $link.data('forum-id');
|
||||
var post_id = $link.data('post-id');
|
||||
|
||||
openerp.jsonRpc("/forum/post_vote", 'call', {
|
||||
'post_id': $link.attr("id"),
|
||||
'vote': value})
|
||||
openerp.jsonRpc("/forum/" + forum_id + "/post/" + post_id + "/" + url_target, 'call', {})
|
||||
.then(function (data) {
|
||||
if (data['error']){
|
||||
if (data['error'] == 'own_post'){
|
||||
|
@ -38,7 +38,7 @@ $(document).ready(function () {
|
|||
$link.parent().find(".text-success").removeClass("text-success");
|
||||
$link.parent().find(".text-warning").removeClass("text-warning");
|
||||
} else {
|
||||
if (value == 1) {
|
||||
if (data['vote_count'] == 1) {
|
||||
$link.addClass("text-success");
|
||||
} else {
|
||||
$link.addClass("text-warning");
|
||||
|
@ -49,23 +49,12 @@ $(document).ready(function () {
|
|||
return true;
|
||||
});
|
||||
|
||||
$('.delete').on('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
var $link = $(ev.currentTarget);
|
||||
openerp.jsonRpc("/forum/post_delete", 'call', {
|
||||
'post_id': $link.attr("id")})
|
||||
.then(function (data) {
|
||||
$("div#answer_" + $link.attr('id')).remove();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.accept_answer').on('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
var $link = $(ev.currentTarget);
|
||||
openerp.jsonRpc("/forum/correct_answer", 'call', {
|
||||
'post_id': $link.attr("id")})
|
||||
.then(function (data) {
|
||||
var forum_id = $link.data('forum-id');
|
||||
var post_id = $link.data('post-id');
|
||||
openerp.jsonRpc("/forum/" + forum_id + "/post/" + post_id + "/toggle_correct", 'call', {}).then(function (data) {
|
||||
if (data['error']) {
|
||||
if (data['error'] == 'anonymous_user'){
|
||||
var $warning = $('<div class="alert alert-danger alert-dismissable" id="correct_answer_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
|
||||
|
@ -98,9 +87,9 @@ $(document).ready(function () {
|
|||
$('.favourite_question').on('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
var $link = $(ev.currentTarget);
|
||||
openerp.jsonRpc("/forum/favourite_question", 'call', {
|
||||
'post_id': $link.attr("id")})
|
||||
.then(function (data) {
|
||||
var forum_id = $link.data('forum-id');
|
||||
var post_id = $link.data('post-id');
|
||||
openerp.jsonRpc("/forum/" + forum_id + "/question/" + post_id + "/toggle_favourite", 'call', {}).then(function (data) {
|
||||
if (data) {
|
||||
$link.addClass("forum_favourite_question")
|
||||
} else {
|
||||
|
@ -113,9 +102,10 @@ $(document).ready(function () {
|
|||
$('.comment_delete').on('click', function (ev) {
|
||||
ev.preventDefault();
|
||||
var $link = $(ev.currentTarget);
|
||||
openerp.jsonRpc("/forum/message_delete", 'call', {
|
||||
'message_id': $link.attr("id")})
|
||||
.then(function (data) {
|
||||
var forum_id = $link.data('forum-id');
|
||||
var post_id = $link.data('post-id');
|
||||
var message_id = $link.data('message-id');
|
||||
openerp.jsonRpc("/forum/message_delete", 'call', {}).then(function (data) {
|
||||
$link.parents('#comment').remove();
|
||||
});
|
||||
return true;
|
||||
|
@ -155,20 +145,6 @@ $(document).ready(function () {
|
|||
});
|
||||
}
|
||||
|
||||
$('.post_history').change(function (ev) {
|
||||
var $option = $(ev.currentTarget);
|
||||
openerp.jsonRpc("/forum/selecthistory", 'call', {
|
||||
'history_id': $option.attr("value")})
|
||||
.then(function (data) {
|
||||
var $input = $('<input type="text" name="question_tag" class="form-control col-md-9 load_tags" placeholder="Tags"/>')
|
||||
$option.parent().find(".text-core").replaceWith($input);
|
||||
set_tags(data['tags']);
|
||||
$option.parent().find("#question_name").attr('value', data['name']);
|
||||
CKEDITOR.instances['content'].setData(data['content'])
|
||||
})
|
||||
return true;
|
||||
});
|
||||
|
||||
if ($('textarea.load_editor').length) {
|
||||
var editor = CKEDITOR.instances['content'];
|
||||
editor.on('instanceReady', CKEDITORLoadComplete);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<openerp>
|
||||
<data>
|
||||
<template id="contact" inherit_id="base.contact" name="Forum Contact Widget">
|
||||
<xpath expr="//div[@itemprop='address']" position="after">
|
||||
<div>
|
||||
<div t-if="'karma' in fields" class='css_editable_mode_hidden'>
|
||||
<b><t t-esc="object.karma"/></b>
|
||||
<div t-if="options.get('badges')" style="display: inline-block">
|
||||
<t t-raw="separator"/>
|
||||
<b>|</b>
|
||||
<span class="fa fa-circle badge-gold"/>
|
||||
<t t-esc="object.gold_badge"/>
|
||||
<span class="fa fa-circle badge-silver"/>
|
||||
<t t-esc="object.silver_badge"/>
|
||||
<span class="fa fa-circle badge-bronze"/>
|
||||
<t t-esc="object.bronze_badge"/>
|
||||
</div>
|
||||
<t t-raw="0"/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
</data>
|
||||
</openerp>
|
|
@ -2,68 +2,26 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<template id="editor_head" inherit_id="website.editor_head"
|
||||
<!-- Editor custo -->
|
||||
<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 type="text/javascript"
|
||||
src="/website_forum/static/src/js/website_forum.editor.js"/>
|
||||
<script type="text/javascript" src="/website_forum/static/src/js/website.tour.forum.js"/>
|
||||
<script type="text/javascript" src="/website_forum/static/src/js/website_forum.editor.js"/>
|
||||
</xpath>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- Layout add nav and footer -->
|
||||
<template id="header_footer_custom" inherit_id="website.layout"
|
||||
<!-- 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&A</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/forum">Forums</a>
|
||||
</li>
|
||||
<li><a t-attf-href="/forum/%(website_forum.forum_help)d">Q&A</a></li>
|
||||
<li><a href="/forum">Forums</a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- List of Questions -->
|
||||
<template id="post_list">
|
||||
<div class="question clearfix">
|
||||
<div class="pull-left text-center">
|
||||
<div t-attf-class="box #{question.child_count and 'oe_green' or 'oe_grey'}">
|
||||
<span t-esc="question.child_count"/>
|
||||
<span t-if="question.is_correct" class="fa fa-2x fa-check-circle"/>
|
||||
<div t-if="question.child_count>1">Answers</div>
|
||||
<div t-if="question.child_count<=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"/>
|
||||
<span t-if="not question.active"><b> [Deleted]</b></span>
|
||||
<span t-if="question.state == 'close'"><b> [Closed]</b></span>
|
||||
</div>
|
||||
<div class="text-muted">
|
||||
by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.user_id.id }" t-field="question.user_id"/>
|
||||
<t t-if="question.user_id.country_id">
|
||||
<span t-field="question.user_id.country_id.image" t-field-options='{"widget": "image", "class":"forum_user_flag"}'/>
|
||||
</t>
|
||||
on <span t-field="question.write_date" t-field-options='{"format":"short"}'/>
|
||||
<div t-if="question.vote_count">
|
||||
<strong>with <span t-esc="question.vote_count"/> votes</strong>
|
||||
</div>
|
||||
</div>
|
||||
<t t-foreach="question.tag_ids" t-as="tag">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }/questions" class="badge" t-field="tag.name"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Page Index -->
|
||||
<template id="header" name="Forum Index">
|
||||
<!-- Page Index -->
|
||||
<template id="header" name="Forum Index">
|
||||
<t t-call="website.layout">
|
||||
<t t-set="head">
|
||||
<link rel='stylesheet' href="/web/static/lib/jquery.textext/jquery.textext.css"/>
|
||||
|
@ -123,15 +81,15 @@
|
|||
<div id="wrap" class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<div t-foreach="notifications.get('notifications') or []" t-as="notification" class="alert alert-success alert-dismissable">
|
||||
<div t-foreach="notifications or []" t-as="notification" class="alert alert-success alert-dismissable">
|
||||
<button type="button" class="close notification_close" t-att-id="notification.id" data-dismiss="alert" aria-hidden="true">&times;</button>
|
||||
<div t-field="notification.body"/>
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(notifications.get('user')) }#badges" class="fa fa-arrow-right">View Your Badges</a>
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(user) }#badges" class="fa fa-arrow-right">View Your Badges</a>
|
||||
</div>
|
||||
<t t-raw="0"/>
|
||||
</div>
|
||||
<div class="col-sm-3" id="right-column">
|
||||
<a t-if="not ask_question" class="btn btn-primary btn-lg btn-block mb16" t-attf-href="/forum/#{ slug(forum) }/ask">Ask a Question</a>
|
||||
<a t-if="header.get('ask_hide')" 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>
|
||||
|
@ -141,18 +99,15 @@
|
|||
<a t-attf-href="/forum/#{slug(forum)}/faq" class="fa fa-arrow-right"> Read Guidelines</a>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="question_data">
|
||||
<div t-if="header.get('question_data')">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading text-center">
|
||||
<h3 class="panel-title">Question tools</h3>
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<a class="btn btn-block btn-default btn-md" t-if="not following"
|
||||
t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/subscribe">Follow</a>
|
||||
<a class="btn btn-block btn-default btn-md" t-if="following"
|
||||
t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/unsubscribe">UnFollow</a>
|
||||
<t t-call="website_mail.follow"><t t-set="object" t-value="question"/></t>
|
||||
<div class="mt8">
|
||||
<strong><t t-raw="len(question.message_follower_ids)"/></strong> follower
|
||||
<strong><t t-raw="len(question.message_follower_ids)"/></strong> follower(s)
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-heading text-center">
|
||||
|
@ -175,15 +130,74 @@
|
|||
</div>
|
||||
<div class="oe_structure"/>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="faq">
|
||||
<!-- Display a post -->
|
||||
<template id="display_post">
|
||||
<div class="question clearfix">
|
||||
<div class="pull-left text-center">
|
||||
<div t-attf-class="box #{question.child_count and 'oe_green' or 'oe_grey'}">
|
||||
<span t-esc="question.child_count"/>
|
||||
<span t-if="question.is_correct" class="fa fa-2x fa-check-circle"/>
|
||||
<div t-if="question.child_count>1">Answers</div>
|
||||
<div t-if="question.child_count<=1">Answer</div>
|
||||
</div>
|
||||
<div class="text-muted text-center">
|
||||
<span t-field="question.views"/> Views
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-right text-center">
|
||||
<div class="box oe_grey">
|
||||
<span t-esc="question.vote_count or 0"/>
|
||||
<div t-if="question.vote_count>1">Votes</div>
|
||||
<div t-if="question.vote_count<=1">Vote</div>
|
||||
</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"/>
|
||||
<span t-if="not question.active"><b> [Deleted]</b></span>
|
||||
<span t-if="question.state == 'close'"><b> [Closed]</b></span>
|
||||
</div>
|
||||
<div class="text-muted">
|
||||
by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.create_uid.id }"
|
||||
t-field="question.create_uid" t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
|
||||
style="display: inline-block;"/>
|
||||
on <span t-field="question.write_date" t-field-options='{"format":"short"}'/>
|
||||
</div>
|
||||
<t t-foreach="question.tag_ids" t-as="tag">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }/questions" class="badge" t-field="tag.name"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Display a post as an answer -->
|
||||
<template id="display_post_answer">
|
||||
<div class="clearfix">
|
||||
<div t-attf-class="pull-left text-center mb16 box #{len(answer.vote_ids) and 'oe_green' or 'oe_grey'}">
|
||||
<div t-esc="len(answer.vote_ids)"/>
|
||||
</div>
|
||||
<div class="question-name" style="margin-left: 32px;">
|
||||
<a style="font-size: 15px;" t-attf-href="/forum/#{ slug(forum) }/question/#{ answer.parent_id.id }/#answer-#{ answer.id }" t-esc="answer.parent_id.name"/>
|
||||
<t t-if="len(answer.website_message_ids)>0">
|
||||
(<t t-esc="len(answer.website_message_ids)"/>
|
||||
<t t-if="len(answer.website_message_ids)>1">Comments</t>
|
||||
<t t-if="len(answer.website_message_ids)<=1">Comment</t>)
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- FAQ Layout -->
|
||||
<template id="faq">
|
||||
<t t-call="website_forum.header">
|
||||
<div t-field="forum.faq"/>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="forum_index">
|
||||
<!-- All Forums Layout -->
|
||||
<template id="forum_all">
|
||||
<t t-call="website.layout">
|
||||
<div class="container">
|
||||
<h1 class="mb32">Our forums</h1>
|
||||
|
@ -197,13 +211,13 @@
|
|||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="index" name="Forum">
|
||||
<!-- Specific Forum Layout -->
|
||||
<template id="forum_index" name="Forum">
|
||||
<t t-call="website_forum.header">
|
||||
<h1 class="page-header mt0">
|
||||
<t t-esc="total_questions"/>
|
||||
<span>Questions</span>
|
||||
<t t-esc="len(question_ids)"/> <span>Questions</span>
|
||||
<t t-esc="search"/>
|
||||
<small class="dropdown" t-if="filters in ('all', 'unanswered','followed', 'tag')">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
|
@ -227,8 +241,9 @@
|
|||
<li t-if="uid" t-att-class="filters == 'followed' and 'active' or '' ">
|
||||
<a t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', filters='followed')">Followed</a>
|
||||
</li>
|
||||
<li class="dropdown-header">Tags</li>
|
||||
<li t-if="tag" t-att-class="tag and 'active' or '' ">
|
||||
<a href=""><t t-esc="tag.name"/> Tag</a>
|
||||
<a href=""><t t-esc="tag.name"/></a>
|
||||
</li>
|
||||
<li class="dropdown-header">Sort by</li>
|
||||
<li t-att-class="sorting == 'date' and 'active' or '' ">
|
||||
|
@ -244,13 +259,13 @@
|
|||
</small>
|
||||
</h1>
|
||||
<div t-foreach="question_ids" t-as="question" class="mb16">
|
||||
<t t-call="website_forum.post_list"/>
|
||||
<t t-call="website_forum.display_post"/>
|
||||
</div>
|
||||
<t t-call="website.pager"/>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="404">
|
||||
<template id="404">
|
||||
<t t-call="website_forum.header">
|
||||
<div class="oe_structure oe_empty"/>
|
||||
<h1 class="mt32">Question not found!</h1>
|
||||
|
@ -259,33 +274,10 @@
|
|||
<a t-attf-href="/forum">Return to the question list.</a>
|
||||
</p>
|
||||
</t>
|
||||
</template>
|
||||
</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-if="user.country_id">
|
||||
<span t-field="user.country_id.image" t-field-options='{"widget": "image", "class":"forum_user_flag"}'/>
|
||||
</t>
|
||||
<b><t t-esc="user.karma"/></b>
|
||||
<t t-raw="separator"/>
|
||||
<div>
|
||||
<b> badges:</b>
|
||||
<span class="fa fa-circle badge-gold"/>
|
||||
<t t-esc="user.gold_badge"/>
|
||||
<span class="fa fa-circle badge-silver"/>
|
||||
<t t-esc="user.silver_badge"/>
|
||||
<span class="fa fa-circle badge-bronze"/>
|
||||
<t t-esc="user.bronze_badge"/>
|
||||
</div>
|
||||
<t t-raw="0"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="ask_question">
|
||||
<!-- Edition: ask your question -->
|
||||
<template id="ask_question">
|
||||
<t t-call="website_forum.header">
|
||||
<h1 class="mt0">Ask your Question</h1>
|
||||
<ul>
|
||||
|
@ -293,7 +285,7 @@
|
|||
<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" class="tag_text">
|
||||
<form t-attf-action="/forum/#{ slug(forum) }/question/new" method="post" role="form" class="tag_text">
|
||||
<input type="text" name="question_name" required="True" t-attf-value="#{question_name}"
|
||||
class="form-control" placeholder="Enter your Question"/>
|
||||
<h5 class="mt20">Please enter a descriptive question (should finish by a '?')</h5>
|
||||
|
@ -302,8 +294,7 @@
|
|||
<t t-esc="question_content"/>
|
||||
</textarea>
|
||||
<br/>
|
||||
<input type="text" name="question_tags" t-attf-value="#{question_tag or ''}"
|
||||
placeholder="Tags" class="form-control load_tags"/>
|
||||
<input type="text" name="question_tags" placeholder="Tags" class="form-control load_tags"/>
|
||||
<br/>
|
||||
<button class="btn btn-primary" id="btn_ask_your_question">Post Your Question</button>
|
||||
</form>
|
||||
|
@ -311,9 +302,10 @@
|
|||
CKEDITOR.replace("content");
|
||||
</script>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="edit_post">
|
||||
<!-- Edition: edit a post -->
|
||||
<template id="edit_post">
|
||||
<t t-call="website_forum.header">
|
||||
<h3 t-if="not is_answer">Edit question</h3>
|
||||
<h3 t-if="is_answer">Edit answer</h3>
|
||||
|
@ -343,12 +335,13 @@
|
|||
CKEDITOR.replace("content");
|
||||
</script>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="close_question">
|
||||
<!-- Moderation: close a question -->
|
||||
<template id="close_question">
|
||||
<t t-call="website_forum.header">
|
||||
<h3 class=""><b>Close question</b></h3><br/>
|
||||
<form t-attf-action="/forum/#{ slug(forum) }/question/close" method="post" role="form">
|
||||
<form t-attf-action="/forum/#{ slug(forum) }/question/#{slug(question)}/close" method="post" role="form">
|
||||
<input name="post_id" t-att-value="post.id" type="hidden"/>
|
||||
<span class="pull-left">Close the question:</span>
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post) }" t-field="post.name"/>
|
||||
|
@ -357,7 +350,7 @@
|
|||
<div class="col-md-9 mb16">
|
||||
<select class="form-control" name="reason">
|
||||
<t t-foreach="reasons or []" t-as="reason">
|
||||
<option t-att-value="reason.id" t-att-selected="reason.id == post.reason_id.id"><t t-esc="reason.name"/></option>
|
||||
<option t-att-value="reason.id" t-att-selected="reason.id == post.closed_reason_id.id"><t t-esc="reason.name"/></option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -367,9 +360,10 @@
|
|||
</div>
|
||||
</form>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="post_answer">
|
||||
<!-- Edition: post an answer -->
|
||||
<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
|
||||
|
@ -377,31 +371,31 @@
|
|||
- 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">
|
||||
<form t-attf-action="/forum/#{ slug(forum) }/post/#{slug(question)}/new" method="post" role="form">
|
||||
<input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
|
||||
<textarea name="content" class="form-control load_editor" required="True"/>
|
||||
<input name="post_id" t-att-value="question.id" type="hidden"/>
|
||||
<button class="btn btn-primary" id="btn_ask_your_question">Post Your Answer</button>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
CKEDITOR.replace("content");
|
||||
</script>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="vote">
|
||||
<template id="vote">
|
||||
<div t-attf-class="box oe_grey">
|
||||
<a t-attf-class="vote_up fa fa-thumbs-up no-decoration #{post.user_vote == 1 and 'text-success' or ''}"
|
||||
t-attf-id="#{post.id}" t-attf-value="1"/>
|
||||
t-attf-data-post-id="#{post.id}" t-attf-data-forum-id="#{post.forum_id.id}" data-value="1"/>
|
||||
<span id="vote_count" t-esc="post.vote_count"/>
|
||||
<a t-attf-class="vote_down fa fa-thumbs-down no-decoration #{post.user_vote == -1 and 'text-warning' or ''}"
|
||||
t-attf-id="#{post.id}" t-attf-value="-1"/>
|
||||
t-attf-data-post-id="#{post.id}" t-attf-data-forum-id="#{post.forum_id.id}" data-value="-1"/>
|
||||
<div>
|
||||
votes
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="post_description_full" name="Question Navigation">
|
||||
<!-- Specific Post Layout -->
|
||||
<template id="post_description_full" name="Question Navigation">
|
||||
<t t-call="website_forum.header">
|
||||
|
||||
<div t-attf-class="question #{not question.active and 'alert alert-danger' or ''}">
|
||||
|
@ -415,7 +409,8 @@
|
|||
<span t-if="question.child_count<=1">Answer</span>
|
||||
</div>
|
||||
<div>
|
||||
<a t-attf-id="#{question.id}" t-attf-class="favourite_question no-decoration fa fa-2x fa-star #{question.user_favourite and 'forum_favourite_question' or ''}"/>
|
||||
<a t-attf-data-forum-id="#{question.forum_id.id}" t-attf-data-post-id="#{question.id}"
|
||||
t-attf-class="favourite_question no-decoration fa fa-2x fa-star #{question.user_favourite and 'forum_favourite_question' or ''}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-left: 95px;">
|
||||
|
@ -434,45 +429,51 @@
|
|||
</t>
|
||||
</div>
|
||||
<ul class="list-inline">
|
||||
<li t-if="user.id == question.user_id.id or user.karma>=50">
|
||||
<li t-if="user.id == question.create_uid.id or user.karma>=50">
|
||||
<a style="cursor: pointer" data-toggle="collapse" class="text-muted fa fa-comment-o"
|
||||
t-attf-data-target="#comment#{ question._name.replace('.','') + '-' + str(question.id) }">
|
||||
comment
|
||||
</a>
|
||||
</li>
|
||||
<li t-if="question.state != 'close' and (user.id == question.user_id.id or user.karma>=100)">
|
||||
<a class="text-muted fa fa-times" t-attf-href="/forum/#{ slug(forum) }/close/question/#{ question.id }">close</a>
|
||||
<li t-if="question.state != 'close' and (user.id == question.create_uid.id or user.karma>=100)">
|
||||
<a class="text-muted fa fa-times" t-attf-href="/forum/#{ slug(forum) }/question/#{slug(question)}/ask_for_close">close</a>
|
||||
</li>
|
||||
<li t-if="question.state == 'close' and user.karma>=500">
|
||||
<a class="text-muted fa fa-undo" t-attf-href="/forum/#{ slug(forum) }/reopen/question/#{ question.id }">reopen</a>
|
||||
<a class="text-muted fa fa-undo" t-attf-href="/forum/#{ slug(forum) }/question/#{slug(question)/reopen">reopen</a>
|
||||
</li>
|
||||
<li t-if="user.id == question.user_id.id or user.karma>=300">
|
||||
<a class="text-muted fa fa-edit" t-attf-href="/forum/#{ slug(forum) }/edit/question/#{ question.id }">edit</a>
|
||||
<li t-if="user.id == question.create_uid.id or user.karma>=300">
|
||||
<a class="text-muted fa fa-edit" t-attf-href="/forum/#{ slug(forum) }/question/#{slug(question)}/edit">edit</a>
|
||||
</li>
|
||||
<li t-if="question.active and user.id == question.user_id.id or user.karma>=1000">
|
||||
<a class="text-muted fa fa-trash-o" t-attf-href="/forum/#{ slug(forum) }/delete/question/#{ question.id }">delete</a>
|
||||
<li t-if="question.active and user.id == question.create_uid.id or user.karma>=1000">
|
||||
<a class="text-muted fa fa-trash-o" t-attf-href="/forum/#{ slug(forum) }/question/#{slug(question)}/delete">delete</a>
|
||||
</li>
|
||||
<li t-if="uid == question.user_id.id and not question.active">
|
||||
<a class="text-muted fa fa-trash-o" t-attf-href="/forum/#{ slug(forum) }/undelete/question/#{ question.id }">undelete</a>
|
||||
<li t-if="uid == question.create_uid.id and not question.active">
|
||||
<a class="text-muted fa fa-trash-o" t-attf-href="/forum/#{ slug(forum) }/question/#{slug(question)}/undelete">undelete</a>
|
||||
</li>
|
||||
<li><a class="text-muted fa fa-share" href="">share</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<t t-call="website_forum.user_detail">
|
||||
<t t-set="user" t-value="question.user_id"/>
|
||||
<span class="text-muted">Asked on <span t-field="question.write_date" t-field-options='{"format":"short"}'/></span>
|
||||
</t>
|
||||
<span t-field="question.create_uid.image" t-field-options='{"widget": "image", "class":"pull-left img img-circle img-avatar"}'/>
|
||||
<div>
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/user/#{ user.id }"
|
||||
t-field="question.create_uid"
|
||||
t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
|
||||
style="display: inline-block;"/>
|
||||
<div t-field="question.create_uid" t-field-options='{"widget": "contact", "badges": true, "fields": ["karma"]}'/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-info" t-if="question.state == 'close'">
|
||||
<p class="mt32 mb32 text-center">
|
||||
<b>The question has been closed for the following reason "<span t-field="question.reason_id.name"/>"
|
||||
<i>by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(question.closed_by) }" t-field="question.closed_by.name"/> </i>
|
||||
<b>The question has been closed for the following reason "<span t-field="question.closed_reason_id.name"/>"
|
||||
<t t-if="question.closed_uid">
|
||||
<i>by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(question.closed_uid) }" t-field="question.closed_uid.name"/> </i>
|
||||
</t>
|
||||
<br/>close date <span t-field="question.closed_date"/></b>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<t t-call="website_forum.comments">
|
||||
<t t-call="website_forum.post_comment">
|
||||
<t t-set="object" t-value="question"/>
|
||||
</t>
|
||||
</div>
|
||||
|
@ -487,66 +488,74 @@
|
|||
<t t-set="post" t-value="answer"/>
|
||||
</t>
|
||||
<div class="text-muted">
|
||||
<a t-attf-id="#{answer.id}" t-if="answer.is_correct" class="accept_answer fa fa-2x fa-check-circle no-decoration oe_answer_true"/>
|
||||
<a t-attf-id="#{answer.id}" t-if="not answer.is_correct" class="accept_answer fa fa-2x fa-check-circle no-decoration oe_answer_false"/>
|
||||
<a t-attf-class="accept_answer fa fa-2x fa-check-circle no-decoration oe_answer_true #{answer.is_correct and 'oe_answer_true' or 'oe_answer_false'}"
|
||||
t-attf-data-forum-id="#{question.forum_id.id}" t-attf-data-post-id="#{answer.id}"
|
||||
t-attf-data-accept="#{answer.is_correct}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-left: 95px;" class="clearfix">
|
||||
<t t-raw="answer.content"/>
|
||||
<div class="mt16">
|
||||
<ul class="list-inline pull-right">
|
||||
<li t-if="user.id == answer.user_id.id or user.karma>=50">
|
||||
<li t-if="user.id == answer.create_uid.id or user.karma>=50">
|
||||
<a style="cursor: pointer" data-toggle="collapse" class="text-muted fa fa-comment-o"
|
||||
t-attf-data-target="#comment#{ answer._name.replace('.','') + '-' + str(answer.id) }">comment
|
||||
</a>
|
||||
</li>
|
||||
<li t-if="user.id == answer.user_id.id or user.karma>=300">
|
||||
<a class="text-muted fa fa-edit" t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/edit/#{ answer.id }">edit</a>
|
||||
<li t-if="user.id == answer.create_uid.id or user.karma>=300">
|
||||
<a class="text-muted fa fa-edit" t-attf-href="/forum/#{slug(forum)}/post/#{slug(answer)}/edit">edit</a>
|
||||
</li>
|
||||
<li t-if="user.id == answer.user_id.id or user.karma>=1000">
|
||||
<a class="text-muted delete fa fa-trash-o" href="" t-attf-id="#{answer.id}">delete</a>
|
||||
<li t-if="user.id == answer.create_uid.id or user.karma>=1000">
|
||||
<a class="text-muted fa fa-trash-o" t-attf-href="/forum/#{slug(forum)}/post/#{slug(answer)}/delete">delete</a>
|
||||
</li>
|
||||
<li t-if="user.id == answer.user_id.id">
|
||||
<a class="text-muted fa fa-magic" t-attf-href="/forum/#{ slug(forum) }/post/#{ answer.id }/converttocomment">Convert as a comment</a>
|
||||
<li t-if="user.id == answer.create_uid.id">
|
||||
<a class="text-muted fa fa-magic" t-attf-href="/forum/#{slug(forum)}/post/#{slug(answer)}/convert_to_comment">Convert as a comment</a>
|
||||
</li>
|
||||
<li><a class="text-muted fa fa-share" t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/#answer-#{ answer.id }">share</a></li>
|
||||
<li><a class="text-muted fa fa-share" t-attf-href="/forum/#{slug(forum)}/question/#{slug(question)}/#answer-#{ answer.id }">share</a></li>
|
||||
</ul>
|
||||
<t t-call="website_forum.user_detail">
|
||||
<t t-set="user" t-value="answer.user_id"/>
|
||||
<span t-field="answer.create_uid.image" t-field-options='{"widget": "image", "class":"pull-left img img-circle img-avatar"}'/>
|
||||
<div>
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/user/#{ user.id }"
|
||||
t-field="answer.create_uid"
|
||||
t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
|
||||
style="display: inline-block;"/>
|
||||
<div t-field="answer.create_uid" t-field-options='{"widget": "contact", "badges": true, "fields": ["karma"]}'/>
|
||||
<span class="text-muted">Answered on <span t-field="answer.create_date" t-field-options='{"format":"short"}'/></span>
|
||||
</t>
|
||||
</div>
|
||||
<t t-call="website_forum.comments">
|
||||
</div>
|
||||
<t t-call="website_forum.post_comment">
|
||||
<t t-set="object" t-value="answer"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="not answer_done">
|
||||
<div t-if="not question.uid_has_answered">
|
||||
<t t-call="website_forum.post_answer"/>
|
||||
</div>
|
||||
<div t-if="answer_done" class="mb16">
|
||||
<a class="btn btn-primary" t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/editanswer">Edit Your Previous Answer</a>
|
||||
<div t-if="question.uid_has_answered" class="mb16">
|
||||
<a class="btn btn-primary" t-attf-href="/forum/#{slug(forum)}/question/#{slug(question)}/edit_answer">Edit Your Previous Answer</a>
|
||||
<span class="text-muted">(only one answer per question is allowed)</span>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="comments">
|
||||
<!-- Utility template: Post a Comment -->
|
||||
<template id="post_comment">
|
||||
<div class="row clearfix">
|
||||
<div class="col-sm-10 col-sm-offset-2">
|
||||
<div t-foreach="reversed(object.website_message_ids)" t-as="message" id="comment" class="oe_comment_grey" style="padding: 4px;">
|
||||
<small class="text-muted">
|
||||
<button type="button" t-if="user.id == message.create_uid.id or user.karma>=750" t-att-id="message.id" class="close comment_delete">&times;</button>
|
||||
<button type="button" t-if="user.karma>=750" t-att-id="message.id" class="close comment_delete">&times;</button>
|
||||
<span t-field="message.body"/>
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/user/#{ message.create_uid.id }" t-field="message.create_uid"/>
|
||||
<a t-attf-href="/forum/#{slug(forum)}/user/#{message.id}"
|
||||
t-field="message.author_id" t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
|
||||
style="display: inline-block;"/>
|
||||
on <span t-field="message.date" t-field-options='{"format":"short"}'/>
|
||||
<a class="fa fa-magic text-muted pull-right" t-if="uid == message.create_uid.id"
|
||||
t-attf-href="/forum/#{ slug(forum) }/post/#{ object.id }/commet/#{ message.id }/converttoanswer">Convert as an answer</a>
|
||||
</small>
|
||||
</div>
|
||||
<div class="css_editable_mode_hidden">
|
||||
<form t-attf-id="comment#{ object._name.replace('.','') + '-' + str(object.id) }" class="collapse" t-attf-action="/forum/#{ slug(forum) }/comment" method="POST">
|
||||
<form t-attf-id="comment#{ object._name.replace('.','') + '-' + str(object.id) }" class="collapse"
|
||||
t-attf-action="/forum/#{slug(forum)}/question/#{slug(object)}/comment" method="POST">
|
||||
<input name="post_id" t-att-value="object.id" type="hidden"/>
|
||||
<textarea name="comment" class="form-control" placeholder="Comment this post..."/>
|
||||
<button type="submit" class="btn btn-primary mt8">Post</button>
|
||||
|
@ -554,9 +563,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="tag">
|
||||
<template id="tag">
|
||||
<t t-call="website_forum.header">
|
||||
<h1 class="mt0">
|
||||
Tags
|
||||
|
@ -577,9 +586,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="badge">
|
||||
<template id="badge">
|
||||
<t t-call="website_forum.header">
|
||||
<h1 class="mt0">
|
||||
Badges
|
||||
|
@ -607,9 +616,9 @@
|
|||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="badge_user">
|
||||
<template id="badge_user">
|
||||
<t t-call="website_forum.header">
|
||||
<h3 class="mt32 mb32">
|
||||
<b>Badge "<span t-field="badge.name"/>"</b>
|
||||
|
@ -633,35 +642,51 @@
|
|||
<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"/>
|
||||
<a t-attf-href="/forum/#{slug(forum)}/user/#{user.id}" t-field="user.name"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="users">
|
||||
<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" t-field-options='{"format":"short"}'/></span>
|
||||
<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/#{user.id}" t-field="user.name"/>
|
||||
<t t-if="user.country_id">
|
||||
<span t-field="user.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}'/>
|
||||
</t>
|
||||
<b><t t-esc="user.karma"/></b>
|
||||
<t t-raw="separator"/>
|
||||
<div>
|
||||
<b> badges:</b>
|
||||
<span class="fa fa-circle badge-gold"/>
|
||||
<t t-esc="user.gold_badge"/>
|
||||
<span class="fa fa-circle badge-silver"/>
|
||||
<t t-esc="user.silver_badge"/>
|
||||
<span class="fa fa-circle badge-bronze"/>
|
||||
<t t-esc="user.bronze_badge"/>
|
||||
</div>
|
||||
<t t-raw="0"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<t t-call="website.pager"/>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="edit_profile">
|
||||
<template id="edit_profile">
|
||||
<t t-call="website_forum.header">
|
||||
<h3>Edit Profile </h3>
|
||||
<div class="col-md-2">
|
||||
<span t-field="user.image" t-field-options='{"widget": "image", "class": "img img-responsive img-circle"}'/>
|
||||
</div>
|
||||
<form t-attf-action="/forum/#{ slug(forum) }/save/profile" method="post" role="form" class="form-horizontal">
|
||||
<form t-attf-action="/forum/#{slug(forum)}/user/#{slug(user)}/save" method="post" role="form" class="form-horizontal">
|
||||
<input name="user_id" t-att-value="user.id" type="hidden"/>
|
||||
<label class="col-md-2 control-label mb16" for="user.name">Real name</label>
|
||||
<div class="col-md-7 mb16">
|
||||
|
@ -699,9 +724,9 @@
|
|||
</div>
|
||||
</form>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="user_detail_full">
|
||||
<template id="user_detail_full">
|
||||
<t t-call="website_forum.header">
|
||||
<h1 class="mt0 page-header">
|
||||
<span t-field="user.name"/>
|
||||
|
@ -757,7 +782,7 @@
|
|||
<div class="well well-sm">
|
||||
<span t-field="user.partner_id.website_description"/>
|
||||
<t t-if="uid == user.id">
|
||||
<a class="fa fa-arrow-right" t-attf-href="/forum/#{ slug(forum) }/edit/profile/#{ user.id }"> Edit Your Bio</a>
|
||||
<a class="fa fa-arrow-right" t-attf-href="/forum/#{slug(forum)}/user/#{slug(user)}/edit"> Edit Your Bio</a>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -789,11 +814,11 @@
|
|||
<div class="tab-content mt16">
|
||||
<div class="tab-pane active" id="questions">
|
||||
<div class="mb16" t-foreach="questions" t-as="question">
|
||||
<t t-call="website_forum.post_list"/>
|
||||
<t t-call="website_forum.display_post"/>
|
||||
</div>
|
||||
</div><div class="tab-pane" id="answers">
|
||||
<div t-foreach="answers" t-as="answer">
|
||||
<t t-call="website_forum.post_list_answer"/>
|
||||
<t t-call="website_forum.display_post_answer"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="karma">
|
||||
|
@ -804,12 +829,12 @@
|
|||
</div>
|
||||
<div class="tab-pane" id="favourite_question">
|
||||
<div t-foreach="favourite" t-as="question">
|
||||
<t t-call="website_forum.post_list"/>
|
||||
<t t-call="website_forum.display_post"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="followed_question">
|
||||
<div t-foreach="followed" t-as="question">
|
||||
<t t-call="website_forum.post_list"/>
|
||||
<t t-call="website_forum.display_post"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="votes">
|
||||
|
@ -836,9 +861,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="user_badges">
|
||||
<template id="user_badges">
|
||||
<table class="table mt32 mb64">
|
||||
<tr t-foreach="user.badge_ids" t-as="badge">
|
||||
<td>
|
||||
|
@ -860,9 +885,9 @@
|
|||
<b>No badge yet!</b><br/>
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/badge" class="fa fa-arrow-right"> Check available badges</a>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template id="user_votes">
|
||||
<template id="user_votes">
|
||||
<div t-foreach="vote_post" t-as="vote">
|
||||
<t t-esc="vote.post_id.create_date"/>
|
||||
<span t-if="vote.vote == '1'" class="fa fa-thumbs-up text-success" style="margin-left:30px"/>
|
||||
|
@ -877,23 +902,7 @@
|
|||
<div class="mb16" t-if="not vote_post">
|
||||
<b>No vote given by you yet!</b>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="post_list_answer">
|
||||
<div class="clearfix">
|
||||
<div t-attf-class="pull-left text-center mb16 box #{len(answer.vote_ids) and 'oe_green' or 'oe_grey'}">
|
||||
<div t-esc="len(answer.vote_ids)"/>
|
||||
</div>
|
||||
<div class="question-name" style="margin-left: 32px;">
|
||||
<a style="font-size: 15px;" t-attf-href="/forum/#{ slug(forum) }/question/#{ answer.parent_id.id }/#answer-#{ answer.id }" t-esc="answer.parent_id.name"/>
|
||||
<t t-if="len(answer.website_message_ids)>0">
|
||||
(<t t-esc="len(answer.website_message_ids)"/>
|
||||
<t t-if="len(answer.website_message_ids)>1">Comments</t>
|
||||
<t t-if="len(answer.website_message_ids)<=1">Comment</t>)
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue