Commit Graph
102 Commits
Author SHA1 Message Date
Martin Geubelle 4fc170e0fe [FIX] survey: submit a survey with empty date
Since rev. odoo/odoo@cd05983 it was not possible to submit a survey if a date
field was empty (trying to set `toJSON` on `null`).

The datepicker `date` function returns `null` if no date has been selected.

opw-1832381
2018-04-04 12:55:55 +02:00
Alexandre Kühn 6cc5a9963b [FIX] web,*: time format from user's language
Before this fix, the chatter always showed dates of messages in military time format.

This was not the expected behavior, as the user could have had customize
the date and time format in the settings of the current language.

Steps to reproduce the issue:

1. Set Odoo in English
2. Settings > Translations > Languages > English
   2.1. Set Date Format to %m/%d/%Y
   2.2. Set Time Format to %I:%M:%S %p
3. CRM > (Select any opportunity with at least one message) > Mouse hover on elapsed time (e.g. "an hour ago")

Expected:

- It shows the customized time format (e.g. 11/07/2017 5:33:36 PM)

Results:

- It shows the military time format (e.g. Tue Nov 07 2017 17:33:36 GMT+0100)

opw-781647
2017-12-05 09:13:31 +01:00
Jeremy Kersten a9fa7e284c [FIX] survey: show answers on 'print answers'
This commit closes #20836

Courtesy of @sswapnesh for help
2017-11-29 15:21:26 +01:00
qsm-odoo 2972976962 [REF] web_editor, website, *: complete refactoring
* mass_mailing, payment, point_of_sale, portal, survey, web, web_tour,
  website_blog, website_crm_partner_assign, website_event,
  website_event_questions, website_form, website_forum, website_gengo,
  website_hr_recruitment, website_links, website_mail,
  website_mail_channel, website_mass_mailing, website_quote,
  website_sale, website_sale_options, website_slides, website_twitter

This commit reviews the whole "JS side" of the web_editor and website
apps. This is a first step to be able to improve them with new and
better functionnalities; this commit is not supposed to change any
visual behavior.

The main goal was to achieve a structure similar to the backend one.
Now, the frontend side also has a root widget (like the WebClient)
and all other widgets are attached to it one way or another. This allows
the benefits of using the 'trigger_up' functionnality for example.

As RPC are now mainly done with the `this._rpc` functionnality (being
possible thanks to the parent hierarchy), the frontend will also be
possible to test thanks to QUnit in a future update (besides the "text"
editor side which still requires a refactoring to be able to do that).

---

Here are some of the changes:

(-) conventions and documentation

The code has been updated to follow JS conventions and a lot of code has
been commented (around +2000 lines of comment). This also means that
lots of functions have been renamed to use camelCase or simply to make
their name understandable.
See https://github.com/odoo/odoo/wiki/Javascript-coding-guidelines.

(-) deprecated: web_editor.base

The "web_editor.base" module has been split and does not force the
modules which require it to wait for DOM ready anymore. This was indeed
slowing loading times, but also prevented to use some modules in some
contexts (see the LESS editor use in web_studio which is the subject of
another task).
Now the "editor context" can be got thanks to the "web_editor.context"
JS module with its "get" function.
The "web_editor.base" module should probably not be used anymore (see
its code and recent updates).

(-) new: web.dom_ready

If a JS module should wait for the DOM to be ready to be executed, a
new JS module has been created: "web.dom_ready". This should always
be used in a module which only want to instantiate stuff. Do not
extend (or worst, include) classes after DOM ready.

(-) website.website

The "website.website" module has been split. "website.website" does not
return anything useful anymore, it just initialize some miscellaneous
stuff, without waiting for the DOM to be ready. You might want to check
"website.utils", "website.content.compatibility" or `WebsiteRoot`. Also
`website.form` has been deleted (use `this._rpc`), so has been
`website.error`. `website.prompt` will be removed in a future update to
be replaced by `Dialog.prompt`.

(-) widgets are great

Many classes which were not widgets are now widgets. This allows them to
use the 'events', the 'xmlDependencies' and the 'this._rpc' features for
example. Here are some of the main ones:

- Snippet options: these were classes with a `$el` for the menu element
    and `$target` for the customized element. This is still the case
    but following standard `Widget` structure (one exception: using
    `this.$(...)` searches in the `$target` as before this update).

- Snippet animations: instead of class instances with a `$target`
    element which can be `start` and `stop`, these are now standard
    widgets which can be `start` and `destroy`. `this.$target` is
    an alias to `this.$el` for ease of compatibility.

- Snippet editors: instead of class instances in charge of an editor
    overlay, these are now widgets. Each "child" snippet editor is
    properly attached as a "child", which allows editors to communicate
    and to be properly destroyed.

(-) root widgets and website navbar

The frontend is different of the backend. In the backend, the page has
an empty <body/> element and all the components are instantiated from
parent to children (i.e. the `WebClient` is instantiated and is in
charge of instantiating the `ControlPanel`, etc). The frontend cannot
work like that on page loadings as they are way more frequent than in
the backend and we do not want them to flicker. A frontend page is
loaded as a <body/> element which already contains the website navbar
and its menus and the whole content page. JS code has to be "attached"
to these existing elements. This is possible thanks to the `RootWidget`
instances and the specialized `WebsiteRoot`, `IframeRoot` and
`WebsiteNavbar` (see code for details).

(-) lazy loading

No more (or at least a lot less) XML/JS has to be loaded on page
loading, thanks to the use of the `Widget.xmlDependencies` feature.
XML which have to be lazy loaded is loaded only on related Widget
instantiation if necessary, which allows to execute a lot of JS code
before the DOM is ready and to start many widgets on DOM ready (not
later). A visual benefit of this is clicking on the 'edit' button as
soon as it is possible: before this commit, this was sometimes not
doing anything as event handlers were not binded yet.

Still a possible exception: loading the session and locales. This may
be asynchronous stuff which is still required before widget
instantiations but this will be the subject of another task.

(-) deprecated code and code location

More than reviewing code and organizing it, many apparent dead code was
removed. More importantly, mislocated code was put in the right app.
This is the case for snippet animations which is a concept for website
apps but was defined in the web_editor app, or some translation concepts
which were part of website but should have been part of web_editor.

---

There are probably more things to say about this commit but I will let
the comments speak for those.
2017-08-16 11:04:14 +02:00
Kinjal Mehta cd05983121 [IMP] survey: ease use of "Date" questions
- ask questions about "Dates", not "Datetimes" anymore
- display dates according to website language

Thanks to Kinjal Mehta and Ravi Gadhia who contributed to this commit.
2017-08-14 09:21:50 +02:00
qsm-odoo fb363b572b [FIX] *: adapt odoo interface violet
Change color #a24689 to #875A7B

Commit https://github.com/odoo/enterprise/commit/8ac1c19fac7615fecd51e670f798d13158a4e53c
changed the odoo interface violet by changing the main LESS variable
but forgot there was many direct occurences in XML/HTML/... (for
example for the mobile browser color).

Even if it's community the odoo interface violet is used at many places
(module description, XML demo data, ...).
2016-10-05 10:29:00 +02:00
qsm-odoo 3cbc7ebc4c [FIX] *: missing base.ready() waiting for frontend tours
Frontend tours have to wait for base.ready() before starting otherwise
they can find DOM elements whose event handlers have not been attached
yet.

Note that this is a workaround to ignore these real "bugs" as users
should not be able to see buttons they can't click at once but there is
no safe and small fix which will resolve that. The time between the DOM
becomes visible and handlers are attached is small enough to ignore
this bug for now anyway.
2016-09-30 12:19:46 +02:00
Christophe Matthieu 4ba425583e [IMP] survey: convert tours to use web_tour.tour 2016-08-30 13:54:28 +02:00
Foram Shah 5f0c66c648 updated the description of 'survey' 2016-05-10 15:24:48 +02:00
Fabien Pinckaers 4c8e908b49 [IMP] Speed up app switcher loading: 645k --> 137k lossless compression for all icons 2016-02-26 11:39:38 +01:00
Géry Debongnie cd71fe6687 [FIX] web,survey: update graphs tooltip to new nvd3
with the update of nvd3/d3, the tooltip api was changed.  This commit
updates the 3 last places where we were using the tooltips.
2015-11-02 10:06:13 +01:00
Christophe Simonis 97073e2a73 [MERGE] forward port of branch saas-6 up to 51040b6 2015-07-28 13:56:16 +02:00
Christophe Simonis 9d6786bc43 [MERGE] forward port of branch 8.0 up to 5e6ec89 2015-07-27 14:56:49 +02:00
Nicolas Lempereur 6e090f5d5b [FIX] survey: improve printing
Don't use select element when printing a non-filled survey, and small
appearances improvements.

opw-645011
2015-07-24 09:35:02 +02:00
Christophe Matthieu 71732dceb6 [IMP] web: module can be asynchronous loaded if it return a deferred
Each module can return a deferred. In that case, the module is marked as loaded
only when the deferred is resolved, and its value is equal to the resolved value.
The module can be rejected (unloaded). This will be logged in the console as info.

Remove if_dom_contains from the website, the modules return a rejected deferred if
the DOM doesn't contains the seleted values.
2015-07-22 12:15:24 +02:00
Simon Lejeune 74d1e43a40 [ADD] many addons: add new icons
This commits adds icons for most applications.  They are
necessary for the home menu in the enterprise edition.
2015-06-18 12:58:18 +02:00
Jaysinh Shukla 6909d0e986 [IMP] survey: tests suite and basic UI tests
(+ a few fixes)
2015-06-11 12:25:21 +02:00
Olivier Dony 0bd4545348 [LEGAL] Use global LICENSE/COPYRIGHT files, remove boilerplate text
- Preserved explicit 3rd-party copyright notices
- Explicit boilerplate should not be necessary - copyright law applies
  automatically in all countries thanks to Berne Convention + WTO rules,
  and a reference to the applicable license is clear enough.
2015-06-02 03:16:04 +02:00
Géry Debongnie 4fdf74fe21 [IMP] web+addons: improvement to module system
The module system needs to know the dependencies of a given module
before executing the function.  This is why the dependencies were
defined once in an array, and then were described one more times in the
call to require.

But a trick can simplify this: the boot function can parse the string
representation of the module and extract the calls to require from it.
It is more work for the processor, but it leads to simpler module
definitions.
2015-03-18 09:23:37 +01:00
Géry Debongnie 88fbbd7362 [REF] survey: update to the new module system 2015-03-18 09:09:23 +01:00
Ajay Patel de4135305c [IMP] survey: usability onboarding
Various views and usability tweaks:
- datetime picker in surveys
- remove technical field res_model for survey
- various relabelling
- better validation of date constraints
- onchange when email validation
- button to the backend in survey frontends
- icons in questions form views
2015-03-09 19:31:14 +01:00
Christophe Simonis 18e22be138 [MERGE] forward port of branch 8.0 up to 0aab81c 2015-01-19 17:15:56 +01:00
Richard Mathot b117fcfbac [FIX] survey: prefill glitch
When user answers to multiple suggestion questions with a comment box,
the comment box was prefilled with the ID's of the suggestion instead of
user-entered data.

This commit fixes #3149 and closes #3171.
2015-01-16 17:24:14 +01:00
Richard Mathot 11f147f2d9 [FIX] survey: prevent pointless AJAX request
Avoid creation of doublon survey_user_input entries when a user loads the landing page of a survey (/survey/start/... route).

Due to some strange spec, jQuery.ajax() function called with "undefined" URL will do an extra call to the URL of the webpage where the script lies (http://api.jquery.com/jQuery.ajax/). Now, we check that URL is not "undefined" to avoid those calls.

By the way, this problem probably happened in every page that had survey.js in its assets... (correct loading of survey.js is fixed in saas-6 at 4dd5dbb289, this fix is complementary.)

This commit fixes #3032 and closes #3337 #3338 #3092.
2015-01-16 17:24:14 +01:00
Nick Booker c53951e0a5 [FIX] survey: typo, quizz to quiz
Fixes #4549
2015-01-08 13:14:06 +01:00
Simon Lejeune 4dd5dbb289 [FIX] survey: only load js scripts when needed
This is done with the help of website.if_dom_contains and 1) js_surveyform
class for survey.js 2) a new fake class js_surveyresult for survey_result.js
This fix also allow to avoid spurious logs on runbot during phantomjs tests.
2014-12-19 17:49:12 +01:00
Richard Mathot 89d7e78aad [FIX] survey: pagination result didn't load properly at page loading 2014-06-11 12:10:26 +02:00
Richard Mathot (OpenERP) 4aed9ce7e7 [IMP] Score for each question
bzr revid: rim@openerp.com-20140416151320-1zsxsss60zi9w11y
2014-04-16 17:13:20 +02:00
Richard Mathot (OpenERP) 229f9d09d8 [REM] annoying print window
bzr revid: rim@openerp.com-20140409152459-upe7py6skbpa0qcz
2014-04-09 17:24:59 +02:00
Richard Mathot (OpenERP) d197bab150 [MERGE][IMP] Reporting system for surveys
bzr revid: rim@openerp.com-20140408135908-0h3qiohc84kx4b2r
2014-04-08 15:59:08 +02:00
Dharmraj Jhala (OpenERP) 8df85fdd56 [IMP] improved condition in survey_result.js
bzr revid: dizzy.zala@gmail.com-20140407084114-yvam08p2cawq2aq9
2014-04-07 14:11:14 +05:30
Dharmraj Jhala (OpenERP) f5a24871cb [IMP] improved js to hide cursor pointer if the same filter is enabled
bzr revid: dizzy.zala@gmail.com-20140404125943-l2sz45dk2u529wyb
2014-04-04 18:29:43 +05:30
Dharmraj Jhala (OpenERP) 364eb7546a [IMP] removed ajax calls and loaded data while rendering the template
bzr revid: dizzy.zala@gmail.com-20140404051913-ecy6jm62fxacs6me
2014-04-04 10:49:13 +05:30
Dharmraj Jhala (OpenERP) a9c6fb3ec9 [IMP] uniform view of filters and some code improvements
bzr revid: dizzy.zala@gmail.com-20140403062552-oa002zg7kdlbxh56
2014-04-03 11:55:52 +05:30
Dharmraj Jhala (OpenERP) ca78346bf3 [IMP] moved business logic to model file from controller and other misc improvements
bzr revid: dizzy.zala@gmail.com-20140328133706-wwsg07sqgzr650pt
2014-03-28 19:07:06 +05:30
Dharmraj Jhala (OpenERP) fb104246a4 [IMP] improved css for printing
bzr revid: dizzy.zala@gmail.com-20140327124948-u2kw13dnn4kx487d
2014-03-27 18:19:48 +05:30
Dharmraj Jhala (OpenERP) 72700a2cf9 [IMP] Added preset All vs Finished Filter
bzr revid: dizzy.zala@gmail.com-20140327064305-tlw358e0u9wu9jnd
2014-03-27 12:13:05 +05:30
Dharmraj Jhala (OpenERP) 6242a749e0 [IMP] code improvement
bzr revid: dizzy.zala@gmail.com-20140326051638-got79xh1azvz77ut
2014-03-26 10:46:38 +05:30
Dharmraj Jhala (OpenERP) 6a0fa7c3ff [IMP] added pie chart for simple questions and table condensed class to tables, and set limit of 10 records for pagination
bzr revid: dizzy.zala@gmail.com-20140324100257-fz8id6eula73x4yx
2014-03-24 15:32:57 +05:30
Richard Mathot (OpenERP) 43b225a166 [REM] Outdated custom CSS
bzr revid: rim@openerp.com-20140321145313-gy4o0l3ecdg32tgl
2014-03-21 15:53:13 +01:00
Richard Mathot (OpenERP) 21b7829c70 [ADD] New stage for surveys
bzr revid: rim@openerp.com-20140320153351-xgj5j164ixmwxaj6
2014-03-20 16:33:51 +01:00
Richard Mathot (OpenERP) 6eca5c113b [IMP] Kanban view tweaking
bzr revid: rim@openerp.com-20140303133641-xa52rj4g2k0gxtxp
2014-03-03 14:36:41 +01:00
Richard Mathot (OpenERP) 2cde1e8b91 [MERGE] Reporting tool for surveys + [REF] Serveral refactorings (code style, missing semicolons in JS, typos...) + [FIX] Security breach using unsafe eval
bzr revid: rim@openerp.com-20140303130544-xoage8hgkhtfhwpg
2014-03-03 14:05:44 +01:00
Dharmraj Jhala (OpenERP) c6917b9c07 [MERGE] with trunk-survey2-rim addons branch
bzr revid: dizzy.zala@gmail.com-20140225053204-mra08nfvumkxyixa
2014-02-25 11:02:04 +05:30
Richard Mathot (OpenERP) 9eb2db4465 [FIX] Typos
bzr revid: rim@openerp.com-20140220120044-syde053xmunoy75z
2014-02-20 13:00:44 +01:00
Parth Gajjar (Open ERP) 3b395dab1a [ADD,IMP] added filters for display, filterd textbox, free_text and date on basis of filter and some exception handling
bzr revid: pga@tinyerp.com-20140207113309-5o91de9jed2670qd
2014-02-07 17:03:09 +05:30
Parth Gajjar (Open ERP) 34f14e357c [ADD] added filter for matrix and choice
bzr revid: pga@tinyerp.com-20140206134053-mjlfe7qdf07bk8me
2014-02-06 19:10:53 +05:30
Parth Gajjar (Open ERP) 51b1eb6fbf [IMP] moved pagination script in separate js file,and solved minor issues
bzr revid: pga@tinyerp.com-20140204095157-0mfdy27l9l73dxf5
2014-02-04 15:21:57 +05:30
Parth Gajjar (Open ERP) e942cb2cd0 [IMP] moved graph JavaScript from template to separate JS file (using AJAX), removed static copy of graph library
bzr revid: pga@tinyerp.com-20140203073439-mj21tfw6a0mg56v1
2014-02-03 13:04:39 +05:30
Dharmraj Jhala (OpenERP) f93465f4a4 [MERGE] with trunk-survey2-rim
bzr revid: dizzy.zala@gmail.com-20140129051248-ysm8qy498oqmazxe
2014-01-29 10:42:48 +05:30