[FIX] website_forum: various fixes and usability improvements
authorThibault Delavallée <tde@openerp.com>
Wed, 23 Apr 2014 14:20:34 +0000 (16:20 +0200)
committerThibault Delavallée <tde@openerp.com>
Wed, 23 Apr 2014 14:20:34 +0000 (16:20 +0200)
- question title is now a link
- fixed a crash when trying to see badges in the 'new badge' notification
- improved the tags manager: manage tag at blur event (otherwise the last tag
was ften not created) + manage already-existing tags

bzr revid: tde@openerp.com-20140423142034-5si58h4jgd1jyyem

addons/website_forum/static/src/js/website_forum.js
addons/website_forum/views/website_forum.xml

index 9053c57..e84e76e 100644 (file)
@@ -129,11 +129,16 @@ $(document).ready(function () {
                 cacheResults: true
             }
         });
-        // Note: Adding event handler of whitespaceKeyDown event.
-        $("input.load_tags").bind("whitespaceKeyDown",function () {
+        // Adds: create tags on space + blur
+        $("input.load_tags").on('whitespaceKeyDown blur', function () {
             $(this).textext()[0].tags().addTags([ $(this).val() ]);
             $(this).val("");
         });
+        $("input.load_tags").on('isTagAllowed', function(e, data) {
+            if (_.indexOf($(this).textext()[0].tags()._formData, data.tag) != -1) {
+                data.result = false;
+            }
+        });
     }
 
     if ($('textarea.load_editor').length) {
index 9af62b8..8e01555 100644 (file)
@@ -80,7 +80,7 @@
                     <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">&amp;times;</button>
                         <div t-field="notification.body"/>
-                        <a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(user) }#badges" class="fa fa-arrow-right">View Your Badges</a>
+                        <a t-attf-href="/forum/#{ slug(forum) }/user/#{ user.id }#badges" class="fa fa-arrow-right">View Your Badges</a>
                     </div>
                     <t t-raw="0"/>
                 </div>
             </div>
             <div style="margin-left: 95px;">
                 <h1 class="mt0">
-                    <span t-field="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>
                 </h1>