[imp]:improve activity search or improve string or remove unused string
authorSunil Sharma <ssh@tinyerp.com>
Thu, 10 Apr 2014 06:04:00 +0000 (11:34 +0530)
committerSunil Sharma <ssh@tinyerp.com>
Thu, 10 Apr 2014 06:04:00 +0000 (11:34 +0530)
bzr revid: ssh@tinyerp.com-20140410060400-blapg8mz6kw5bvoi

addons/website_forum/controllers/main.py
addons/website_forum/static/src/js/website_forum.js
addons/website_forum/views/website_forum.xml

index d2d44f9..968b26f 100644 (file)
@@ -257,7 +257,7 @@ class website_forum(http.Controller):
 
         #activity by user.
         model, comment = Data.get_object_reference(cr, uid, 'mail', 'mt_comment')
-        activity_ids = Activity.search(cr, uid, [('res_id', 'in', user_post_ids), ('model', '=', 'website.forum.post'), '|', ('subtype_id', '!=', comment), ('subtype_id', '=', False)], context=context)
+        activity_ids = Activity.search(cr, uid, [('res_id', 'in', user_post_ids), ('model', '=', 'website.forum.post'), ('subtype_id', '!=', comment)], context=context)
         activities = Activity.browse(cr, uid, activity_ids, context=context)
 
         posts = {}
@@ -398,7 +398,7 @@ class website_forum(http.Controller):
             'content': post.get('content'),
         }
         question_tags = []
-        if post.get('question_tag').strip('[]'):
+        if post.get('question_tag') and post.get('question_tag').strip('[]'):
             Tag = request.registry['website.forum.tag']
             tags = post.get('question_tag').strip('[]').replace('"','').split(",")
             for tag in tags:
index 0cf1439..907e5d4 100644 (file)
@@ -75,7 +75,7 @@ $(document).ready(function () {
                     } else if (data['error'] == 'user'){
                         var $warning = $('<div class="alert alert-danger alert-dismissable" id="correct_answer_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
                             '<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
-                            'Sorry, You cannot choose correct answer.'+
+                            'Sorry, the user who asked this question can only accept the answer as correct.'+
                             '</div>');
                     }
                     correct_answer_alert = $link.parent().find("#correct_answer_alert");
index 3d8bad7..be95d3f 100644 (file)
                     <div class="tab-pane" id="activity">
                         <ul class="list-unstyled">
                             <li t-foreach="activities" t-as="activity">
-                                <span t-esc="activity.date"/>
+                                <span t-field="activity.date" t-field-options='{"format": "short"}'/>
                                 <span t-esc="activity.subtype_id.name" class="label label-info"/>
                                 <t t-set="post" t-value="posts[activity.res_id]"/>
                                 <span t-if="post[1]"> 
                                     <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }#answer-#{ str(post[1].id) }">
-                                        Gave an answer
-                                    </a> on
+                                        <span t-esc="post[0].name"/>
+                                    </a>
+                                </span>
+                                <span t-if="not post[1]">
+                                    <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }">
+                                        <span t-esc="post[0].name"/>
+                                    </a>
                                 </span>
-                                <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }">
-                                    <span t-esc="post[0].name"/>
-                                </a>
                             </li>
                         </ul>
                     </div>