updateElement

This commit is contained in:
j 2014-05-17 13:45:57 +02:00
commit 877e867d03
35 changed files with 516 additions and 314 deletions

View file

@ -94,12 +94,12 @@ oml.ui.appDialog = function() {
},
'oml_part.app': function() {
if (ui.page == 'app') {
that.update();
that.updateElement();
}
}
});
that.update = function(section) {
that.updateElement = function(section) {
$panel.selectTab(section);
};

View file

@ -0,0 +1,37 @@
'use strict';
oml.ui.deleteItemsDialog = function() {
var ui = oml.user.ui,
items = ui.listSelection,
itemsName = Ox._(items.length == 1 ? 'Item' : 'Items'),
theseItemsName = items.length == 1
? Ox._('this item')
: Ox._('these {0} items', [Ox.formatNumber(items.length)]),
that = oml.ui.confirmDialog({
buttons: [
Ox.Button({
title: Ox._('No, Keep {0}', [itemsName])
}),
Ox.Button({
title: Ox._('Yes, Delete {0}', [itemsName])
})
],
content: Ox._('Are you sure that you want to permanently delete {0}?', [theseItemsName]),
title: Ox._('Delete {0}', [itemsName])
}, function() {
oml.api.remove({
ids: items
}, function() {
oml.UI.set({listSelection: []});
Ox.Request.clearCache('find');
oml.$ui.folders.updateElement();
oml.$ui.list.updateElement();
});
});
return that;
};

View file

@ -54,7 +54,7 @@ oml.ui.errorDialog = function() {
return that;
};
that.update = function(data) {
that.updateElement = function(data) {
// 0 (timeout) or 500 (error)
var error = data.status.code == 0 ? 'a timeout' : 'an error',
title = data.status.code == 0 ? 'Timeout' : 'Error';

View file

@ -88,7 +88,7 @@ oml.ui.filtersOuterPanel = function() {
oml.updateFilterMenus();
that.update = function() {
that.updateElement = function() {
var filterSizes = oml.getFilterSizes();
that.size(0, filterSizes[0])
.size(2, filterSizes[4]);

View file

@ -11,10 +11,10 @@ oml.ui.folderPlaceholder = function(text) {
padding: '1px 4px',
});
that.updateText = function(text) {
that.updateElement = function(text) {
return that.html(text);
};
return that.updateText(text);
return that.updateElement(text);
};

View file

@ -4,9 +4,9 @@ oml.ui.folders = function() {
var ui = oml.user.ui,
userIndex = {},
userIndex,
$lists = [],
$lists,
that = Ox.Element()
.css({
@ -17,219 +17,6 @@ oml.ui.folders = function() {
oml_find: selectList
});
$lists.push(
oml.$ui.librariesList = oml.ui.folderList({
items: [
{
id: '',
name: Ox._('All Libraries'),
type: 'libraries',
items: -1
}
]
})
.bindEvent({
load: function() {
oml.api.find({query: getFind()}, function(result) {
oml.$ui.librariesList.value('', 'items', result.data.items);
});
},
select: function() {
oml.UI.set({find: getFind('')});
oml.$ui.librariesList.options({selected: ['']});
},
selectnext: function() {
oml.UI.set(Ox.extend(
{find: getFind(':')},
'showFolder.' + oml.user.preferences.username,
true
));
},
})
.css({height: '16px'})
.appendTo(that)
);
oml.$ui.librariesList.$body.css({height: '16px'}); // FIXME!
oml.$ui.folder = [];
oml.$ui.libraryList = [];
oml.$ui.folderList = [];
oml.getUsersAndLists(function(users, lists) {
Ox.print('GOT USERS AND LISTS', users, lists);
users.forEach(function(user, index) {
var $content,
items = lists.filter(function(list) {
return list.user == user.nickname
&& list.type != 'library';
}),
libraryId = (!index ? '' : user.nickname) + ':'
userIndex[user.nickname] = index;
oml.$ui.folder[index] = Ox.CollapsePanel({
collapsed: false,
extras: [
oml.ui.statusIcon(
!oml.user.online && index ? 'unknown'
: user.online ? 'connected'
: 'disconnected'
),
{},
Ox.Button({
style: 'symbol',
title: 'info',
tooltip: Ox._(!index ? 'Preferences' : 'Profile'),
type: 'image'
})
.bindEvent({
click: function() {
if (!index) {
oml.UI.set({
page: 'preferences',
'part.preferences': 'account'
});
} else {
oml.UI.set({page: 'users'})
}
}
})
],
title: Ox.encodeHTMLEntities(user.nickname)
})
.css({
width: ui.sidebarSize
})
.bindEvent({
toggle: function(data) {
oml.UI.set('showFolder.' + user.nickname, !data.collapsed);
}
})
.bindEvent(
'oml_showfolder.' + user.nickname.toLowerCase(),
function(data) {
oml.$ui.folder[index].options({collapsed: !data.value});
}
)
.appendTo(that);
$content = oml.$ui.folder[index].$content
.css({
height: (1 + items.length) * 16 + 'px'
});
$lists.push(
oml.$ui.libraryList[index] = oml.ui.folderList({
items: [
{
id: libraryId,
name: Ox._('Library'),
type: 'library',
items: -1
}
]
})
.bindEvent({
add: function() {
!index && oml.addList();
},
load: function() {
oml.api.find({
query: getFind(libraryId)
}, function(result) {
oml.$ui.libraryList[index].value(
libraryId, 'items', result.data.items
);
});
},
select: function(data) {
oml.UI.set({find: getFind(data.ids[0])});
},
selectnext: function() {
oml.UI.set({find: getFind(lists[user.id][0].id)});
},
selectprevious: function() {
var userId = !index ? null : users[index - 1].id,
set = {
find: getFind(
!index
? ''
: Ox.last(lists[userId]).id
)
};
if (userId) {
Ox.extend(set, 'showFolder.' + userId, true);
}
oml.UI.set(set);
}
})
.appendTo($content)
);
$lists.push(
oml.$ui.folderList[index] = oml.ui.folderList({
draggable: !!index,
items: items,
sortable: !index
})
.bindEvent({
add: function() {
!index && oml.addList();
},
'delete': function() {
!index && oml.ui.deleteListDialog().open();
},
key_control_d: function() {
oml.addList(ui._list);
},
load: function() {
// ...
},
move: function(data) {
lists[user.id] = data.ids.map(function(listId) {
return Ox.getObjectById(lists[user.id], listId);
});
oml.api.sortLists({
ids: data.ids,
user: user.id
}, function(result) {
// ...
});
},
open: function() {
!index && oml.ui.listDialog().open();
},
select: function(data) {
oml.UI.set({find: getFind(data.ids[0])});
},
selectnext: function() {
if (index < users.length - 1) {
oml.UI.set(Ox.extend(
{find: getFind(users[index + 1].nickname + ':')},
'showFolder.' + users[index + 1].nickname,
true
));
}
},
selectprevious: function() {
oml.UI.set({find: getFind(libraryId)});
}
})
.css({height: items.length * 16 + 'px'})
.appendTo($content)
);
oml.$ui.folderList[index].$body.css({top: '16px'});
});
selectList();
});
function getFind(list) {
return {
conditions: list ? [{
@ -257,6 +44,230 @@ oml.ui.folders = function() {
});
}
return that;
that.updateElement = function() {
that.empty();
$lists = [];
$lists.push(
oml.$ui.librariesList = oml.ui.folderList({
items: [
{
id: '',
name: Ox._('All Libraries'),
type: 'libraries',
items: -1
}
]
})
.bindEvent({
load: function() {
oml.api.find({query: getFind()}, function(result) {
oml.$ui.librariesList.value('', 'items', result.data.items);
});
},
select: function() {
oml.UI.set({find: getFind('')});
oml.$ui.librariesList.options({selected: ['']});
},
selectnext: function() {
oml.UI.set(Ox.extend(
{find: getFind(':')},
'showFolder.' + oml.user.preferences.username,
true
));
},
})
.css({height: '16px'})
.appendTo(that)
);
oml.$ui.librariesList.$body.css({height: '16px'}); // FIXME!
oml.$ui.folder = [];
oml.$ui.libraryList = [];
oml.$ui.folderList = [];
oml.getUsersAndLists(function(users, lists) {
Ox.print('GOT USERS AND LISTS', users, lists);
userIndex = {};
users.forEach(function(user, index) {
var $content,
items = lists.filter(function(list) {
return list.user == user.nickname
&& list.type != 'library';
}),
libraryId = (!index ? '' : user.nickname) + ':'
userIndex[user.nickname] = index;
oml.$ui.folder[index] = Ox.CollapsePanel({
collapsed: false,
extras: [
oml.ui.statusIcon(
!oml.user.online && index ? 'unknown'
: user.online ? 'connected'
: 'disconnected'
),
{},
Ox.Button({
style: 'symbol',
title: 'info',
tooltip: Ox._(!index ? 'Preferences' : 'Profile'),
type: 'image'
})
.bindEvent({
click: function() {
if (!index) {
oml.UI.set({
page: 'preferences',
'part.preferences': 'account'
});
} else {
oml.UI.set({page: 'users'})
}
}
})
],
title: Ox.encodeHTMLEntities(user.nickname)
})
.css({
width: ui.sidebarSize
})
.bindEvent({
toggle: function(data) {
oml.UI.set('showFolder.' + user.nickname, !data.collapsed);
}
})
.bindEvent(
'oml_showfolder.' + user.nickname.toLowerCase(),
function(data) {
oml.$ui.folder[index].options({collapsed: !data.value});
}
)
.appendTo(that);
$content = oml.$ui.folder[index].$content
.css({
height: (1 + items.length) * 16 + 'px'
});
$lists.push(
oml.$ui.libraryList[index] = oml.ui.folderList({
items: [
{
id: libraryId,
name: Ox._('Library'),
type: 'library',
items: -1
}
]
})
.bindEvent({
add: function() {
!index && oml.addList();
},
load: function() {
oml.api.find({
query: getFind(libraryId)
}, function(result) {
oml.$ui.libraryList[index].value(
libraryId, 'items', result.data.items
);
});
},
select: function(data) {
oml.UI.set({find: getFind(data.ids[0])});
},
selectnext: function() {
oml.UI.set({find: getFind(items[0].id)});
},
selectprevious: function() {
var userId = !index ? null : users[index - 1].id,
set = {
find: getFind(
!index
? ''
: Ox.last(lists[userId]).id
)
};
if (userId) {
Ox.extend(set, 'showFolder.' + userId, true);
}
oml.UI.set(set);
}
})
.appendTo($content)
);
$lists.push(
oml.$ui.folderList[index] = oml.ui.folderList({
draggable: !!index,
items: items,
sortable: !index
})
.bindEvent({
add: function() {
!index && oml.addList();
},
'delete': function() {
!index && oml.ui.deleteListDialog().open();
},
key_control_d: function() {
oml.addList(ui._list);
},
load: function() {
// ...
},
move: function(data) {
lists[user.id] = data.ids.map(function(listId) {
return Ox.getObjectById(items, listId);
});
oml.api.sortLists({
ids: data.ids,
user: user.id
}, function(result) {
// ...
});
},
open: function() {
!index && oml.ui.listDialog().open();
},
select: function(data) {
oml.UI.set({find: getFind(data.ids[0])});
},
selectnext: function() {
if (index < users.length - 1) {
oml.UI.set(Ox.extend(
{find: getFind(users[index + 1].nickname + ':')},
'showFolder.' + users[index + 1].nickname,
true
));
}
},
selectprevious: function() {
oml.UI.set({find: getFind(libraryId)});
}
})
.css({height: items.length * 16 + 'px'})
.appendTo($content)
);
oml.$ui.folderList[index].$body.css({top: '16px'});
});
selectList();
});
return that;
};
return that.updateElement();
};

View file

@ -19,16 +19,16 @@ oml.ui.fullscreenButton = function() {
Ox.Fullscreen.enter(oml.$ui.viewer.find('iframe')[0]);
},
oml_itemview: function() {
that.update();
that.updateElement();
}
});
that.update = function() {
that.updateElement = function() {
return that.options({
disabled: ui.itemView != 'book'
});
};
return that.update();
return that.updateElement();
};

View file

@ -135,7 +135,7 @@ oml.ui.identifyDialog = function(data) {
Ox.Request.clearCache('find');
oml.$ui.browser.reloadList(true);
Ox.Request.clearCache(data.id);
oml.$ui.infoView.update(result.data);
oml.$ui.infoView.updateElement(result.data);
});
}
})

View file

@ -6,21 +6,21 @@ oml.ui.info = function() {
that = Ox.Element()
.addClass('OxTextPage')
.css({
padding: '0 16px',
.css({
padding: '0 16px',
textAlign: 'center',
overflowY: 'auto'
})
.bindEvent({
overflowY: 'auto'
})
.bindEvent({
oml_item: function() {
that.update();
that.updateElement();
},
oml_listselection: function() {
that.update();
}
});
oml_listselection: function() {
that.updateElement();
}
});
that.update = function() {
that.updateElement = function() {
var id = ui.item || ui.listSelection[0];
if (id) {
oml.api.get({
@ -64,6 +64,6 @@ oml.ui.info = function() {
return that;
};
return that.update();
return that.updateElement();
};

View file

@ -10,12 +10,12 @@ oml.ui.infoView = function(identifyData) {
.bindEvent({
oml_item: function() {
if (ui.item) {
that.update(ui.item);
that.updateElement(ui.item);
}
},
oml_listselection: function(data) {
if (data.value && data.value.length) {
that.update(data.value[0]);
that.updateElement(data.value[0]);
}
}
}),
@ -141,7 +141,7 @@ oml.ui.infoView = function(identifyData) {
.bindEvent({
click: function() {
data.mediastate = 'transferring';
that.update(data, $data);
that.updateElement(data, $data);
oml.api.download({id: ui.item}, function(result) {
// ...
});
@ -158,7 +158,7 @@ oml.ui.infoView = function(identifyData) {
.bindEvent({
click: function(data) {
data.mediastate = 'transferring';
that.update(data, $data);
that.updateElement(data, $data);
oml.api.download(Ox.extend({
id: ui.item,
}, data.id == ':' ? {} : {
@ -192,9 +192,9 @@ oml.ui.infoView = function(identifyData) {
.bindEvent({
click: function() {
data.mediastate = 'unavailable';
that.update(data, $data);
that.updateElement(data, $data);
oml.api.cancelDownload({id: ui.item}, function() {
that.update(ui.item, $data);
that.updateElement(ui.item, $data);
});
}
})
@ -232,7 +232,7 @@ oml.ui.infoView = function(identifyData) {
}).show();
}
that.update = function(idOrData, $elements) {
that.updateElement = function(idOrData, $elements) {
var data = Ox.isObject(idOrData) ? idOrData : null,
id = data ? null : idOrData,
@ -509,7 +509,7 @@ oml.ui.infoView = function(identifyData) {
oml.api.edit(edit, function(result) {
Ox.Request.clearCache('find');
oml.$ui.browser.reloadList();
that.update(result.data, $data);
that.updateElement(result.data, $data);
});
}
}
@ -519,16 +519,16 @@ oml.ui.infoView = function(identifyData) {
};
if (!identifyData) {
ui.item && that.update(ui.item);
ui.item && that.updateElement(ui.item);
} else {
that.update(identifyData, [$cover, $info]);
that.updateElement(identifyData, [$cover, $info]);
}
oml.bindEvent({
transfer: function(data) {
if (data.id == ui.item && data.progress == 1) {
Ox.Request.clearCache(); // FIXME: too much
that.update(ui.item, [$info, $data]);
that.updateElement(ui.item, [$info, $data]);
}
}
});

View file

@ -30,17 +30,17 @@ oml.ui.itemViewButtons = function() {
},
oml_item: function() {
if (ui.item) {
that.update();
that.updateElement();
} else {
that.disableButton('book');
}
},
oml_itemview: function(data) {
that.update();
that.updateElement();
}
});
that.update = function() {
that.updateElement = function() {
var item = ui.item;
that.options({
disabled: ui.itemView != 'book',
@ -68,6 +68,6 @@ oml.ui.itemViewButtons = function() {
}
});
return that.update();
return that.updateElement();
};

View file

@ -11,9 +11,50 @@ oml.ui.list = function() {
oml.$ui.previewDialog.close();
delete oml.$ui.previewDialog;
},
copy: function(data) {
oml.clipboard.copy(data.ids, 'item');
},
copyadd: function(data) {
oml.clipboard.copy(data.ids, 'item');
},
cut: function(data) {
var listData = oml.getListData();
if (listData.editable && listData.type == 'static') {
oml.clipboard.copy(data.ids, 'item');
oml.doHistory('cut', data.ids, ui._list, function() {
oml.UI.set({listSelection: []});
oml.reloadList();
});
}
},
cutadd: function(data) {
var listData = oml.getListData();
if (listData.editable && listData.type == 'static') {
oml.clipboard.add(data.ids, 'item');
oml.doHistory('cut', data.ids, ui._list, function() {
oml.UI.set({listSelection: []});
oml.reloadList();
});
}
},
'delete': function() {
var listData = oml.getListData();
if (listData.editable && listData.type == 'static') {
oml.doHistory('delete', data.ids, ui._list, function() {
oml.UI.set({listSelection: []});
oml.reloadList();
});
}
},
init: function(data) {
oml.$ui.statusbar.set('total', data);
},
key_control_delete: function() {
var listData = oml.getListData();
if (listData.own) {
oml.ui.deleteItemsDialog().open();
}
},
open: function(data) {
oml.UI.set({
item: data.ids[0],
@ -32,7 +73,7 @@ oml.ui.list = function() {
}
});
} else {
oml.$ui.previewDialog.update();
oml.$ui.previewDialog.updateElement();
}
},
resize: function(data) {
@ -65,6 +106,10 @@ oml.ui.list = function() {
oml.enableDragAndDrop(that);
that.updateElement = function() {
that.reloadList(true);
};
return that;
};

View file

@ -40,7 +40,7 @@ oml.ui.loadingIcon = function() {
}
};
that.update = function(requests) {
that.updateElement = function(requests) {
that[requests ? 'start' : 'stop']();
};

View file

@ -319,8 +319,30 @@ oml.ui.mainMenu = function() {
oml.UI.set({showFileInfo: value});
} else if (id == 'fileinfo') {
oml.UI.set({fileInfo: value});
} else if (id == 'sort') {
oml.UI.set({
listSort: [{
key: value,
operator: oml.getSortOperator(value)
}]
});
} else if (id == 'order') {
oml.UI.set({
listSort: [{
key: ui.listSort[0].key,
operator: value == 'ascending' ? '+' : '-'
}]
});
} else if (id == 'find') {
if (value) {
oml.$ui.findSelect.value(value);
if (ui._findState.key == 'advanced') {
// fixme: autocomplete function doesn't get updated
pandora.$ui.findInput.options({placeholder: ''});
}
}
} else {
Ox.print('MAIN MENU DOES NOT YET HANDLE', id);
Ox.print('MAIN MENU DOES NOT YET HANDLE', id, data);
}
},
click: function(data) {
@ -441,6 +463,9 @@ oml.ui.mainMenu = function() {
that.options('menus')[0].element.trigger('click');
}
},
key_control_shift_f: function() {
Ox.print('FIXME: NOT IMPLEMENTED')
},
key_control_shift_w: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({
@ -628,7 +653,7 @@ oml.ui.mainMenu = function() {
id: 'deletefromlibrary',
title: Ox._('Delete {0} from Library...', [selectionItemName]),
disabled: !canDelete,
keyboard: 'shift delete'
keyboard: 'control delete'
},
{},
{
@ -716,19 +741,19 @@ oml.ui.mainMenu = function() {
id: 'editlist',
title: Ox._('Edit List...'),
keyboard: 'return',
disabled: !isOwnList
disabled: !isList || !isOwnList
},
{
id: 'deletelist',
title: Ox._('Delete List...'),
keyboard: 'delete',
disabled: !isOwnList
disabled: !isList || !isOwnList
}
])
};
}
that.update = function(menu) {
that.updateElement = function(menu) {
(
menu ? Ox.makeArray(menu) : ['listMenu', 'editMenu']
).forEach(function(menu) {

View file

@ -91,13 +91,13 @@
oml.clipboard = Ox.Clipboard();
oml.history = Ox.History();
oml.$ui.appPanel = oml.ui.appPanel().appendTo(Ox.$body);
oml.$ui.loadingIcon.update(Ox.Request.requests());
oml.$ui.loadingIcon.updateElement(Ox.Request.requests());
Ox.Request.bindEvent({
error: function(data) {
oml.$ui.errorDialog = oml.ui.errorDialog().update(data).open();
oml.$ui.errorDialog = oml.ui.errorDialog().updateElement(data).open();
},
request: function(data) {
oml.$ui.loadingIcon.update(data.requests);
oml.$ui.loadingIcon.updateElement(data.requests);
}
});
if (oml.user.preferences.extensions) {

View file

@ -23,10 +23,10 @@ oml.ui.openButton = function() {
}
});
that.update = function() {
that.updateElement = function() {
return that.options({disabled: ui.listSelection.length == 0});
};
return that.update();
return that.updateElement();
};

View file

@ -297,7 +297,7 @@ oml.ui.preferencesDialog = function() {
},
'oml_part.preferences': function() {
if (ui.page == 'preferences') {
that.update();
that.updateElement();
}
}
});
@ -308,7 +308,7 @@ oml.ui.preferencesDialog = function() {
$helpElement.show();
}
that.update = function() {
that.updateElement = function() {
var $form,
$formTitle,
@ -439,6 +439,6 @@ oml.ui.preferencesDialog = function() {
};
return that.update();
return that.updateElement();
};

View file

@ -20,15 +20,15 @@ oml.ui.previewButton = function() {
oml.$ui.list[data.value ? 'openPreview' : 'closePreview']();
},
oml_listselection: function() {
that.update();
that.updateElement();
}
});
that.update = function() {
that.updateElement = function() {
return that.options({disabled: ui.listSelection.length == 0});
};
return that.update();
return that.updateElement();
};

View file

@ -52,7 +52,7 @@ oml.ui.previewDialog = function() {
};
}
that.update = function() {
that.updateElement = function() {
oml.api.get({
id: Ox.last($list.options('selected')),
keys: ['coverRatio', 'id', 'modified', 'title']
@ -87,6 +87,6 @@ oml.ui.previewDialog = function() {
return that;
};
return that.update();
return that.updateElement();
};

View file

@ -22,7 +22,7 @@ oml.ui.rightPanel = function() {
.bindEvent({
resize: function(data) {
that.options({size: data.size});
oml.$ui.filtersOuterPanel.update();
oml.$ui.filtersOuterPanel.updateElement();
oml.$ui.itemViewPanel.options({size: data.size});
},
oml_item: function(data) {

View file

@ -18,10 +18,7 @@ oml.ui.sortElement = function() {
change: function(data) {
var key = data.value;
oml.UI.set({
listSort: [{
key: key,
operator: oml.getSortOperator(key)
}]
listSort: [{key: key, operator: oml.getSortOperator(key)}]
});
}
}),
@ -54,7 +51,7 @@ oml.ui.sortElement = function() {
})
.bindEvent({
oml_listsort: function() {
that.update();
that.updateElement();
}
});
@ -66,7 +63,7 @@ oml.ui.sortElement = function() {
return Ox._(ui.listSort[0].operator == '+' ? 'Ascending' : 'Descending');
}
that.update = function() {
that.updateElement = function() {
$sortSelect.value(ui.listSort[0].key);
$orderButton.options({
title: getButtonTitle(),
@ -75,6 +72,6 @@ oml.ui.sortElement = function() {
return that;
};
return that.update();
return that.updateElement();
};

View file

@ -519,7 +519,7 @@ oml.ui.usersDialog = function() {
}
function updateUsers(callback) {
Ox.Request.clearCache('getUsers');
oml.api.getUsers(function(result) {
users = result.data.users;
@ -582,7 +582,7 @@ oml.ui.usersDialog = function() {
}
that.update = function() {
that.updateElement = function() {
that.options({
content: Ox.LoadingScreen().start()
@ -592,6 +592,6 @@ oml.ui.usersDialog = function() {
};
return that.update();
return that.updateElement();
};

View file

@ -283,7 +283,7 @@ oml.enableDragAndDrop = function($list, canMove) {
editable: data.editable || (
data.type == 'library'
&& drag.source.user != username
&& data.user == 'username'
&& data.user == username
),
selected: data.id == ui._list
}, data);
@ -773,6 +773,8 @@ oml.getUsersAndLists = function(callback) {
nickname: username,
online: oml.user.online
}];
Ox.Request.clearCache('getUsers');
Ox.Request.clearCache('getLists');
oml.api.getUsers(function(result) {
users = users.concat(
result.data.users.filter(function(user) {
@ -793,13 +795,15 @@ oml.getUsersAndLists = function(callback) {
));
});
lists = lists.map(function(list) {
// FIXME: 'editable' is notoriously vague
return Ox.extend(list, {
editable: list.user == username && list.type == 'static',
own: list.user == username,
title: (list.user ? list.user + ': ' : '') + list.name
});
})
if (!ui.lists) {
oml.$ui.mainMenu.update();
oml.$ui.mainMenu.updateElement();
}
ui._lists = lists;
Ox.print('UI._LISTS', JSON.stringify(ui._lists));
@ -829,17 +833,19 @@ oml.resizeListFolders = function() {
var width = oml.getListFoldersWidth(),
columnWidth = width - 58;
oml.$ui.librariesList
.resizeColumn('name', columnWidth)
.css({width: width + 'px'});
.css({width: width + 'px'})
.resizeColumn('name', columnWidth);
Ox.forEach(oml.$ui.folder, function($folder, index) {
$folder.css({width: width + 'px'});
Ox.print('SHOULD BE:', width);
oml.$ui.libraryList[index]
.resizeColumn('name', columnWidth)
.css({width: width + 'px'});
.css({width: width + 'px'})
.resizeColumn('name', columnWidth);
oml.$ui.folderList[index]
.resizeColumn('name', columnWidth)
.css({width: width + 'px'});
.css({width: width + 'px'})
.resizeColumn('name', columnWidth);
});
/*
oml.$ui.librariesList
.$body.find('.OxContent')
.css({width: width + 'px'});
@ -851,6 +857,7 @@ oml.resizeListFolders = function() {
.$body.find('.OxContent')
.css({width: width + 'px'});
})
*/
};
oml.updateFilterMenus = function() {

View file

@ -7,16 +7,16 @@ oml.ui.viewer = function() {
that = Ox.Element()
.bindEvent({
oml_item: function(data) {
that.update();
that.updateElement();
},
oml_itemview: function(data) {
that.update();
that.updateElement();
}
}),
$iframe;
that.update = function() {
that.updateElement = function() {
if (ui.item && ui.itemView == 'book') {
$iframe = $iframe || Ox.Element('<iframe>').css({
width: '100%',
@ -30,6 +30,6 @@ oml.ui.viewer = function() {
return that;
};
return that.update();
return that.updateElement();
};

View file

@ -10,6 +10,7 @@
"columnView.js",
"confirmDialog.js",
"connectionButton.js",
"deleteItemsDialog.js",
"deleteListDialog.js",
"errorDialog.js",
"filter.js",