Skip to content

Commit

Permalink
[IMP] *: remove jQueryUI draggable and droppable
Browse files Browse the repository at this point in the history
*: mass_mailing, test_website, web, web_editor, website, website_event,
   website_sale

This commit removes jQueryUI draggable and droppable component to
instead use our own implementation of the feature. This replaces the
last use of the lib: the web_editor drag and drop. This takes advantage
of the code that was already written for other features of the backend.

task-3079246

closes odoo#136793

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
  • Loading branch information
detrouxdev authored and qsm-odoo committed Oct 19, 2023
1 parent fae131e commit 7594d71
Show file tree
Hide file tree
Showing 31 changed files with 697 additions and 2,634 deletions.
4 changes: 2 additions & 2 deletions addons/mass_mailing/static/tests/tours/mailing_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ registry.category("web_tour.tours").add('mailing_editor', {
run: () => {},
}, {
content: 'drag the "Title" snippet from the design panel and drop it in the editor',
trigger: '[name="body_arch"] iframe #email_designer_default_body [name="Title"] .ui-draggable-handle',
trigger: '[name="body_arch"] iframe #email_designer_default_body [name="Title"] .oe_snippet_thumbnail',
run: function (actions) {
actions.drag_and_drop('[name="body_arch"] iframe .o_editable', this.$anchor);
actions.drag_and_drop_native('[name="body_arch"] iframe .o_editable', this.$anchor);
}
}, {
content: 'wait for the snippet menu to finish the drop process',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ registry.category("web_tour.tours").add('mass_mailing_code_view_tour', {
content: 'Verify that the dropable zone was not removed',
run: () => {},
}, {
trigger: '[name="body_arch"] iframe #email_designer_default_body [name="Title"] .ui-draggable-handle',
trigger: '[name="body_arch"] iframe #email_designer_default_body [name="Title"] .oe_snippet_thumbnail',
content: 'Drag the "Title" snippet from the design panel and drop it in the editor',
run: function (actions) {
actions.drag_and_drop('[name="body_arch"] iframe .o_editable', this.$anchor);
actions.drag_and_drop_native('[name="body_arch"] iframe .o_editable', this.$anchor);
}
}, {
trigger: '[name="body_arch"] iframe .o_editable h1',
Expand Down
8 changes: 1 addition & 7 deletions addons/test_website/static/tests/tours/custom_snippets.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ wTourUtils.registerWebsitePreviewTour('test_custom_snippet', {
content: "confirm rename",
trigger: ".oe_snippet[name='Custom Banner'] we-button.o_we_confirm_btn",
},
{
content: "drop custom snippet",
trigger: ".oe_snippet[name='Bruce Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
extra_trigger: "iframe body.editor_enable",
moveTrigger: ".oe_drop_zone",
run: "drag_and_drop iframe #wrap",
},
wTourUtils.dragNDrop({ name: "Bruce Banner" }),
{
content: "ensure banner section exists",
trigger: "iframe #wrap section[data-name='Banner']",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ const setupSteps = [{
content: "drop a snippet",
trigger: "#oe_snippets .oe_snippet[name='Text - Image'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
moveTrigger: "iframe .oe_drop_zone",
run: "drag_and_drop iframe #wrap",
run: "drag_and_drop_native iframe #wrap",
}, {
content: "drop a snippet",
trigger: "#oe_snippets .oe_snippet[name='Image Gallery'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
extra_trigger: "body.editor_has_snippets",
moveTrigger: ".oe_drop_zone",
run: "drag_and_drop iframe #wrap",
run: "drag_and_drop_native iframe #wrap",
}];

const formatErrorMsg = "format is not supported. Try with: .gif, .jpe, .jpeg, .jpg, .png, .svg, .webp";
Expand Down
2 changes: 1 addition & 1 deletion addons/test_website/static/tests/tours/reset_views.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ wTourUtils.registerWebsitePreviewTour('test_reset_page_view_complete_flow_part1'
content: "drop a snippet",
trigger: ".oe_snippet:has(.s_cover) .oe_snippet_thumbnail",
// id starting by 'oe_structure..' will actually create an inherited view
run: "drag_and_drop iframe #oe_structure_test_website_page",
run: "drag_and_drop_native iframe #oe_structure_test_website_page",
},
...wTourUtils.clickOnSave(),
// 2. Edit that COW'd view in the HTML editor to break it.
Expand Down
8 changes: 2 additions & 6 deletions addons/web/static/lib/jquery.ui/jquery-ui.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
/*! jQuery UI - v1.12.1 - 2023-10-04
/*! jQuery UI - v1.12.1 - 2023-10-10
* http://jqueryui.com
* Includes: draggable.css, core.css, autocomplete.css, menu.css, theme.css
* Includes: core.css, autocomplete.css, menu.css, theme.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?scope=&folderName=base&cornerRadiusShadow=8px&offsetLeftShadow=0px&offsetTopShadow=0px&thicknessShadow=5px&opacityShadow=30&bgImgOpacityShadow=0&bgTextureShadow=flat&bgColorShadow=666666&opacityOverlay=30&bgImgOpacityOverlay=0&bgTextureOverlay=flat&bgColorOverlay=aaaaaa&iconColorError=cc0000&fcError=5f3f3f&borderColorError=f1a899&bgTextureError=flat&bgColorError=fddfdf&iconColorHighlight=777620&fcHighlight=777620&borderColorHighlight=dad55e&bgTextureHighlight=flat&bgColorHighlight=fffa90&iconColorActive=ffffff&fcActive=ffffff&borderColorActive=003eff&bgTextureActive=flat&bgColorActive=007fff&iconColorHover=555555&fcHover=2b2b2b&borderColorHover=cccccc&bgTextureHover=flat&bgColorHover=ededed&iconColorDefault=777777&fcDefault=454545&borderColorDefault=c5c5c5&bgTextureDefault=flat&bgColorDefault=f6f6f6&iconColorContent=444444&fcContent=333333&borderColorContent=dddddd&bgTextureContent=flat&bgColorContent=ffffff&iconColorHeader=444444&fcHeader=333333&borderColorHeader=dddddd&bgTextureHeader=flat&bgColorHeader=e9e9e9&cornerRadius=3px&fwDefault=normal&fsDefault=1em&ffDefault=Arial%2CHelvetica%2Csans-serif
* Copyright jQuery Foundation and other contributors; Licensed MIT */

.ui-draggable-handle {
-ms-touch-action: none;
touch-action: none;
}
/* Layout helpers
----------------------------------*/
.ui-helper-hidden {
Expand Down
Loading

0 comments on commit 7594d71

Please sign in to comment.