summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2013-10-29 09:37:18 +0100
committerFabien Meghazi <fme@openerp.com>2013-10-29 09:37:18 +0100
commit2d0158d8cc96a6bae52039b3158913c85a1d5162 (patch)
treedcb6a96db00d838552bbdeff5988e2ea9a66f1bf /addons/website/static/src
parent2fc5da3f95497820e5d8c0a92cd2491b2daef76c (diff)
[ADD] Menu drag'n dro
bzr revid: fme@openerp.com-20131029083718-e6jrinmh6z48vn5j
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/css/editor.css31
-rw-r--r--addons/website/static/src/css/editor.sass29
-rw-r--r--addons/website/static/src/js/website.menu.js17
3 files changed, 77 insertions, 0 deletions
diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css
index 8fa0ad80f5f..7df97820883 100644
--- a/addons/website/static/src/css/editor.css
+++ b/addons/website/static/src/css/editor.css
@@ -1,3 +1,4 @@
+@charset "utf-8";
/* ---- CKEditor Minimal Reset ---- */
.navbar.navbar-inverse .cke_chrome {
border: none;
@@ -141,6 +142,36 @@ table.editorbar-panel td.selected {
background: #ffffb6;
}
+body.dragging, body.dragging * {
+ cursor: move !important;
+}
+
+.dragged {
+ position: absolute;
+ top: 0;
+ opacity: 0.5;
+ z-index: 2000;
+}
+
+ul#top_menu li.placeholder {
+ position: relative;
+ margin: 0;
+ padding: 0;
+ border: none;
+}
+ul#top_menu li.placeholder:before {
+ position: absolute;
+ content: "";
+ width: 0;
+ height: 0;
+ margin-top: -5px;
+ left: -5px;
+ top: -4px;
+ border: 5px solid transparent;
+ border-left-color: #990000;
+ border-right: none;
+}
+
/* ---- RTE ---- */
.oe_editable .btn {
-webkit-user-select: auto;
diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass
index 5dbe7a8eee9..ca60d7e474a 100644
--- a/addons/website/static/src/css/editor.sass
+++ b/addons/website/static/src/css/editor.sass
@@ -124,6 +124,35 @@ table.editorbar-panel
background: rgb(255, 255, 182)
// }}}
+// -------- MENU -------- {{{
+body.dragging, body.dragging *
+ cursor: move !important
+
+.dragged
+ position: absolute
+ top: 0
+ opacity: .5
+ z-index: 2000
+
+ul#top_menu
+ li.placeholder
+ position: relative
+ margin: 0
+ padding: 0
+ border: none
+ &:before
+ position: absolute
+ content: ""
+ width: 0
+ height: 0
+ margin-top: -5px
+ left: -5px
+ top: -4px
+ border: 5px solid transparent
+ border-left-color: #990000
+ border-right: none
+// }}}
+
/* ---- RTE ---- */
// bootstrap makes .btn elements unselectable -> RTE double-click can't know
diff --git a/addons/website/static/src/js/website.menu.js b/addons/website/static/src/js/website.menu.js
index a74d46814cd..d5f376a9c9a 100644
--- a/addons/website/static/src/js/website.menu.js
+++ b/addons/website/static/src/js/website.menu.js
@@ -15,6 +15,23 @@
$('.js_add_menu').on('click', function () {
return new website.menu.AddMenuDialog().appendTo(document.body);
});
+ $("#top_menu").sortable({
+ group: 'nav',
+ nested: true,
+ vertical: false,
+ exclude: '.divider',
+ onDragStart: function($item, container, _super) {
+ $item.find('ul.dropdown-menu').sortable('disable');
+ _super($item, container);
+ },
+ onDrop: function($item, container, _super) {
+ $item.find('ul.dropdown-menu').sortable('enable');
+ _super($item, container);
+ }
+ });
+ $("ul.dropdown-menu").sortable({
+ group: 'nav'
+ });
});
})();