Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MERGE][REF] website_slides: handle uncategorized slides / refactor reordering #31269

Closed
wants to merge 4 commits into
base: saas-12.2
from

Conversation

Projects
None yet
4 participants
@awa-odoo
Copy link
Contributor

awa-odoo commented Feb 20, 2019

Purpose

This commit has 2 main purposes:

Refactor slides reordering

Refactor the way slides and channels are reordered in the frontend
course view (training courses).

The use of jqueryui's "sortable" widget makes it easier and more user friendly to
drag and drop both sections and slides to reorganize your course.

Handle uncategorized slides

Add the management and display of uncategorized slides
for both the frontend publishing management and the fullscreen
course views.

We add a "Uncategorized" section on top of all the categories that is
hidden for the student if it's empty.

Course publishers can drag and drop slides from and to that
new "Uncategorized" section to easily reorganize the course.

@robodoo robodoo added the CI 🤖 label Feb 20, 2019

@C3POdoo C3POdoo added the RD label Feb 20, 2019

@awa-odoo awa-odoo force-pushed the odoo-dev:12.2-slides-ref-frontend-reordering-awa branch Feb 21, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Feb 21, 2019

@awa-odoo awa-odoo force-pushed the odoo-dev:12.2-slides-ref-frontend-reordering-awa branch Feb 22, 2019

@robodoo robodoo removed the CI 🤖 label Feb 22, 2019

@awa-odoo awa-odoo changed the title [REF] website_slides: refactor the reordering of slides/channels [MERGE][REF] website_slides: handle uncategorized slides / refactor reordering Feb 22, 2019

@robodoo robodoo added the CI 🤖 label Feb 22, 2019

@awa-odoo awa-odoo force-pushed the odoo-dev:12.2-slides-ref-frontend-reordering-awa branch Feb 22, 2019

@robodoo robodoo removed the CI 🤖 label Feb 22, 2019

@tde-banana-odoo
Copy link
Contributor

tde-banana-odoo left a comment

Vendredi matin review !

addons/website_slides/controllers/main.py Outdated
def resequence_slides(self, slides_data=None):
slides_channel = None
slides = request.env['slide.slide'].browse([int(key) for key in slides_data.keys()])
for slide in slides:

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

Read better with "if any(not slide.channel_id.can_publish for slide in slides)"

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Method now receives channel_id so it's even better.

addons/website_slides/static/src/js/slides_course_slides_list.js Outdated
*
* @private
*/
_updateHref: function () {

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

Small comment is welcome 👯

link-to-slide -> o_wslides_slides_list_href ?

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Done.

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

(to "o_wslides_slides_list_slide_link")

addons/website_slides/static/src/js/slides_course_slides_list.js Outdated
* @private
*/
_bindSortable: function () {
this.$('ul.o_wslides_channel').sortable({

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

o_wslides_slides_list_container ?

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Done.

addons/website_slides/controllers/main.py Outdated
'sequence': slide['sequence'],
'category_id': slide['category_id']
})
def resequence_slides(self, slides_data=None):

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

/slides/channel/resequence ?

Take channel_id and data for resequence. (other comments sould be updated accordingly, i have la flemme)

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Done.

* @private
*/
_getSlides: function (){

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

Side comment: we could imagine ordering methods by name so that "that team" will not scream too much.

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

"That team" should be significantly happier now.

addons/website_slides/views/website_slides_templates_course.xml Outdated
@@ -243,54 +243,86 @@
</t>
</template>

<template id="course_content_training_slide" name="Slide template for a traning channel">
<li t-att-index="j" t-attf-slide_id="#{slide.id}" t-attf-category_id="#{category.id if category else None}" class="content-slide slide-draggable d-flex justify-content-between align-items-center p-2">

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

j ? Try to remove if possible (or find a real name, like slide_index ).

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Removed j and also removed a i somewhere.
(There are still some i left to clean I think 👮 )

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Nevermind, I'm putting "i" back as fullscreen JS strangely uses that "index" information A LOT.
Tried to change it but honestly the code is brainfucking me so I'll let qmo remove/clean it.

addons/website_slides/views/website_slides_templates_course.xml Outdated
@@ -243,54 +243,86 @@
</t>
</template>

<template id="course_content_training_slide" name="Slide template for a traning channel">

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

course_slides_list_slide

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Done.

addons/website_slides/views/website_slides_templates_course.xml Outdated
<li t-att-index="j" t-attf-slide_id="#{slide.id}" t-attf-category_id="#{category.id if category else None}" class="content-slide slide-draggable d-flex justify-content-between align-items-center p-2">
<div class="content-slide-infos ml-2">
<i t-if="channel.can_publish" class="fa fa-arrows mr-2 text-muted"></i>
<i t-if="slide.slide_type == 'document'" class="fa fa-file-pdf-o mr-2 text-muted"></i>

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

A small tool template slide_icon ?

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

I did that AND I overrode it correctly in website_slides_survey to handle 'certification', call me super-modular-men

addons/website_slides/views/website_slides_templates_course.xml Outdated
</li>
</template>

<template id="course_content_training_category" name="Category template for a training channel">

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

course_slides_list_category

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Done.

addons/website_slides/views/website_slides_templates_course.xml Outdated
t-att-data-can-upload="channel.can_upload"
t-att-data-can-publish="channel.can_publish">+</a>
</template>

<template id="course_content_training" name="Content of a training channel">

This comment has been minimized.

@tde-banana-odoo

tde-banana-odoo Feb 22, 2019

Contributor

course_slides_list

This comment has been minimized.

@awa-odoo

awa-odoo Feb 22, 2019

Author Contributor

Done but "website_slides.course_content_documentation" should probably be cleaned too, I leave it to you.

@robodoo robodoo added the CI 🤖 label Feb 22, 2019

@awa-odoo awa-odoo force-pushed the odoo-dev:12.2-slides-ref-frontend-reordering-awa branch Feb 22, 2019

@robodoo robodoo removed the CI 🤖 label Feb 22, 2019

[REF] website_slides: refactor the reordering of slides/channels
Purpose
=======

This commit refactors the way slides and channels are reordered in the frontend
course view (training courses).

The use of jqueryui's "sortable" widget makes it easier and more user friendly to
drag and drop both sections and slides to reorganize your course.

@awa-odoo awa-odoo force-pushed the odoo-dev:12.2-slides-ref-frontend-reordering-awa branch Feb 22, 2019

[FIX] website_slides: handle uncategorized slides
Purpose
=======

This commit adds the management and display of uncategorized slides
for both the frontend publishing management and the fullscreen
course views.

We add a "Uncategorized" section on top of all the categories that is
hidden for the student if it's empty.

Course publishers can drag and drop slides from and to that
new "Uncategorized" section to easily reorganize the course.

@awa-odoo awa-odoo force-pushed the odoo-dev:12.2-slides-ref-frontend-reordering-awa branch Feb 22, 2019

awa-odoo added some commits Feb 22, 2019

[REF] website_slides: introduce a slide_icon template
Purpose
=======

This commit introduces an icon template to factorize some xml code.
It also correctly overrides this template in website_slides_survey to add
the 'certification' case.
[REF] website_slides: refactor some value attributes to data attributes
Purpose
=======

This commit changes some "t-att-xxx" to "t-att-data-xxx" so that the JS
side may use the "data" method on elements.

It is still a work in progress as we only clean some of the attributes
used in the newly refactored slides JS files.

@awa-odoo awa-odoo force-pushed the odoo-dev:12.2-slides-ref-frontend-reordering-awa branch to 9dad84a Feb 22, 2019

@robodoo robodoo added the CI 🤖 label Feb 22, 2019

@tde-banana-odoo

This comment has been minimized.

Copy link
Contributor

tde-banana-odoo commented Feb 25, 2019

Integrated in #31394 .

@robodoo robodoo added closed 💔 and removed CI 🤖 labels Feb 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.