[ADD] Menu drag'n dro

bzr revid: fme@openerp.com-20131029083718-e6jrinmh6z48vn5j
This commit is contained in:
Fabien Meghazi 2013-10-29 09:37:18 +01:00
parent 2fc5da3f95
commit 2d0158d8cc
3 changed files with 77 additions and 0 deletions

View File

@ -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;

View File

@ -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

View File

@ -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'
});
});
})();