Commit Graph
284 Commits
Author SHA1 Message Date
Christophe Matthieu 4809091b15 [FIX] website_blog: wrong parse background-image generate console error 2018-04-23 14:28:00 +02:00
rde 53ae8becd4 [FIX] website_blog: repair blog post save
Before this commit and since the huge JS refactoring, when you were editing
a blog post it wouldn't save your modifications if you touched the title or
subtitle of the blog.

This was due to title & subtitle getting considered as the cover itself
when saving (_saveElement) because they are inside the cover (in a HTML point
of view).
So if you had modified both the cover, the title and the subtiltle, it was:
	1. Saving the cover
	2. Saving the cover again
	3. Saving the cover again

Now, _saveElement is called as it should, for the same case, it is:
	1. Saving the cover
	2. Saving the title
	3. Saving the subtitle
2017-09-26 16:10:20 +02:00
rde 4ecbacaf59 [ADD] website: add new page management
website.page = old ir.ui.view with page=True
website.redirect is a new mechanism to replace in the futur the ir.attachment
mechanism of redirect.

From now, we don't have a specific /page controller to serve 'page'.

We use a new model website.page which is rendered if none route matches the url
 and that the field 'url' on website.page matches the request.httprequest.path.

The order to serve a path is:
    - Routes defines in controllers (/shop, /blog, ...)
    - ir.attachment with name matching the path
    - website.page with url matching the path
    - website.redirect with url_from matching the path
    - 404

To improve:
    - allow regexp in website.redirect model
    - allow to edit the view_arch from the page.management via redirect backend
      (needed when traceback in the page, or when modifying a js/css/less/...)
2017-09-15 15:29:37 +02:00
Jérome Maes 065539f056 [FIX] website_blog: make published button for comment visible 2017-08-16 15:30:10 +02: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
Olivier Dony ba15df47cb [MERGE] Forward-port saas-15 up to 17b847c0f6 2017-06-01 01:10:29 +02:00
qsm-odoo 490764ae11 [FIX] website_blog: fix "select to tweet" feature
There was two main problems with the feature

- The author name was not properly fetched so the feature which was
  supposed to add the author of the blog post in the tweet never
  worked -> this commit simply deletes it

- The code was considering the url length in the size of the tweet,
  so if the url was 135 characters long, it considered that only 5
  characters have to be taken in the selected text... which is wrong
  as twitter URL are all shortened to 23 characters by twitter

opw-741530
2017-05-16 17:21:34 +02:00
Géry Debongnie 2106e3dd2e [REF] web, *: simplify our RPC system (in JS)
The RPC system was not completely satisfactory, we decided to prepare
the future and do it properly.  This commit introduces the new rpc
system, which replace the previous new one.  We now simply have a
method, this._rpc, which takes a dictionary of parameters.  The idea is
that depending on the parameters, it is able to add correct default
value when necessary.

For situations where we don't have the this._rpc method, we can use the
rpc.query method, which takes the same arguments, but directly calls
ajax.rpc instead of triggering up some events.
2017-04-11 19:44:38 +02:00
Géry Debongnie 86a87aa8b0 [REF] *: use _rpc method for all rpcs
The _rpc method is now the preferred method to do a rpc, so we need to
update all calls.
2017-04-11 19:44:38 +02:00
Géry Debongnie 25fecd932a [REF] web, *: remove calls to performmodelrpc
The this.performModelRPc method is deprecated, so with this commit, we
remove some calls.
2017-04-11 19:44:38 +02:00
Géry Debongnie e574027056 [REF] web,*: remove 'web.model' and 'web.dataModel
Use this.rpc instead of Model object, with web.ajax if necessary.

nb: EventDispatcherMixin include now the custom_events managment instead
of widget
2017-04-11 19:44:38 +02:00
qsm-odoo 4cfcbb9ebd [FIX] website_blog: fix tour tip messages typo
* Clich -> Click
* Yoru -> Your
2016-10-10 10:17:01 +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
Jeremy Kersten ee43282319 [FIX] website_blog: don't save the hostname in bg cover image
Url saved need to be relative.
Before this commit, demo was relative, but once updated, urls was absolute.
2016-09-29 15:46:27 +02:00
Christophe Simonis a7ba6cde9c [MERGE] forward port branch saas-12 up to 7134aff 2016-09-28 16:28:31 +02:00
Christophe Simonis 2c6d32ca7d [MERGE] forward port branch saas-11 up to 34186fd 2016-09-28 14:46:29 +02:00
Christophe Simonis 12548d3e73 [MERGE] forward port branch saas-10 up to e8b8784 2016-09-28 13:17:37 +02:00
qsm-odoo 4dd31f645e [IMP] website_blog: add consistent behaviors for cover options
There was no bug but now the behaviors are more consistent :

- Demo data now declare a black invisible filter instead of nothing.
This allows user to see the effect of filter intensity option
(otherwise it had no visible effect since there was no filter color).

- If the filter intensity is set to "None" (invisible filter) and that
a filter color option is highlighted or chosen, a "Low" filter
intensity is automatically highlighted or chosen so that the user see
the filter color he is chosing (instead of having to choose the filter
intensity first).

- Hide the "Size" option on the blog list page since it has not visible
effect there.

- Some code "performance" improvements in option selection.
2016-09-28 13:05:39 +02:00
Christophe Simonis e8b8784d5c [MERGE] forward port branch 9.0 up to 9ba5698 2016-09-28 12:59:25 +02:00
qsm-odoo 1df161db6b [FIX] website_blog: keep consistent cover classes when changing cover image
! Note forward port: this is a partial backport, ignore when conflict

For some strange reason, the cover_full class was added when the cover
image was changed, without checking if the cover_narrow class was
already there. The cover was then a hybrid cover_narrow cover_full.

The problem was reinforced by the graphene theme which does some
animation on cover_full covers.
2016-09-27 17:28:31 +02:00
qsm-odoo 5f98040430 [FIX] website, *: properly process saving from editor dialogs
* web_editor, website_blog

Since recent refactoring, web editor dialogs automatically trigger
an event when closed (saved or cancel). The problem is that there
still was manual trigger of those events or variants ("save" instead
of "saved").

To prevent multi-saving and be consistent, all save events are now
automatically triggered on save/close (no more manual) and the event
name is "save".
2016-09-27 15:42:31 +02:00
stefanorigano 1ec38c02c5 [IMP] website_blog: replace images and add xml ids
* Replace demo blog post covers
* Add xml ID to demo images so they can be easily replaced by themes
* Remove unused images
2016-09-02 14:57:40 +01:00
qsm-odoo c204d621bb [IMP] website_blog: use valid website snippet as default content for blog post
Adapt the default content of blog post to be a valid website snippet.
Previous content was not entirely possible to remove (there still was
a remaining .container) and was not easily customizable (user had to
remove it if he wants something great).

Note: maybe we should adapt the snippets so that they are callable with
custom content or do something like what has been done for default
content for job positions (see commit 00cfb0889b).
2016-08-31 16:37:20 +02:00
qsm-odoo f9a84b5ebc [IMP] web_tour, *: allow to properly extend tours
* crm, project, website, website_event, website_blog, website_forum,
website_sale

Eg: the tour 'shop_buy_product' is extended by the website_sale_options
addons to add a step to close a modal.

The current solution was requiring the module that defines the tour
to extend, then add/remove steps in the "step" key of the tour
definition.
Some of the problems with this method were:
* The "register" method calls the "update" method to immediately
search for tip to place once registered (as register may be called
after the DOM is ready). So extensions of tours were happening after
the tours were started (and the tours were not restarted).
* The addition/removal of steps was happening after they were filtered
according to the "edition" key.

To allow extension, the system is changed as follow:
* The "register" method now only saves the steps and options without
modifying them and does not call the "update" method.
* Once the DOM was ready, the tour service started listening to DOM
mutations and called the "update" tour method. Now, this "update" call
is replaced by a "_register_all" call, on DOM ready and at the end of
the current call stack (which makes sure all modules are loaded). This
"_register_all" method marks the registered tours as ready after having
filtered the steps according to the "edition" key and initialized the
current step to trigger.
* Also, tours can now define a "wait_for" option which allow them to
be marked as ready for run and update after the given deferred. Those
tours can now also be extended without having to wait for the deferred.
PhamtomJS must wait for the "ready" key to be true to run the tour.
2016-08-26 13:39:55 +02:00
qsm-odoo 74d7de465e [REF] website_blog: refactore cover option and change opacity behavior
* Isolate website_blog style
* Simplify/Correct the cover option JS
* Allow to modify the cover from the blog list page
* Change cover layout (use a more conventionnal odoo design with a
div which is full width, which contains a container(-fluid) then its
content) -> easier to customize.
* Refactore code to be understandable
* Change behavior of opacity filter: before this commit the cover
filter was not intuitive and did not work on IE or Edge, it mixed
the color of the bg-image and the bg-color in a complex way and the
opacity was just controlling if the image was visible clearly or not
(which led in general to ugly style if the opacity was used). Now, the
color in applied *on top* of the image so that its color changes the
hue of the underlying image. The opacity value controls only the
opacity value of the color to mix.

[MIGRATION] Note: as the opacity behavior has changed, the exact same
behavior is not reproductible at all. But for the change to make a bit
of sense in old databases, this should be applied for the field
"cover_properties" of blog posts (with changes in layout):

if cover_properties.background-color != "oe_none":
    cover_properties.opacity = 0.6
else:
    cover_properties.opacity = 1.0 - cover_properties.opacity
2016-08-19 17:44:28 +02:00
qsm-odoo ee19cf08e4 [IMP] website_blog: convert SASS to LESS 2016-08-19 17:44:28 +02:00
Jeremy Kersten 8cc850f3a5 [IMP] website_blog: refactoring
[IMP] website_blog: display author avatar option
[IMP] website_blog: refactore cover option for blog
[IMP] website_blog: tags are now always displayed and as a label
[IMP] website_blog: side bar cleaning
[IMP] website_blog: new teaser
[IMP] website_blog: replace inline comments by quotes comment
[IMP] website_blog: new grid layout
[WIP] website_blog: read next options
[IMP] website_blog: refactoring sharing links
[IMP] website_blog: Delete cover narrow option
[IMP] website_blog: improvement for sharing links
[IMP] website_blog: blog post list cover is an option
[IMP] website_blog: archives group by year
[IMP] website_blog: if only one blog, no index blog post

Courtesy of @movanoncem
2016-08-10 18:38:28 +02:00
Fabien Pinckaers d73eb2c555 [IMP] website_blog: improved tour 2016-08-04 16:10:13 -07:00
Christophe Simonis 523d3af131 [MERGE] forward port branch saas-12 up to 16d65a8 2016-07-29 17:55:21 +02:00
qsm-odoo a1c6e7243c [FIX] website(_blog): review end of tours banner and blog
Tour blog ended with forcing the user to click on a fake element. So
the end of tour blog and banner had to be changed.
Also, the tour step could appear in edit mode which is not what we
wanted.
2016-07-19 11:55:02 +02:00
qsm-odoo eaf8e82efb [IMP] *: activate automatic tour tests
* project, crm, point_of_sale, website, website_sale, website_blog,
website_event, website_forum
2016-07-18 14:22:29 +02:00
qsm-odoo 3247400291 [IMP] website(_*): tours
* Adapt modals for new pages/product/... to leave some space for tour
tips on the right
* Remove the "click on add page" step which was the start of each tours
and leave it to be the last of the website tour
* Change position of some tips
* Remove step "click on parent button" in website tour as it is not
necessary anymore
* Remove the possibility to skip the frontend tours
2016-07-05 18:05:24 +02:00
qsm-odoo cd16749564 [IMP] website(_*): adaptation of tours to new system
+ Adapt website welcome message

(Note: temporary duplicate tour: use old version for tests and new
version for onboarding)
2016-07-04 17:24:00 +02:00
qsm-odoo 36f31306e5 [IMP] website(_*): adapt tours
Adapt tours according to website/web_editor DOM changes.
2016-07-04 17:24:00 +02:00
qsm-odoo 62fb1bb924 [REF] web_editor: code refactoring and simplification
* Remove dead code + optimization
* Use Dialog API from web module
* Reorganize files
* Correct buggy $() function for snippet option class
* Add comments

* Fix the snippet parent navigation :

If a page contained a three level snippet structure (i.e A contains
B contains C), when editing the following bug occured :

If B or C was selected first, parenting buttons were correctly set.
But if selecting A then C, clicking on the parent lead to going back
on A instead of going on B.

* Fix snippet thumbnail layout
* Better isolate ui css from themes
* MediaDialog image list : prevent displaying empty attachments
* ...
2016-07-04 17:23:59 +02:00
Foram Shah 052dcd3ee8 [IMP] web: 'Not Archived' becomes 'Active', 'Not published' becomes 'Unpublished'
Another reason why it’s better to change ‘not archived’ into ‘active’ is
because ‘active’ is the functional name of this field in the filter list in list view.

For the rest, it’s just a better en_US way of saying it.
2016-06-14 16:23:50 +02:00
Foram Shah da41d9aff4 updated the description of 'website_blog' 2016-05-10 15:24:49 +02:00
Christophe Simonis 79976bd779 [MERGE] forward port of branch saas-10 up to 6e95659 2016-04-01 19:10:34 +02:00
Christophe Simonis 6e95659a08 [MERGE] forward port of branch saas-9 up to f4d1adc 2016-04-01 18:51:55 +02:00
Mohammed Shekha 0471d57088 [IMP] website_blog: Comment button animation improvement
Purpose:
When I clicked on comment button I will get the comment box, and text will
be moved left side and when I clicked anywhere on screen, I will get text
as it is, But if I clicked on comment sign second time(when there is already
popover is opened) I will not get text as in original view.

What's done:
Strange behavior of move blog content, when user clicks on + sign second time
and popover is already open then move the content back to original position,
also fixed the issue of alignment issue of comment in popover, make popover
bit bigger to show content properly
2016-03-29 15:37:07 +02:00
Nicolas Lempereur 918e1b06bc [FIX] website_blog: .cover_narrow removed when cover removed
opw-668713
2016-03-25 12:21:33 +01:00
Nicolas Lempereur a23e850f63 [FIX] website_blog: narrow_cover and overriding header
The narrow cover option new in 9.0 has no meaning if the content can
overflow it (it would overflow the cover and hide the blog content).

opw-668713
2016-03-24 17:29:57 +01: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
qsm-odoo ed46965dbe [FIX] web*: tours
Selector changes + No need to open the snippet panel anymore.
2016-02-24 13:47:36 +01:00
qsm-odoo 30480c5732 [FIX] website_blog: do not tweet in edit mode
When selecting a sentence on a blog, a popup appears to suggest to
tweet the sentence. In edit mode, the user do not want that to happen.
2016-01-19 12:25:11 +01:00
Yannick Tivisse 47a82a8e9c [REM] Remove useless button in some module descriptions 2015-09-30 16:42:18 +02:00
Christophe Matthieu 1acd86a45d [FIX] website_blog: display cover and cover options 2015-09-25 16:06:21 +02:00
Nicolas Lempereur 70b869a0e4 [FIX] website_blog: button could be already removed 2015-09-09 10:40:57 +02:00
Yannick Tivisse 1e8a890be6 [IMP] Rename Live Chat into Website Live Chat 2015-09-07 18:25:51 +02:00
Christophe Matthieu 6baf611df1 [IMP] web: create generic controller '/web/content' and '/web/image'
Replace deprecate controllers like /web/binary/image, /web/binary/saveas...
Use ETag for all content with 'unique' option to cache the content if the content is never changed.
2015-08-21 22:06:52 +02:00