fix remove button state in news

This commit is contained in:
rolux 2018-10-13 12:21:36 +02:00
parent 1cd6079565
commit e78cab788f

View file

@ -127,30 +127,35 @@ pandora.ui.news = function(width, height) {
} }
function renderList() { function renderList() {
$right.empty(); var $addButton = Ox.Button({
if (isEditable) {
$('<div>')
.css({height: '16px', marginBottom: '8px'})
.append(
Ox.Button({
title: Ox._('Add'), title: Ox._('Add'),
width: 92 width: 92
}) })
.css({float: 'left', margin: '0 4px 0 0'}) .css({float: 'left', margin: '0 4px 0 0'})
.bindEvent({ .bindEvent({
click: addItem click: function() {
}) $removeButton.options({disabled: false});
) addItem();
.append( }
Ox.Button({ });
var $removeButton = Ox.Button({
disabled: items.length == 0,
title: Ox._('Remove'), title: Ox._('Remove'),
width: 92 width: 92
}) })
.css({float: 'left', margin: '0 0 0 4px'}) .css({float: 'left', margin: '0 0 0 4px'})
.bindEvent({ .bindEvent({
click: removeItem click: function() {
$removeButton.options({disabled: items.length == 1});
removeItem();
}
}) })
) $right.empty();
if (isEditable) {
$('<div>')
.css({height: '16px', marginBottom: '8px'})
.append($addButton)
.append($removeButton)
.appendTo($right); .appendTo($right);
} }
items.sort(function(a, b) { items.sort(function(a, b) {