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
[REF] survey : use js widget and simplify validation and submit flow #32419
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbeguin
force-pushed
the
master-survey-js-great-again-dbe
branch
2 times, most recently
from
April 4, 2019 12:41
d102c7b
to
5a67b06
Compare
dbeguin
force-pushed
the
master-survey-js-great-again-dbe
branch
2 times, most recently
from
April 4, 2019 14:22
bf0c5ab
to
00477dd
Compare
dbeguin
force-pushed
the
master-survey-js-great-again-dbe
branch
from
April 4, 2019 14:28
00477dd
to
7a15cc2
Compare
dbeguin
force-pushed
the
master-survey-js-great-again-dbe
branch
from
April 5, 2019 09:15
cf8c2f5
to
7f73c9c
Compare
dbeguin
force-pushed
the
master-survey-js-great-again-dbe
branch
from
April 5, 2019 09:16
7f73c9c
to
4db1b83
Compare
dbeguin
force-pushed
the
master-survey-js-great-again-dbe
branch
from
April 5, 2019 11:10
4db1b83
to
1150d49
Compare
dbeguin
force-pushed
the
master-survey-js-great-again-dbe
branch
from
April 5, 2019 12:12
1150d49
to
bb982e4
Compare
dbeguin
force-pushed
the
master-survey-js-great-again-dbe
branch
from
April 5, 2019 13:40
bb982e4
to
817c903
Compare
robodoo
added
CI 🤖
Robodoo has seen passing statuses
and removed
CI 🤖
Robodoo has seen passing statuses
labels
Apr 8, 2019
dbeguin
added a commit
to odoo-dev/odoo
that referenced
this pull request
Nov 19, 2019
add is_time_limited in the reset values of the onchange. Tass ID : 1930132 PR odoo#32419
dbeguin
added a commit
to odoo-dev/odoo
that referenced
this pull request
Nov 19, 2019
Purpose of this commit is - to make the survey js controller a widget, to be more 'odoo-standard'. - to lessen number of RPCs and clean old code for prefilling and validation of surveys. Clean Prefill : Prefill can be done directly in the template as the template has already all the needed values (in answer object). Clean Validation : Validation is done at server side and is independant from prefilling values. Dates: Dates are now formatted directly in the template, at rendering, using a format_date fonction pointer called in the template. Don't use widget in review mode: Remove o_survey_form class from review template as only dates were processed in the widget for review template. Breadcrumb : Remove button previous, prev=prev and go_back mechanism : The previous page is handled by the breadcrump Remove redirect url mechanism. Breadcrumb now saves the answers when going to a previous page. Move o_survey_form class to a higher div to englobe breadcrumb in the widget and ease his handling. Remove locale load as already done in session.js#load_modules This commit modifies the route type of survey submit to work in json. The js survey form controller calls now manually the route via rpc. Task ID : 1930132 PR odoo#32419
dbeguin
added a commit
to odoo-dev/odoo
that referenced
this pull request
Nov 19, 2019
This commit simplifies the answer_tag and question name by removing the survey_id (uses now only question id) for the most simple cases Factorise the save and validate survey answers to avoid duplicate code Review posted submit data : - process all questions by question type (instead of using form data (key,value) that needed key parsing and was un-typed) - regroup answers by questions and adapt all validation and save flow - remove post data in save and validate question methods and uses directly the answer(s) - remove useless input names The tests have been adapted consequently Task ID : 1930132 PR odoo#32419
dbeguin
added a commit
to odoo-dev/odoo
that referenced
this pull request
Nov 19, 2019
This commit makes the survey timer js controller become a widget. This widget is called by the survey form widget. When the time is over, the widget triggers a time_up event instead of calling the submit. the time_up event is catched by the survey form widget that calls himself the submit, as the submit is on the form and not on the timer itself. Task ID : 1930132 PR odoo#32419
dbeguin
added a commit
to odoo-dev/odoo
that referenced
this pull request
Nov 19, 2019
This commit cake the survey result analysis js constroller become a widget. This also simplify style rules using CSS (was handled in JS). This also modifies the handling of filters to use real and correctly formated GET parameters. Redirect url with parameters are now handled automatically using URLSearchParams() instead of building manually the query string. Task ID : 1930132 PR odoo#32419
dbeguin
added a commit
to odoo-dev/odoo
that referenced
this pull request
Nov 19, 2019
URLSearchParams is not supported in IE, so we had to build our own object to store the query string params nicely. Now that IE will not be supported anymore in odoo from v13, URLSearchParams can be used to handle this for us. Task ID : 1930132 PR odoo#32419
robodoo
pushed a commit
that referenced
this pull request
Nov 19, 2019
add is_time_limited in the reset values of the onchange. Tass ID : 1930132 PR #32419
robodoo
pushed a commit
that referenced
this pull request
Nov 19, 2019
Purpose of this commit is - to make the survey js controller a widget, to be more 'odoo-standard'. - to lessen number of RPCs and clean old code for prefilling and validation of surveys. Clean Prefill : Prefill can be done directly in the template as the template has already all the needed values (in answer object). Clean Validation : Validation is done at server side and is independant from prefilling values. Dates: Dates are now formatted directly in the template, at rendering, using a format_date fonction pointer called in the template. Don't use widget in review mode: Remove o_survey_form class from review template as only dates were processed in the widget for review template. Breadcrumb : Remove button previous, prev=prev and go_back mechanism : The previous page is handled by the breadcrump Remove redirect url mechanism. Breadcrumb now saves the answers when going to a previous page. Move o_survey_form class to a higher div to englobe breadcrumb in the widget and ease his handling. Remove locale load as already done in session.js#load_modules This commit modifies the route type of survey submit to work in json. The js survey form controller calls now manually the route via rpc. Task ID : 1930132 PR #32419
robodoo
pushed a commit
that referenced
this pull request
Nov 19, 2019
This commit simplifies the answer_tag and question name by removing the survey_id (uses now only question id) for the most simple cases Factorise the save and validate survey answers to avoid duplicate code Review posted submit data : - process all questions by question type (instead of using form data (key,value) that needed key parsing and was un-typed) - regroup answers by questions and adapt all validation and save flow - remove post data in save and validate question methods and uses directly the answer(s) - remove useless input names The tests have been adapted consequently Task ID : 1930132 PR #32419
robodoo
pushed a commit
that referenced
this pull request
Nov 19, 2019
This commit makes the survey timer js controller become a widget. This widget is called by the survey form widget. When the time is over, the widget triggers a time_up event instead of calling the submit. the time_up event is catched by the survey form widget that calls himself the submit, as the submit is on the form and not on the timer itself. Task ID : 1930132 PR #32419
robodoo
pushed a commit
that referenced
this pull request
Nov 19, 2019
This commit cake the survey result analysis js constroller become a widget. This also simplify style rules using CSS (was handled in JS). This also modifies the handling of filters to use real and correctly formated GET parameters. Redirect url with parameters are now handled automatically using URLSearchParams() instead of building manually the query string. Task ID : 1930132 PR #32419
robodoo
pushed a commit
that referenced
this pull request
Nov 19, 2019
URLSearchParams is not supported in IE, so we had to build our own object to store the query string params nicely. Now that IE will not be supported anymore in odoo from v13, URLSearchParams can be used to handle this for us. Task ID : 1930132 PR #32419
robodoo
added a commit
that referenced
this pull request
Nov 19, 2019
PURPOSE Purpose of this PR is to standardize and update JS code of the survey application. It impacts mainly save, pagination and validation flows when taking surveys. Python code will have to be adapted consequently. SPECIFICATIONS: UDPATE WIDGETS Update JS code remove global selectors / global JS and use standard widgets. Lessen number of RPCs and clean old code for prefilling and validation of surveys. Contains update of notably * Survey Form: make it a real widget calling routes in RPC and doing some validation; * Prefill is now handled in the template instead of in js controller; * Submit is now done in json rpc; * Survey Timer: make timer a real widget; * Survey Result Analysis: make result, graph and pagifation real widgets; * Charts handling have been externalised in a sub widget; * Pagination have been externalised in a sub widget; Clean Prefill: prefill can be done directly in the template as the template has already all the needed values (in answer object). Clean Validation: validation is done at server side and is independent from prefilling values. Dates: dates are now formatted directly in the template at rendering using a format_date fonction pointer called in the template. Don't use widget in review mode: remove o_survey_form class from review template as only dates were processed in the widget for review template. Breadcrumb: remove button previous, prev=prev and go_back mechanism. The previous page is handled by the breadcrump. Remove redirect url mechanism. Breadcrumb now saves the answers when going to a previous page. Move o_survey_form class to a higher div to englobe breadcrumb in the widget and ease his handling. Modify the route type of survey submit to work in json. The js survey form controller calls now manually the route via rpc. SPECIFICATIONS: UDPATE CONTROLLERS Refactor questions naming, validation and save flow. Simplify the answer_tag and question name by removing the survey_id (uses now only question id) for the most simple cases. Factorise the save and validate survey answers to avoid duplicate code. Review posted submit data : * process all questions by question type (instead of using form data (key,value) that needed key parsing and was un-typed) * regroup answers by questions and adapt all validation and save flow * remove post data in save and validate question methods and uses directly the answer(s) * remove useless input names Validation and submit functions have been rewritten to avoid duplicated code as many question types have quite the same validation and save process. SPECIFICATIONS: MISC Partial Forward Port : Web assets have been split into another template to avoid multiple load of those assets when website is installed. Also reset is_time_limited on scoring type change. Also remove locale load as already done in session.js#load_modules See sub commits for more details. Task ID 1930132 Closes PR #32419 closes #39501 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Done with #39501 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of this PR is to standardize a bit the JS code (and adapt Python consequently) of the survey module and simplify the validation and save flow of the surveys.
All JS code is now inside widgets:
Answer tags are simplified and post data are regrouped by question id to simplify the parsing and usage during validation and submit.
Validation and submit functions have been rewritten to avoid duplicated code as many question types have quite the same validation and save process.
Partial Forward Port : Web assets have been split into another tempalte to avoid multiple load of those assets when website is installed.
See sub commits for more details.
Task : https://www.odoo.com/web?#id=1930132&action=327&model=project.task&view_type=form&menu_id=4720