diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index 58c6ea3cf20..a659eaf2911 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -125,6 +125,7 @@ class Forum(models.Model): karma_dofollow = fields.Integer(string='Nofollow links', help='If the author has not enough karma, a nofollow attribute is added to links', default=500) karma_editor = fields.Integer(string='Editor Features: image and links', default=30, oldname='karma_editor_link_files') + karma_user_bio = fields.Integer(string='Display detailed user biography', default=750) @api.one @api.constrains('allow_question', 'allow_discussion', 'allow_link', 'default_post_type') @@ -316,6 +317,7 @@ class Post(models.Model): can_comment = fields.Boolean('Can Comment', compute='_get_post_karma_rights') can_comment_convert = fields.Boolean('Can Convert to Comment', compute='_get_post_karma_rights') can_view = fields.Boolean('Can View', compute='_get_post_karma_rights') + can_display_biography = fields.Boolean('Can userbiography of the author be viewed', compute='_get_post_karma_rights') @api.multi def _get_post_karma_rights(self): @@ -344,6 +346,7 @@ class Post(models.Model): post.can_comment = is_admin or user.karma >= post.karma_comment post.can_comment_convert = is_admin or user.karma >= post.karma_comment_convert post.can_view = is_admin or user.karma >= post.karma_close or post_sudo.create_uid.karma > 0 + post.can_display_biography = is_admin or post_sudo.create_uid.karma >= post.forum_id.karma_user_bio @api.one @api.constrains('post_type', 'forum_id') diff --git a/addons/website_forum/static/src/css/website_forum.css b/addons/website_forum/static/src/css/website_forum.css index 2e1a4ebaa38..3a6deee2560 100644 --- a/addons/website_forum/static/src/css/website_forum.css +++ b/addons/website_forum/static/src/css/website_forum.css @@ -45,11 +45,15 @@ height: auto !important; } -img.img-avatar { +img.o_forum_avatar { max-height: 40px; margin-right: 10px; } +img.o_forum_avatar_big { + max-width: 75px; + margin-right: 10px; } + .oe_grey { background-color: #eeeeee; } @@ -143,3 +147,27 @@ button.btn-link.text-muted { color: #999; } +.o_forum_user_bio_expand { + position: absolute; + z-index: 200; + display: none; } + +.o_forum_tooltip_heading { + padding: 0px; + margin: 0px; + font-size: 18px; } + +.o_forum_user_bio { + color: black; + width: 318px; + min-height: 100px; + cursor: auto; + border: 1px solid darkgray; + background-color: whitesmoke; + line-height: 13px; + font-size: 11px; + word-wrap: break-word; } + .o_forum_user_bio .o_forum_tooltip_line { + min-height: 13px; } + .o_forum_user_bio .o_forum_tooltip_header { + min-height: 75px; } diff --git a/addons/website_forum/static/src/css/website_forum.sass b/addons/website_forum/static/src/css/website_forum.sass index 4cfa6e97c74..3e2fa55557f 100644 --- a/addons/website_forum/static/src/css/website_forum.sass +++ b/addons/website_forum/static/src/css/website_forum.sass @@ -36,10 +36,14 @@ max-width: 600px height: auto !important -img.img-avatar +img.o_forum_avatar max-height: 40px margin-right: 10px +img.o_forum_avatar_big + max-width: 75px + margin-right: 10px + .oe_grey background-color: #eeeeee @@ -112,3 +116,28 @@ a.no-decoration button.btn-link.text-muted color: #999 + +.o_forum_user_bio_expand + position: absolute + z-index: 200 + display: none + +.o_forum_tooltip_heading + padding: 0px + margin: 0px + font-size: 18px + +.o_forum_user_bio + color: black + width: 318px + min-height: 100px + cursor: auto + border: 1px solid darkgray + background-color: whitesmoke + line-height: 13px + font-size: 11px + word-wrap: break-word + .o_forum_tooltip_line + min-height: 13px + .o_forum_tooltip_header + min-height: 75px diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js index e3cb3d38d20..a0be5e8cef9 100644 --- a/addons/website_forum/static/src/js/website_forum.js +++ b/addons/website_forum/static/src/js/website_forum.js @@ -28,6 +28,23 @@ if(!$('.website_forum').length) { } }); + // Extended user biography toogle + $('.o_forum_user_info').hover( + function () { + $(this).parent().find('.o_forum_user_bio_expand').delay(500).toggle('fast'); + }, + function () { + $(this).parent().find('.o_forum_user_bio_expand').clearQueue(); + } + ); + + $('.o_forum_user_bio_expand').hover( + function () {}, + function () { + $(this).fadeOut('fast'); + } + ); + $('.vote_up,.vote_down').not('.karma_required').on('click', function (ev) { ev.preventDefault(); var $link = $(ev.currentTarget); diff --git a/addons/website_forum/views/ir_qweb.xml b/addons/website_forum/views/ir_qweb.xml index 04188b54234..5b236210efa 100644 --- a/addons/website_forum/views/ir_qweb.xml +++ b/addons/website_forum/views/ir_qweb.xml @@ -4,6 +4,12 @@
+
+
+ + + +
@@ -16,7 +22,18 @@
+
+
+ , +
+
+ + + + + +
diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 44919b4e886..ecb3765b2fe 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -287,6 +287,9 @@ insert text link, upload files + + + your biography can be seen as tooltip delete own comment @@ -811,7 +814,12 @@
- +
+ +
+ + + +