[MIG] disable_fullscreen_slides: migration to 18.0

and full refactoring
This commit is contained in:
Stéphan Sainléger
2026-03-29 15:21:08 +02:00
parent 1da9f11452
commit 0be3c951a0
16 changed files with 66 additions and 224 deletions

View File

@@ -0,0 +1,57 @@
# Disable Fullscreen Slides
Disables automatic full-screen video opening on eLearning website pages.
## Description
When navigating an eLearning course on an Odoo website, clicking on a video
slide automatically opens it in fullscreen mode. This module disables that
behavior by overriding the `websiteSlidesCourseSlidesList` widget from
`website_slides` and removing the `_updateHref()` function responsible for
the fullscreen redirect.
## Installation
Install this module using the standard Odoo module installation procedure.
### Dependencies
- `base`
- `website_slides`
- `web`
## Configuration
No configuration is needed. The module works out of the box once installed.
## Usage
Once installed, video slides in eLearning courses will open inline instead
of switching to fullscreen mode. No user action is required.
## Known Issues / Roadmap
None yet.
## Bug Tracker
Bugs are tracked on the
[project issue tracker](https://git.elabore.coop/Elabore/website-tools/issues).
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us fix it by providing detailed feedback.
## Credits
### Contributors
- [Elabore](https://elabore.coop)
### Funders
The development of this module has been financially supported by:
- [Elabore](https://elabore.coop)
### Maintainer
This module is maintained by [Elabore](https://elabore.coop).

View File

@@ -14,7 +14,7 @@ Description
===========
disables automatique full-screen while opening a video in elearning website pages
by overwriting website_slides/js/slides_course_page/slides_course_slides_liste.js
and _updateHref() fonction
and _updateHref() fonction
Known issues / Roadmap
======================

View File

@@ -3,7 +3,7 @@
{
"name": "disable_fullscreen_slides",
"version": "16.0.1.0.0",
"version": "18.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Elabore",
@@ -38,4 +38,4 @@
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}
}

View File

@@ -1,4 +0,0 @@
## package holder
import main

View File

@@ -1,36 +0,0 @@
# -*- coding: utf-8 -*-
import logging
import odoo
import odoo.modules.registry
from odoo.modules import get_module_resource
from odoo.tools.translate import _
from odoo import http
from odoo.http import request, serialize_exception as _serialize_exception
_logger = logging.getLogger(__name__)
##
## Web Controllers
##
# class Main(http.Controller):
#
# @http.route('/disable_fullscreen_slides', type='http', auth="none")
# def index(self, s_action=None, db=None, **kw):
# return http.local_redirect('/web', query=request.params, keep_hash=True)
#
# @http.route([
# '/disable_fullscreen_slides/<xmlid>',
# '/disable_fullscreen_slides/<xmlid>/<version>',
# ], type='json', auth="user")
# def load_needaction(self, menu_ids):
# """ Loads needaction counters for specific menu ids.
#
# :return: needaction data
# :rtype: dict(menu_id: {'needaction_enabled': boolean, 'needaction_counter': int})
# """
# return request.session.model('ir.ui.menu').get_needaction_data(menu_ids, request.context)
#

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
</data>
</odoo>

View File

@@ -1 +0,0 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="1">
<!-- This file should contain only security objects
<record model="res.groups" id="base.group_disable_fullscreen_slides_user">
<field name="name">disable_fullscreen_slides / User</field>
</record>
<record model="res.groups" id="base.group__manager">
<field name="name"> / Manager</field>
<field name="implied_ids" eval="[(4, ref('base.group_disable_fullscreen_slides_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record id="disable_fullscreen_slides_users_access" model="ir.rule">
<field name="name">Access to disable_fullscreen_slides for regular users</field>
<field name="model_id" ref="disable_fullscreen_slides.model_disable_fullscreen_slides_disable_fullscreen_slides"/>
<field name="domain_force">[('stage_id.closed', '=', False)]</field>
<field name="groups" eval="[(4, ref('base.group_disable_fullscreen_slides_user'))]"/>
<field eval="0" name="perm_unlink"/>
<field eval="0" name="perm_write"/>
<field eval="1" name="perm_read"/>
<field eval="0" name="perm_create"/>
</record>
-->
</data>
</odoo>

View File

@@ -1,11 +0,0 @@
/**
* Main css of disable_fullscreen_slides addon.
*/
/*
.oe-disable_fullscreen_slides {
color: black
}
*/

View File

@@ -1,90 +1,12 @@
/** @odoo-module **/
import publicWidget from 'web.public.widget';
import { _t } from 'web.core';
import { SlideCoursePage } from '@website_slides/js/slides_course_page';
/** overwrite all website_slides/js/slides_course_page/slides_course_slides_liste.js to remove _updateHref()**/
publicWidget.registry.websiteSlidesCourseSlidesList = SlideCoursePage.extend({
selector: '.o_wslides_slides_list',
start: function () {
this._super.apply(this,arguments);
this.channelId = this.$el.data('channelId');
this._bindSortable();
},
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------,
import { patch } from "@web/core/utils/patch";
import websiteSlidesCourseSlidesList from "@website_slides/js/slides_course_slides_list";
patch(websiteSlidesCourseSlidesList.prototype, {
/**
* Bind the sortable jQuery widget to both
* - course sections
* - course slides
*
* @private
* Override to prevent fullscreen mode when clicking on slide links.
* The original method appends "fullscreen=1" to all slide hrefs.
*/
_bindSortable: function () {
this.$('ul.o_wslides_js_slides_list_container').sortable({
handle: '.o_wslides_slides_list_drag',
stop: this._reorderSlides.bind(this),
items: '.o_wslides_slide_list_category',
placeholder: 'o_wslides_slides_list_slide_hilight position-relative mb-1'
});
this.$('.o_wslides_js_slides_list_container ul').sortable({
handle: '.o_wslides_slides_list_drag',
connectWith: '.o_wslides_js_slides_list_container ul',
stop: this._reorderSlides.bind(this),
items: '.o_wslides_slides_list_slide:not(.o_wslides_js_slides_list_empty)',
placeholder: 'o_wslides_slides_list_slide_hilight position-relative mb-1'
});
},
/**
* This method will check that a section is empty/not empty
* when the slides are reordered and show/hide the
* "Empty category" placeholder.
*
* @private
*/
_checkForEmptySections: function (){
this.$('.o_wslides_slide_list_category').each(function (){
var $categoryHeader = $(this).find('.o_wslides_slide_list_category_header');
var categorySlideCount = $(this).find('.o_wslides_slides_list_slide:not(.o_not_editable)').length;
var $emptyFlagContainer = $categoryHeader.find('.o_wslides_slides_list_drag').first();
var $emptyFlag = $emptyFlagContainer.find('small');
if (categorySlideCount === 0 && $emptyFlag.length === 0){
$emptyFlagContainer.append($('<small>', {
'class': "ms-1 text-muted fw-bold",
text: _t("(empty)")
}));
} else if (categorySlideCount > 0 && $emptyFlag.length > 0){
$emptyFlag.remove();
}
});
},
_getSlides: function (){
var categories = [];
this.$('.o_wslides_js_list_item').each(function (){
categories.push(parseInt($(this).data('slideId')));
});
return categories;
},
_reorderSlides: function (){
var self = this;
self._rpc({
route: '/web/dataset/resequence',
params: {
model: "slide.slide",
ids: self._getSlides()
}
}).then(function (res) {
self._checkForEmptySections();
});
},
_updateHref() {},
});
export default publicWidget.registry.websiteSlidesCourseSlidesList;

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<!-- QWEB Templates for UI Widgets and views -->
<!--
<t t-name="disable_fullscreen_slidesView">
<div class="oe_disable_fullscreen_slides_view">
<div class="oe_disable_fullscreen_slides_buttons"/>>
<table class="oe_disable_fullscreen_slides_groups">
<tr class="oe_disable_fullscreen_slides_groups_headers">
<td class="oe_disable_fullscreen_slides_dummy_cell"><div/></td>
</tr>
<tr class="oe_disable_fullscreen_slides_dummy_row">
</tr>
</table>
</div>
</t>
-->
</templates>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!-- This file should contain only records from model ir.ui.view -->
<!-- Example:
<record id="view_sale_order_calendar" model="ir.ui.view">
<field name="name">sale.order.calendar</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<calendar string="Sales Orders" color="state" date_start="date_order">
<field name="partner_id"/>
<field name="amount_total"/>
</calendar>
</field>
</record>
-->
</data>
</odoo>