mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
now it is possible to either force the buttons on by including placeholders in options.buttons or via specific options... sitll seems too complicated.
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0e55868093
commit
a6628c42b8
@ -734,11 +734,12 @@ var URLHistoryUIActions = actions.Actions({
|
||||
|
||||
to_remove: to_remove,
|
||||
|
||||
// XXX should the normal items have a "to top" button???
|
||||
buttons: [
|
||||
// open...
|
||||
['<span class="show-on-hover">↗</span>',
|
||||
function(p){ dialog.browsePath(p) }],
|
||||
// XXX should the normal items have a "to top" button???
|
||||
'TO_TOP',
|
||||
'PIN',
|
||||
'REMOVE',
|
||||
],
|
||||
|
||||
@ -1684,6 +1684,11 @@ var WidgetTestActions = actions.Actions({
|
||||
make.EditableList(letters, {
|
||||
list_id: 'letters',
|
||||
sortable: 'y',
|
||||
|
||||
buttons: [
|
||||
'TO_TOP',
|
||||
'UP',
|
||||
],
|
||||
})
|
||||
|
||||
// NOTE: the dialog's .parent is not yet set at this point...
|
||||
@ -1721,6 +1726,11 @@ var WidgetTestActions = actions.Actions({
|
||||
make.EditablePinnedList(letters, pins, {
|
||||
list_id: 'letters',
|
||||
//pins_sortable: false,
|
||||
/*buttons: [
|
||||
'PIN',
|
||||
'REMOVE',
|
||||
],
|
||||
//*/
|
||||
})
|
||||
|
||||
// NOTE: the dialog's .parent is not yet set at this point...
|
||||
|
||||
@ -720,36 +720,52 @@ function(list, options){
|
||||
}
|
||||
|
||||
// up/down...
|
||||
options.item_order_buttons
|
||||
&& (_buttons['UP'] = [options.shift_up_button || '⏶',
|
||||
if(options.item_order_buttons
|
||||
|| buttons.indexOf('UP') >= 0){
|
||||
_buttons['UP'] = [
|
||||
options.shift_up_button || '⏶',
|
||||
function(p, e){
|
||||
move(p, -1)
|
||||
&& e.prev().before(e) }])
|
||||
&& (_buttons['DOWN'] = [options.shift_down_button || '⏷',
|
||||
&& e.prev().before(e) }
|
||||
]
|
||||
}
|
||||
if(options.item_order_buttons
|
||||
|| buttons.indexOf('DOWN') >= 0){
|
||||
_buttons['DOWN'] = [
|
||||
options.shift_down_button || '⏷',
|
||||
function(p, e){
|
||||
move(p, 1)
|
||||
&& e.next().after(e) }])
|
||||
&& e.next().after(e) }
|
||||
]
|
||||
}
|
||||
|
||||
// top...
|
||||
options.to_top_button
|
||||
&& (_buttons['TO_TOP'] = [options.to_top_button === true ?
|
||||
var i = buttons.indexOf('TO_TOP')
|
||||
if(options.to_top_button || i >= 0){
|
||||
_buttons['TO_TOP'] = [
|
||||
(options.to_top_button === true || i >= 0) ?
|
||||
'⤒'
|
||||
: options.to_top_button,
|
||||
function(p, e){
|
||||
var d = move(p, -dialog.__list[id].length)
|
||||
d && e.prevAll().eq(Math.abs(d+1)).before(e)
|
||||
}])
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
// bottom...
|
||||
options.to_bottom_button
|
||||
&& (_buttons['TO_BOTTOM'] = [options.to_bottom_button === true ?
|
||||
var i = buttons.indexOf('TO_BOTTOM')
|
||||
if(options.to_bottom_button || i >= 0){
|
||||
_buttons['TO_BOTTOM'] = [
|
||||
(options.to_bottom_button === true || i >= 0) ?
|
||||
'⤓'
|
||||
: options.to_bottom_button,
|
||||
function(p, e){
|
||||
var d = move(p, dialog.__list[id].length)
|
||||
d && e.nextAll().eq(Math.abs(d)).before(e)
|
||||
}])
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// 'x' button if not disabled...
|
||||
@ -769,8 +785,8 @@ function(list, options){
|
||||
: buttons.splice(i, 1, _buttons[key])
|
||||
})
|
||||
// clear out the unused button placeholders...
|
||||
buttons = buttons
|
||||
.filter(function(b){
|
||||
buttons = options.buttons =
|
||||
buttons.filter(function(b){
|
||||
return ['UP', 'DOWN', 'TO_TOP', 'TO_BOTTOM', 'REMOVE'].indexOf(b) < 0 })
|
||||
|
||||
// if we are sortable then we will need to also be grouped...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user