Remove the dropup when there are no widgets

Fixes #2123
This commit is contained in:
Samuel Georges 2016-07-03 14:53:37 +10:00
parent 43eb8c4946
commit 49641a31d0
2 changed files with 11 additions and 3 deletions

View File

@ -19,6 +19,7 @@
this.options = options
this.$el= $(element)
this.$form = this.$el.closest('form')
this.$toolbar = $('[data-container-toolbar]', this.$form)
this.alias = $('[data-container-alias]', this.$form).val()
this.init();
@ -40,7 +41,7 @@
$(window).resize($.proxy(this.updateWidth, this))
this.updateWidth()
if (!Modernizr.touch)
if (!Modernizr.touch) {
this.$el.sortable({
vertical: false,
handle: '.drag-handle',
@ -53,6 +54,7 @@
self.postSortOrders()
}
})
}
this.$el.on('hidden.oc.inspector', '[data-inspectable]', function() {
var values = $('[data-inspector-values]', this).val(),
@ -126,7 +128,11 @@
.isotope('reloadItems')
.isotope({ sortBy: 'original-order' })
$('li.item', this.$el).css({'width': '', 'height': ''})
var $items = $('li.item', this.$el)
$items.css({'width': '', 'height': ''})
$('> .dropdown', this.$toolbar).toggleClass('dropup', !!$items.length)
}
ReportContainer.prototype.setSortOrders = function() {

View File

@ -9,6 +9,8 @@
</ul>
<?php if ($this->canAddAndDelete): ?>
<?= $this->makePartial('widget_toolbar') ?>
<div id="<?= $this->getId('container-toolbar') ?>" data-container-toolbar>
<?= $this->makePartial('widget_toolbar') ?>
</div>
<?php endif ?>
</div>