Closed jmontoyaa closed 1 year ago
Add a display_order
int field in the resource_link
table to allow resources to be sorted in any specific context (for the same c_id + session_id + group_id, the display_order should be configurable).
This implies managing correctly actions like moveUp()
, moveDown()
, delete()
, add()
, etc, so they always update the display_order
correctly.
By default, add
should add the new resource at the end of the display_order
(MAX(display_order) + 1), while delete
should remove the resource and make a moveUp()
for all the following resources, as the deleted resource has freed one display_order from the list.
It is added field display_order in this PR https://github.com/chamilo/chamilo-lms/pull/4636
Thanks for confirmation.
Hola @christianbeeznest Quisiera que revisaras https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/doc/sortable.md (sugerido por Angel) para hacer el ordenamiento en vez de hacerlo a mano. Ya usamos doctrine-extensions, así que no introduce ninguna dependencia adicional, y sería más sano poder basarnos en esta para el largo plazo.
Hi @ywarnier
It is added the sortable in this PR https://github.com/chamilo/chamilo-lms/pull/4728
Thank you.
Hi @christianbeeznest I've tried your PR and I can see that resource_link.display_order is added and gets a value when creating a course and creating resources in the course but the values are a bit strange for the moment. To have a first test case to validate the implementation could you make the course tool sortable in the course home page. For example on the page https://testing25.beeznest.com/course/1/home?cid=1&sid=0&gid=0 we have a sort tab : When clicking on the sort tab you should add the arrows to move the icons up or down, or even better a drag and drop possibility to reorder the tools. @daniboygg could help you on the interfaz design and view implementation for this part once you have the services ready for tools ordering.
Once this test case is ready we would be able to test the implementation of the resource ordering and validate the PR.
@NicoDucou sure! I can help with this. But I have a couple of questions for @christianbeeznest:
../course/${courseId}/home.json
(https://github.com/daniboygg/chamilo-lms/blob/master/assets/vue/views/course/CourseHome.vue#LL220C22-L220C53). I cannot see the documentation about this webservice in https://2.chamilo.org/api/, is this the right call for retrieving this?Hi @daniboygg
Yes, the endpoint to retrieve the course is ../course/${courseId}/home.json . I think from course home when the tool icons are moved it should send the current positions to that path, so it could be updated in the database with some changes in backend (I could check that part).
Ref order in backend, I added the field display_order in ResourceNode entity using doctrine Sortable, so each item created by course (link, exercise, learnpath, etc) has a position automatically, the same case when it is removed the position is reordered, but it is not implemented to move still. The PR about is https://github.com/chamilo/chamilo-lms/pull/4746/commits/119e3586c36d1f3e687764af4f67ab604d3a715e
It is added the order for ctools in this PR https://github.com/chamilo/chamilo-lms/pull/4765
All good for me, it works fine in the course homepage for tool ordening. I accepted the final PR and I'm closing this task. Good work.
Being able to order a list of resources