Начальное наполнение
This commit is contained in:
parent
e33468ede9
commit
58d754a214
4
__init__.py
Normal file
4
__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import controllers
|
27
__manifest__.py
Normal file
27
__manifest__.py
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
|
||||
{
|
||||
'name': 'Quiz on Live Event Tracks',
|
||||
'category': 'Hidden',
|
||||
'version': '1.0',
|
||||
'summary': 'Bridge module to support quiz features during "live" tracks. ',
|
||||
'website': 'https://www.odoo.com/app/events',
|
||||
'depends': [
|
||||
'website_event_track_live',
|
||||
'website_event_track_quiz',
|
||||
],
|
||||
'data': [
|
||||
'views/event_track_templates_page.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'assets': {
|
||||
'web.assets_frontend': [
|
||||
'website_event_track_live_quiz/static/src/js/**/*',
|
||||
'website_event_track_live_quiz/static/src/xml/**/*',
|
||||
],
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
}
|
4
controllers/__init__.py
Normal file
4
controllers/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import track_live_quiz
|
12
controllers/track_live_quiz.py
Normal file
12
controllers/track_live_quiz.py
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.addons.website_event_track_live.controllers.track_live import EventTrackLiveController
|
||||
|
||||
|
||||
class EventTrackLiveQuizController(EventTrackLiveController):
|
||||
|
||||
def _prepare_track_suggestion_values(self, track, track_suggestion):
|
||||
res = super(EventTrackLiveQuizController, self)._prepare_track_suggestion_values(track, track_suggestion)
|
||||
res['current_track']['show_quiz'] = bool(track.quiz_id) and not track.is_quiz_completed
|
||||
return res
|
32
i18n/ru.po
Normal file
32
i18n/ru.po
Normal file
@ -0,0 +1,32 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * website_event_track_live_quiz
|
||||
#
|
||||
# Translators:
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 17.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-10-26 21:56+0000\n"
|
||||
"PO-Revision-Date: 2024-01-30 15:14+0400\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Russian (https://app.transifex.com/odoo/teams/41243/ru/)\n"
|
||||
"Language: ru\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
|
||||
|
||||
#. module: website_event_track_live_quiz
|
||||
#. odoo-javascript
|
||||
#: code:addons/website_event_track_live_quiz/static/src/xml/website_event_track_quiz_templates.xml:0
|
||||
#, python-format
|
||||
msgid "Next Track"
|
||||
msgstr "Следующий трек"
|
||||
|
||||
#. module: website_event_track_live_quiz
|
||||
#. odoo-javascript
|
||||
#: code:addons/website_event_track_live_quiz/static/src/xml/website_event_track_live_templates.xml:0
|
||||
#, python-format
|
||||
msgid "Take the Quiz"
|
||||
msgstr "Пройдите викторину"
|
30
i18n/website_event_track_live_quiz.pot
Normal file
30
i18n/website_event_track_live_quiz.pot
Normal file
@ -0,0 +1,30 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * website_event_track_live_quiz
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 17.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-10-26 21:56+0000\n"
|
||||
"PO-Revision-Date: 2023-10-26 21:56+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: website_event_track_live_quiz
|
||||
#. odoo-javascript
|
||||
#: code:addons/website_event_track_live_quiz/static/src/xml/website_event_track_quiz_templates.xml:0
|
||||
#, python-format
|
||||
msgid "Next Track"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_event_track_live_quiz
|
||||
#. odoo-javascript
|
||||
#: code:addons/website_event_track_live_quiz/static/src/xml/website_event_track_live_templates.xml:0
|
||||
#, python-format
|
||||
msgid "Take the Quiz"
|
||||
msgstr ""
|
48
static/src/js/event_quiz.js
Normal file
48
static/src/js/event_quiz.js
Normal file
@ -0,0 +1,48 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import Quiz from "@website_event_track_quiz/js/event_quiz";
|
||||
|
||||
var WebsiteEventTrackSuggestionQuiz = Quiz.include({
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
willStart: function () {
|
||||
return Promise.all([
|
||||
this._super(...arguments),
|
||||
this._getTrackSuggestion()
|
||||
]);
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
_submitQuiz: function () {
|
||||
var self = this;
|
||||
return this._super(...arguments).then(function (data) {
|
||||
if (data.quiz_completed) {
|
||||
self.$('.o_quiz_js_quiz_next_track')
|
||||
.removeClass('btn-light')
|
||||
.addClass('btn-secondary');
|
||||
}
|
||||
|
||||
return Promise.resolve(data);
|
||||
});
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Handlers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
_getTrackSuggestion: function () {
|
||||
var self = this;
|
||||
return this.rpc('/event_track/get_track_suggestion', {
|
||||
track_id: this.track.id,
|
||||
}).then(function (suggestion) {
|
||||
self.nextSuggestion = suggestion;
|
||||
return Promise.resolve();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export default WebsiteEventTrackSuggestionQuiz;
|
28
static/src/js/website_event_track_suggestion.js
Normal file
28
static/src/js/website_event_track_suggestion.js
Normal file
@ -0,0 +1,28 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import WebsiteEventTrackSuggestion from "@website_event_track_live/js/website_event_track_suggestion";
|
||||
|
||||
var WebsiteEventTrackSuggestionLiveQuiz = WebsiteEventTrackSuggestion.include({
|
||||
events: Object.assign({}, WebsiteEventTrackSuggestion.prototype.events, {
|
||||
'click .owevent_track_suggestion_quiz': '_onQuizClick'
|
||||
}),
|
||||
|
||||
init: function (parent, options) {
|
||||
this._super(...arguments);
|
||||
this.currentTrack.showQuiz = options.current_track.show_quiz;
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Handlers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* If the user takes the quiz, stop the next suggestion timer
|
||||
*/
|
||||
_onQuizClick: function () {
|
||||
clearInterval(this.timerInterval);
|
||||
this.$('.owevent_track_suggestion_timer_text_wrapper').remove();
|
||||
}
|
||||
});
|
||||
|
||||
export default WebsiteEventTrackSuggestionLiveQuiz;
|
14
static/src/xml/website_event_track_live_templates.xml
Normal file
14
static/src/xml/website_event_track_live_templates.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<t t-inherit="website_event_track_live.website_event_track_suggestion" t-inherit-mode="extension">
|
||||
<xpath expr="//a[hasclass('owevent_track_suggestion_replay')]" position="before">
|
||||
<a t-if="widget.currentTrack.showQuiz" class="btn btn-primary btn-lg me-2 owevent_track_suggestion_quiz"
|
||||
href="#we_track_quiz_container"
|
||||
onclick="$('.o_quiz_js_quiz_container').removeClass('d-none');">
|
||||
<span>Take the Quiz</span>
|
||||
</a>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</odoo>
|
14
static/src/xml/website_event_track_quiz_templates.xml
Normal file
14
static/src/xml/website_event_track_quiz_templates.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<t t-inherit="website_event_track_quiz.quiz.validation" t-inherit-mode="extension">
|
||||
<xpath expr="//button[hasclass('o_quiz_js_quiz_reset')]" position="after">
|
||||
<a t-if="widget.nextSuggestion"
|
||||
t-attf-class="btn border o_quiz_js_quiz_next_track #{widget.track.completed ? 'btn-secondary' : 'btn-light'}"
|
||||
t-att-href="widget.nextSuggestion.suggestion.website_url">
|
||||
Next Track
|
||||
</a>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</odoo>
|
12
views/event_track_templates_page.xml
Normal file
12
views/event_track_templates_page.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="event_track_content"
|
||||
name="Main Description: tweak quiz"
|
||||
inherit_id="website_event_track_quiz.event_track_content">
|
||||
<xpath expr="//div[hasclass('o_we_track_quiz_button')]" position="attributes">
|
||||
<attribute name="t-if">track.quiz_id and not track.is_quiz_completed and not track.is_track_upcoming and (not track.is_track_live or track.is_youtube_replay or not track.youtube_video_id)</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
Loading…
x
Reference in New Issue
Block a user