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

[DONE] Feature : Add sort videos and improve filters #811

Conversation

pampletousse
Copy link
Collaborator

@pampletousse pampletousse commented Apr 17, 2023

  • Add sort for /videos/ and /videos/my/ on date_added, title and duration + asc or desc
  • Manage refresh with filters, sort, categories and nextpage
  • Add lightweight, reusable and pure css loader
  • Add reset btn to filters aside
  • Light rework of categories style
  • Mutualized code (sort, filters) for 2 screens
  • Vanilla js code

@Badatos
Copy link
Collaborator

Badatos commented Apr 17, 2023

Tu as des erreurs d'accessibilité à corriger :

Errors in http://localhost:9090/videos/:

 • This checkboxinput element does not have a name available to an
   accessibility API. Valid names are: label element, title undefined,
   aria-label undefined, aria-labelledby undefined.

   (#sort_direction)

   <input id="sort_direction" type="checkbox" name="sort_direction"
   class="form-control" style="display:none;">

 • This form field should be labelled in some way. Use the label element
   (either with a "for" attribute or wrapped around the form field), or
   "title", "aria-label" or "aria-labelledby" attributes as appropriate.

   (#sort_direction)

   <input id="sort_direction" type="checkbox" name="sort_direction"
   class="form-control" style="display:none;">

 • This select element does not have a name available to an accessibility API.
   Valid names are: label element, title undefined, aria-label undefined,
   aria-labelledby undefined.

   (#sort)

   <select id="sort" name="sort" class="form-select sort-select"> <option
   value="title">Titr...</select>

 • This form field should be labelled in some way. Use the label element
   (either with a "for" attribute or wrapped around the form field), or
   "title", "aria-label" or "aria-labelledby" attributes as appropriate.

   (#sort)

   <select id="sort" name="sort" class="form-select sort-select"> <option
   value="title">Titr...</select>

@pampletousse pampletousse changed the title [DONE] Feature : Add sort videos and improve filters [WIP] Feature : Add sort videos and improve filters Apr 19, 2023
@pampletousse pampletousse changed the title [WIP] Feature : Add sort videos and improve filters [DONE] Feature : Add sort videos and improve filters Apr 21, 2023
@pampletousse
Copy link
Collaborator Author

Un dernier commentaire sur le commit [86dc3c1] : Lorsque qu'on applique des filtres à la liste des videos, puis change de page, puis revient sur la liste en utilisant le bouton "Précédant" du navigateur, seule la liste des vidéos était visible sans le template. En gros la réponse json sur fond blanc, sans style et sans l'interface complète de Pod. Un paramètre relatif au cache dans la fonction fetch (asynchrone javascript) permet d'éviter cela.

pod/main/static/js/main.js Outdated Show resolved Hide resolved
@pampletousse pampletousse force-pushed the pampletousse/feature-add_sort_videos_and_improve_filters branch from e43e6c8 to 4b78d06 Compare April 21, 2023 10:59
@pampletousse pampletousse changed the title [WIP] Feature : Add sort videos and improve filters [DONE] Feature : Add sort videos and improve filters Apr 21, 2023
Copy link
Collaborator

@SebastienCozeDev SebastienCozeDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AymericJak et moi avons tester en local. Tout fonctionne correctement.

Il serait intéressant d'effacer le contenu du champ Rechercher dans le filtre par utilisateur lorsque l'on appuie sur le bouton Reset.

Selon nous, il reste quelques petits changement à faire :

Copy link
Collaborator

@Badatos Badatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cette fois tout est bon pour moi.
Un grand Merci @pampletousse pour cette belle PR qui sera à n'en pas douter très utile !

Copy link
Collaborator

@SebastienCozeDev SebastienCozeDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AymericJak et moi validons cette PR. Tout fonctionne bien en local de notre côté.

@pampletousse
Copy link
Collaborator Author

@AymericJak @SebastienCozeDev Je viens d'ajouter le comportement que vous vouliez : un reset des champs de recherche par user au click du bouton

Copy link
Contributor

@ptitloup ptitloup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok pour moi

@ptitloup ptitloup merged commit 8f2c9d5 into EsupPortail:develop May 2, 2023
vsabatie pushed a commit to vsabatie/Pod that referenced this pull request May 2, 2023
* Add sort managment for video list in video backend and refactor functions

* Add sort form html file and inject it on videos.html screen

* Add sorting direction gesture, externalize url creation for refresh, externalize getNextPage, change next_page to var nextPage, change listeners

* Fix boolean nextPage, fix count refresh not working, fix outerHTML -> innerHTML inject method, delete some unused code => (filter and sort async working on /videos/)

* Add (global and reusable) pure css loader to improve ux on refresh on base.html template, add and change comments in javascript file

* Ajust columns to sort form fitted with Title and stats

* Add sort and filter management for video list in video/my/ backend with same logic as /videos/ and mutualized functions

* Make filter_aside template reusable by /videos/ and /video/my/ and import category management if needed, delete old loader

* Add sort template to video/my screen

* Add count vidéos h2 on my videos template

* Make columns for sort input and count videos in my_videos template

* Fix no video case for video/my screen and create function to enable/disable inputs on loading, clean unused function js

* Fix categories : prevent buttons to reload page, clean print

* Fix categories : add category to parameter url, call refresh after select category, clean video_category javascript file

* Add comments on filter aside video list refresh javascript file

* Add reset Filters Btn and rename vars, clean code

* Invert alert info and row -> weird placement on page load

* Fix auto-check inputs on my_videos screen with get parameters

* Simplify code for user search and start to mutualize function shared with user search in menu aside + delete print in views

* Add listener on new created inputs for user search + clean many "this" on code

* Simplified and factorized code for user search (menu aside + filter aside) => same ajax call, same function, different html elements creation

* Add timeout to fix 'database table is locked' on test job

* Test with larger timeout

* Add labels for inputs, prepare string to translation

* Update traductions for sort form

* Change span to label for accessibility + update translations files

* Use mutualized lds-ring

* Fix/simplify loader css to be reusable and accessible in main/base.html template

* Delete unecessary change of block page_content in base.html = loader is now accessible via include tag

* Add some translation, Repair translation files excluding custom/*

* Fix return (previous page) for only giving json response without global template

* Change accordion id to pod_users_list

* Add pydocs for new functions in video.views file

* Fix accessibility problem on label "sort_direction"

* Change selector for searchCatInput querySelector -> getElementById

* Add debug class on content in {% comment %} blocks

* Fix loader selector on video_category javascript file

* Change aria-labbelledby for category modal, improve accessibility

* Add function to change title of sort_direction input : improve accessibility

* Add label to loader : improve accessibility

* Fix aria labelledby for manageCategoryModal

* Fix redondant code for nextPage affectation

* Update translations in django.po files

* Update compiled file for translation django.mo

* Add pydoc on get_Videos_list()

* Change translated title from sort_direction to sort_direction_label

* Fix translations for sort

* Add translation for 'Reset'

* Update compiled messages file .mo

* Change var nextPage (lost commit)

* Change columns size (cf Olivier Bado / badatos's comment) for /videos/ screen

* Add missing translation for Descending sort

* Add reset of user filter fields

---------

Co-authored-by: pampletousse <sylvain.loppin@grenet.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants