[FIX] website_forum: various fixes and usability improvements

- 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
This commit is contained in:
Thibault Delavallée 2014-04-23 16:20:34 +02:00
parent f53ecc076a
commit 252be1b9ab
2 changed files with 9 additions and 4 deletions

View 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) {

View 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>
@ -414,7 +414,7 @@
</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>