fixed drag and drop breaking adminlte's design

- updated ControlSidebar.js to hide control sidebar instead of only moving it
- updated dashboard.js to use containment in sortable()
- added display none to control sidebar content in index.html

(Closes #1924)
pull/2125/head
REJack 2019-06-06 10:59:10 +02:00
parent 3254b3b60f
commit 2226c0e7cf
No known key found for this signature in database
GPG Key ID: 9F3976CC630CC888
5 changed files with 9 additions and 2 deletions

View File

@ -71,17 +71,20 @@
}; };
ControlSidebar.prototype.expand = function () { ControlSidebar.prototype.expand = function () {
$(Selector.sidebar).show();
if (!this.options.slide) { if (!this.options.slide) {
$('body').addClass(ClassName.open); $('body').addClass(ClassName.open);
} else { } else {
$(Selector.sidebar).addClass(ClassName.open); $(Selector.sidebar).addClass(ClassName.open);
} }
$(this.element).trigger($.Event(Event.expanded)); $(this.element).trigger($.Event(Event.expanded));
}; };
ControlSidebar.prototype.collapse = function () { ControlSidebar.prototype.collapse = function () {
$('body, ' + Selector.sidebar).removeClass(ClassName.open); $('body, ' + Selector.sidebar).removeClass(ClassName.open);
$(Selector.sidebar).fadeOut();
$(this.element).trigger($.Event(Event.collapsed)); $(this.element).trigger($.Event(Event.collapsed));
}; };

3
dist/js/adminlte.js vendored
View File

@ -389,17 +389,20 @@ throw new Error('AdminLTE requires jQuery')
}; };
ControlSidebar.prototype.expand = function () { ControlSidebar.prototype.expand = function () {
$(Selector.sidebar).show();
if (!this.options.slide) { if (!this.options.slide) {
$('body').addClass(ClassName.open); $('body').addClass(ClassName.open);
} else { } else {
$(Selector.sidebar).addClass(ClassName.open); $(Selector.sidebar).addClass(ClassName.open);
} }
$(this.element).trigger($.Event(Event.expanded)); $(this.element).trigger($.Event(Event.expanded));
}; };
ControlSidebar.prototype.collapse = function () { ControlSidebar.prototype.collapse = function () {
$('body, ' + Selector.sidebar).removeClass(ClassName.open); $('body, ' + Selector.sidebar).removeClass(ClassName.open);
$(Selector.sidebar).fadeOut();
$(this.element).trigger($.Event(Event.collapsed)); $(this.element).trigger($.Event(Event.collapsed));
}; };

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,7 @@ $(function () {
// Make the dashboard widgets sortable Using jquery UI // Make the dashboard widgets sortable Using jquery UI
$('.connectedSortable').sortable({ $('.connectedSortable').sortable({
containment : $('section.content'),
placeholder : 'sort-highlight', placeholder : 'sort-highlight',
connectWith : '.connectedSortable', connectWith : '.connectedSortable',
handle : '.box-header, .nav-tabs', handle : '.box-header, .nav-tabs',

View File

@ -1035,7 +1035,7 @@
</footer> </footer>
<!-- Control Sidebar --> <!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark"> <aside class="control-sidebar control-sidebar-dark" style="display: none;">
<!-- Create the tabs --> <!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs"> <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li> <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>