forked from 0x2620/pandora
add addpdf button
This commit is contained in:
parent
bed9f39909
commit
9377f772e4
4 changed files with 96 additions and 86 deletions
|
|
@ -82,35 +82,39 @@ pandora.ui.folders = function() {
|
|||
}
|
||||
})
|
||||
];
|
||||
} else {
|
||||
} else if(ui.section == 'texts') {
|
||||
extras = [
|
||||
pandora.$ui.personalListsMenu = Ox.MenuButton({
|
||||
items: [
|
||||
{ id: 'new' + folderItem.toLowerCase(), title: 'New ' + folderItem },
|
||||
{ id: 'newtext', title: 'New Text' },
|
||||
{ id: 'newpdf', title: 'New PDF' },
|
||||
{},
|
||||
{ id: 'delete' + folderItem.toLowerCase(), title: 'Delete Selected ' + folderItem + '...', disabled: !ui[ui.section.slice(0,-1)] }
|
||||
{ id: 'deletetext', title: 'Delete Selected Text...', disabled: !ui.text }
|
||||
],
|
||||
title: 'edit',
|
||||
tooltip: 'Manage Personal ' + folderItems,
|
||||
tooltip: 'Manage Personal Texts',
|
||||
type: 'image'
|
||||
})
|
||||
.bindEvent({
|
||||
click: function(data) {
|
||||
var $list = pandora.$ui.folderList[folder.id];
|
||||
// fixme: duplicated
|
||||
if (data.id == 'new' + folderItem.toLowerCase()) {
|
||||
pandora['add' + folderItem]();
|
||||
} else if (data.id == 'delete' + folderItem.toLowerCase()) {
|
||||
if (data.id == 'newtext') {
|
||||
pandora.addText({type: 'text'});
|
||||
} else if (data.id == 'newpdf') {
|
||||
pandora.addText({type: 'pdf'});
|
||||
} else if (data.id == 'deletetext') {
|
||||
pandora.ui.deleteListDialog().open();
|
||||
}
|
||||
}
|
||||
})
|
||||
.bindEvent('pandora_' + ui.section.slice(0,-1), function(data) {
|
||||
.bindEvent('pandora_text', function(data) {
|
||||
pandora.$ui.personalListsMenu[
|
||||
data.value && data.value.length ? 'enableItem' : 'disableItem'
|
||||
]('delete' + folderItem.toLowerCase());
|
||||
]('deletetext');
|
||||
})
|
||||
];
|
||||
} else {
|
||||
extras = [];
|
||||
}
|
||||
}
|
||||
} else if (folder.id == 'favorite') {
|
||||
|
|
|
|||
|
|
@ -147,9 +147,10 @@ pandora.addList = function() {
|
|||
}).reloadList();
|
||||
}
|
||||
};
|
||||
pandora.addText = function() {
|
||||
pandora.addText = function(options) {
|
||||
var $folderList = pandora.$ui.folderList.personal;
|
||||
pandora.api.addText({name: 'Untitled'}, function(result) {
|
||||
options = options || {};
|
||||
pandora.api.addText(options, function(result) {
|
||||
reloadFolder(result.data.id);
|
||||
});
|
||||
function reloadFolder(newId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue