forked from 0x2620/pandora
fix bugs in edit menu and manage personal edits menu
This commit is contained in:
parent
0069fa3f74
commit
ac219da8e5
2 changed files with 21 additions and 11 deletions
|
@ -94,7 +94,7 @@ pandora.ui.folders = function(section) {
|
||||||
pandora.$ui.personalListsMenu = Ox.MenuButton({
|
pandora.$ui.personalListsMenu = Ox.MenuButton({
|
||||||
items: [
|
items: [
|
||||||
{ id: 'newedit', title: Ox._('New Edit'), keyboard: 'control n' },
|
{ id: 'newedit', title: Ox._('New Edit'), keyboard: 'control n' },
|
||||||
{ id: 'neweditfromselection', title: Ox._('New Edit from Selection'), keyboard: 'shift control n', disabled: ui.edit && ui.edits[ui.edit].selection.length },
|
{ id: 'neweditfromselection', title: Ox._('New Edit from Selection'), keyboard: 'shift control n', disabled: !ui.edit || !ui.editSelection.length },
|
||||||
{ id: 'newsmartedit', title: Ox._('New Smart Edit'), keyboard: 'alt control n'},
|
{ id: 'newsmartedit', title: Ox._('New Smart Edit'), keyboard: 'alt control n'},
|
||||||
{},
|
{},
|
||||||
{ id: 'duplicateedit', title: Ox._('Duplicate Selected Edit'), keyboard: 'control d', disabled: !ui.edit },
|
{ id: 'duplicateedit', title: Ox._('Duplicate Selected Edit'), keyboard: 'control d', disabled: !ui.edit },
|
||||||
|
@ -123,15 +123,22 @@ pandora.ui.folders = function(section) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.bindEvent('pandora_edit', function(data) {
|
.bindEvent({
|
||||||
var action = ui.edit
|
pandora_edit: function(data) {
|
||||||
&& pandora.getListData(ui.edit).user == pandora.user.username
|
var action = ui.edit
|
||||||
? 'enableItem' : 'disableItem';
|
&& pandora.getListData(ui.edit).user == pandora.user.username
|
||||||
pandora.$ui.personalListsMenu[
|
? 'enableItem' : 'disableItem';
|
||||||
ui.edit ? 'enableItem' : 'disableItem'
|
pandora.$ui.personalListsMenu[
|
||||||
]('duplicateedit');
|
ui.edit ? 'enableItem' : 'disableItem'
|
||||||
pandora.$ui.personalListsMenu[action]('editedit');
|
]('duplicateedit');
|
||||||
pandora.$ui.personalListsMenu[action]('deleteedit');
|
pandora.$ui.personalListsMenu[action]('editedit');
|
||||||
|
pandora.$ui.personalListsMenu[action]('deleteedit');
|
||||||
|
},
|
||||||
|
pandora_editselection: function(data) {
|
||||||
|
pandora.$ui.personalListsMenu[
|
||||||
|
data.value.length ? 'enableItem' : 'disableItem'
|
||||||
|
]('neweditfromselection');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
} else if (section == 'texts') {
|
} else if (section == 'texts') {
|
||||||
|
|
|
@ -656,6 +656,9 @@ pandora.ui.mainMenu = function() {
|
||||||
that[ui.listSelection.length ? 'enableItem' : 'disableItem']('newlistfromselection');
|
that[ui.listSelection.length ? 'enableItem' : 'disableItem']('newlistfromselection');
|
||||||
that.replaceMenu('itemMenu', getItemMenu());
|
that.replaceMenu('itemMenu', getItemMenu());
|
||||||
},
|
},
|
||||||
|
pandora_editselection: function(data) {
|
||||||
|
that[data.value.length ? 'enableItem' : 'disableItem']('newlistfromselection');
|
||||||
|
},
|
||||||
pandora_find: function() {
|
pandora_find: function() {
|
||||||
var action = pandora.getListData().editable ? 'enableItem' : 'disableItem',
|
var action = pandora.getListData().editable ? 'enableItem' : 'disableItem',
|
||||||
list = ui._list,
|
list = ui._list,
|
||||||
|
@ -995,7 +998,7 @@ pandora.ui.mainMenu = function() {
|
||||||
{ id: 'neweditfromselection', title: Ox._('New Edit from Selection'), disabled: isGuest || ui.listSelection.length == 0 },
|
{ id: 'neweditfromselection', title: Ox._('New Edit from Selection'), disabled: isGuest || ui.listSelection.length == 0 },
|
||||||
{ id: 'newsmarteditfromresults', title: Ox._('New Smart Edit from Results'), disabled: isGuest }
|
{ id: 'newsmarteditfromresults', title: Ox._('New Smart Edit from Results'), disabled: isGuest }
|
||||||
] : ui.section == 'edits' ? [
|
] : ui.section == 'edits' ? [
|
||||||
{ id: 'newlistfromselection', title: Ox._('New ' + itemNameSingular + ' from Selection'), disabled: isGuest || ui.listSelection.length == 0, keyboard: 'shift control n' },
|
{ id: 'newlistfromselection', title: Ox._('New ' + itemNameSingular + ' from Selection'), disabled: isGuest || !ui.edit || ui.editSelection.length == 0, keyboard: 'shift control n' },
|
||||||
{ id: 'newsmartlist', title: Ox._('New Smart ' + itemNameSingular), disabled: isGuest, keyboard: 'alt control n' }
|
{ id: 'newsmartlist', title: Ox._('New Smart ' + itemNameSingular), disabled: isGuest, keyboard: 'alt control n' }
|
||||||
] : [
|
] : [
|
||||||
{ id: 'newpdf', title: Ox._('New PDF'), disabled: isGuest, keyboard: 'alt control n' },
|
{ id: 'newpdf', title: Ox._('New PDF'), disabled: isGuest, keyboard: 'alt control n' },
|
||||||
|
|
Loading…
Reference in a new issue