diff options
| author | qmo-odoo <qmo@odoo.com> | 2020-07-24 08:35:53 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-08-04 14:28:29 +0000 |
| commit | 10e162d3f16c6f8abc34d73ad5986a637ab4e7ca (patch) | |
| tree | 8cbc6271ab1451ff76b0c5c28c14627f15d3f9db /addons | |
| parent | 92caab190183aed30726e4251366f972d0c5755f (diff) | |
[ADD] website_event_meet_quiz: integrate quiz within meet "Community" page
RATIONALE
Events are sometimes held online, gathering a community. In this merge
we improve Event application to better support full-online events with
improved tracks, wishlists, chat rooms, ...
PURPOSE
This bridge module enables a better integration of the quiz features within the
website_event_meet "Community" frontend page.
SPECS
As both quiz and meet share the "Community" frontend page, this bridge adds a
small block on the existing meet template to display the top 3 of the quiz
leaderboard.
A link on that block allows users to reach the full leaderboard page where they
can see their own position and perform a simple search for other attendees.
LINKS
Task ID-2252655 (Main Online Event task)
Task ID-2283771 (Quizzes on Talks, Leaderboard)
Task ID-2283742 (Community gathering on chat rooms)
Co-Authored-By: Aurélien Warnon <awa@odoo.com>
Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Quentin Mourier <qmo@odoo.com>
Co-Authored-By: Stéphane Debauche <std@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Diffstat (limited to 'addons')
5 files changed, 76 insertions, 0 deletions
diff --git a/addons/website_event_meet_quiz/__init__.py b/addons/website_event_meet_quiz/__init__.py index 67dee8c60db..dd15b5c32e5 100644 --- a/addons/website_event_meet_quiz/__init__.py +++ b/addons/website_event_meet_quiz/__init__.py @@ -1,2 +1,4 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import controllers diff --git a/addons/website_event_meet_quiz/__manifest__.py b/addons/website_event_meet_quiz/__manifest__.py index 00e95e9faea..bc8d83d03d8 100644 --- a/addons/website_event_meet_quiz/__manifest__.py +++ b/addons/website_event_meet_quiz/__manifest__.py @@ -15,6 +15,7 @@ 'website_event_track_quiz', ], 'data': [ + 'views/event_meet_templates.xml', ], 'demo': [ ], diff --git a/addons/website_event_meet_quiz/controllers/__init__.py b/addons/website_event_meet_quiz/controllers/__init__.py new file mode 100644 index 00000000000..677fb9d9c1d --- /dev/null +++ b/addons/website_event_meet_quiz/controllers/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import community diff --git a/addons/website_event_meet_quiz/controllers/community.py b/addons/website_event_meet_quiz/controllers/community.py new file mode 100644 index 00000000000..5086a9e1881 --- /dev/null +++ b/addons/website_event_meet_quiz/controllers/community.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import http + +from odoo.addons.website_event_track_online.controllers.community import WebsiteEventCommunityController +from odoo.http import request +from werkzeug.exceptions import Forbidden + + +class WebsiteEventTrackQuizMeetController(WebsiteEventCommunityController): + + @http.route(['/event/<model("event.event"):event>/community'], type='http', auth="public", website=True, sitemap=False) + def community(self, event, page=1, lang=None, **kwargs): + if not event.can_access_from_current_website(): + raise Forbidden() + + # website_event_track_quiz + values = self._get_community_leaderboard_render_values(event, kwargs.get('search'), page) + + # website_event_meet + values.update(self._event_meeting_rooms_get_values(event, lang=lang)) + return request.render('website_event_meet.event_meet', values) diff --git a/addons/website_event_meet_quiz/views/event_meet_templates.xml b/addons/website_event_meet_quiz/views/event_meet_templates.xml new file mode 100644 index 00000000000..04b7be6b768 --- /dev/null +++ b/addons/website_event_meet_quiz/views/event_meet_templates.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> +<template id="community_aside" name="Community: Aside (Leaderboard)" + inherit_id="website_event_meet.community_aside"> + <xpath expr="//div[hasclass('o_wevent_community_aside')]" position="inside"> + <t t-if="top3_visitors" t-call="website_event_meet_quiz.community_leaderboard_small"/> + </xpath> +</template> + +<template id="community_leaderboard_small" name="Small Leaderboard"> + <div class="row"> + <div class="col"> + <div class="w-100 d-flex justify-content-between align-items-end o_page_header"> + <h1 class="m-0">Leaderboard</h1> + <a t-attf-href="#{'/event/%s/community/leaderboard' % (slug(event))}">View all</a> + </div> + </div> + </div> + <div class="row"> + <div class="col"> + <t t-foreach="top3_visitors" t-as="visitor"> + <t t-call="website_event_meet_quiz.visitor_quiz_points_card"/> + </t> + </div> + </div> +</template> + +<template id='visitor_quiz_points_card' name="User Quick Quiz Points Card"> + <div class="d-flex mb-3 align-items-center justify-content-between"> + <div class="d-flex align-items-center"> + <b class="mr-2 text-muted" t-esc="visitor['position']"/> + <img class="rounded-circle float-left" + style="width: 32px; height: 32px; object-fit: cover;" + t-att-src="image_data_uri(visitor['visitor'].partner_image) if visitor['visitor'].partner_image else '/web/static/src/img/user_placeholder.jpg'" + t-att-alt="visitor['visitor'].display_name"/> + <div style="line-height:1.3"> + <span class="font-weight-bold" t-esc="visitor['visitor'].display_name"/> + </div> + </div> + <div class="d-flex align-items-center"> + <span><t t-esc="visitor['points']"/> Points</span> + </div> + </div> +</template> + +</odoo> |
