fix lists rename bug

This commit is contained in:
rolux 2011-01-13 22:36:51 +00:00
parent e9724760d9
commit 18bc00dea0

View file

@ -1094,27 +1094,19 @@ var pandora = new Ox.App({
delete app.$ui.sectionSelect; delete app.$ui.sectionSelect;
app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons()); app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons());
} }
///* app.$ui.sectionLists.forEach(function($list) {
Ox.print('data', data); $list.css({width: data + 'px'});
app.$ui.leftPanel.find('.OxTextList').css({ $list.resizeColumn('name', data - 88);
width: data + 'px'
}); });
app.$ui.leftPanel.find('.OxTextList .OxContent').css({
width: data + 'px'
});
app.$ui.leftPanel.find('.OxItem').css({
width: data + 'px'
});
app.$ui.leftPanel.find('.OxCell.OxColumnName').css({
width: (data - 96) + 'px'
});
Ox.print(app.$ui.leftPanel.find('.OxCell.OxColumnName').css('width'))
//*/
//Ox.print('resize', data, data / app.ui.infoRatio + 16);
app.$ui.leftPanel.size('infoPanel', Math.round(data / app.ui.infoRatio) + 16); app.$ui.leftPanel.size('infoPanel', Math.round(data / app.ui.infoRatio) + 16);
}, },
toggle: function(event, data) { toggle: function(event, data) {
app.user.ui.showSidebar = !data.collapsed; app.user.ui.showSidebar = !data.collapsed;
if (data.collapsed) {
app.$ui.sectionLists.forEach(function($list) {
$list.loseFocus();
});
}
} }
}); });
return that; return that;
@ -2144,6 +2136,7 @@ var pandora = new Ox.App({
type: data.id == 'new' ? 'static' : 'smart' type: data.id == 'new' ? 'static' : 'smart'
}, function(result) { }, function(result) {
id = result.data.id; id = result.data.id;
URL.set('?find=list:' + id)
Ox.Request.emptyCache(); // fixme: remove Ox.Request.emptyCache(); // fixme: remove
$list.reloadList() $list.reloadList()
.bindEvent({load: load}); .bindEvent({load: load});
@ -2153,9 +2146,12 @@ var pandora = new Ox.App({
$list.gainFocus() $list.gainFocus()
.options({selected: [id]}) .options({selected: [id]})
.editCell(id, 'name'); .editCell(id, 'name');
Ox.print('load', id, $list.options('selected'))
$list.unbindEvent({load: load}) // fixme: need bindEventOnce $list.unbindEvent({load: load}) // fixme: need bindEventOnce
} }
},
toggle: function(event, data) {
Ox.print('toggle')
data.collapsed && app.$ui.sectionLists[i].loseFocus();
} }
}); });
$sections.push($section); $sections.push($section);
@ -2358,7 +2354,7 @@ var pandora = new Ox.App({
data_ = {id: data.id}; data_ = {id: data.id};
data_[data.key] = data.value; data_[data.key] = data.value;
pandora.api.editList(data_, function(result) { pandora.api.editList(data_, function(result) {
if (result.data.name != data_.name) { if (result.data.id != data.id) {
app.$ui.sectionLists[i].value(data.id, 'name', result.data.name); app.$ui.sectionLists[i].value(data.id, 'name', result.data.name);
app.$ui.sectionLists[i].value(data.id, 'id', result.data.id); app.$ui.sectionLists[i].value(data.id, 'id', result.data.id);
URL.set('?find=list:' + result.data.id); URL.set('?find=list:' + result.data.id);