mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +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,
|
to_remove: to_remove,
|
||||||
|
|
||||||
// XXX should the normal items have a "to top" button???
|
|
||||||
buttons: [
|
buttons: [
|
||||||
// open...
|
// open...
|
||||||
['<span class="show-on-hover">↗</span>',
|
['<span class="show-on-hover">↗</span>',
|
||||||
function(p){ dialog.browsePath(p) }],
|
function(p){ dialog.browsePath(p) }],
|
||||||
|
// XXX should the normal items have a "to top" button???
|
||||||
|
'TO_TOP',
|
||||||
'PIN',
|
'PIN',
|
||||||
'REMOVE',
|
'REMOVE',
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1684,6 +1684,11 @@ var WidgetTestActions = actions.Actions({
|
|||||||
make.EditableList(letters, {
|
make.EditableList(letters, {
|
||||||
list_id: 'letters',
|
list_id: 'letters',
|
||||||
sortable: 'y',
|
sortable: 'y',
|
||||||
|
|
||||||
|
buttons: [
|
||||||
|
'TO_TOP',
|
||||||
|
'UP',
|
||||||
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
// NOTE: the dialog's .parent is not yet set at this point...
|
// NOTE: the dialog's .parent is not yet set at this point...
|
||||||
@ -1721,6 +1726,11 @@ var WidgetTestActions = actions.Actions({
|
|||||||
make.EditablePinnedList(letters, pins, {
|
make.EditablePinnedList(letters, pins, {
|
||||||
list_id: 'letters',
|
list_id: 'letters',
|
||||||
//pins_sortable: false,
|
//pins_sortable: false,
|
||||||
|
/*buttons: [
|
||||||
|
'PIN',
|
||||||
|
'REMOVE',
|
||||||
|
],
|
||||||
|
//*/
|
||||||
})
|
})
|
||||||
|
|
||||||
// NOTE: the dialog's .parent is not yet set at this point...
|
// NOTE: the dialog's .parent is not yet set at this point...
|
||||||
|
|||||||
@ -720,36 +720,52 @@ function(list, options){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// up/down...
|
// up/down...
|
||||||
options.item_order_buttons
|
if(options.item_order_buttons
|
||||||
&& (_buttons['UP'] = [options.shift_up_button || '⏶',
|
|| buttons.indexOf('UP') >= 0){
|
||||||
|
_buttons['UP'] = [
|
||||||
|
options.shift_up_button || '⏶',
|
||||||
function(p, e){
|
function(p, e){
|
||||||
move(p, -1)
|
move(p, -1)
|
||||||
&& e.prev().before(e) }])
|
&& e.prev().before(e) }
|
||||||
&& (_buttons['DOWN'] = [options.shift_down_button || '⏷',
|
]
|
||||||
|
}
|
||||||
|
if(options.item_order_buttons
|
||||||
|
|| buttons.indexOf('DOWN') >= 0){
|
||||||
|
_buttons['DOWN'] = [
|
||||||
|
options.shift_down_button || '⏷',
|
||||||
function(p, e){
|
function(p, e){
|
||||||
move(p, 1)
|
move(p, 1)
|
||||||
&& e.next().after(e) }])
|
&& e.next().after(e) }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
// top...
|
// top...
|
||||||
options.to_top_button
|
var i = buttons.indexOf('TO_TOP')
|
||||||
&& (_buttons['TO_TOP'] = [options.to_top_button === true ?
|
if(options.to_top_button || i >= 0){
|
||||||
|
_buttons['TO_TOP'] = [
|
||||||
|
(options.to_top_button === true || i >= 0) ?
|
||||||
'⤒'
|
'⤒'
|
||||||
: options.to_top_button,
|
: options.to_top_button,
|
||||||
function(p, e){
|
function(p, e){
|
||||||
var d = move(p, -dialog.__list[id].length)
|
var d = move(p, -dialog.__list[id].length)
|
||||||
d && e.prevAll().eq(Math.abs(d+1)).before(e)
|
d && e.prevAll().eq(Math.abs(d+1)).before(e)
|
||||||
}])
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
// bottom...
|
// bottom...
|
||||||
options.to_bottom_button
|
var i = buttons.indexOf('TO_BOTTOM')
|
||||||
&& (_buttons['TO_BOTTOM'] = [options.to_bottom_button === true ?
|
if(options.to_bottom_button || i >= 0){
|
||||||
|
_buttons['TO_BOTTOM'] = [
|
||||||
|
(options.to_bottom_button === true || i >= 0) ?
|
||||||
'⤓'
|
'⤓'
|
||||||
: options.to_bottom_button,
|
: options.to_bottom_button,
|
||||||
function(p, e){
|
function(p, e){
|
||||||
var d = move(p, dialog.__list[id].length)
|
var d = move(p, dialog.__list[id].length)
|
||||||
d && e.nextAll().eq(Math.abs(d)).before(e)
|
d && e.nextAll().eq(Math.abs(d)).before(e)
|
||||||
}])
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'x' button if not disabled...
|
// 'x' button if not disabled...
|
||||||
@ -769,8 +785,8 @@ function(list, options){
|
|||||||
: buttons.splice(i, 1, _buttons[key])
|
: buttons.splice(i, 1, _buttons[key])
|
||||||
})
|
})
|
||||||
// clear out the unused button placeholders...
|
// clear out the unused button placeholders...
|
||||||
buttons = buttons
|
buttons = options.buttons =
|
||||||
.filter(function(b){
|
buttons.filter(function(b){
|
||||||
return ['UP', 'DOWN', 'TO_TOP', 'TO_BOTTOM', 'REMOVE'].indexOf(b) < 0 })
|
return ['UP', 'DOWN', 'TO_TOP', 'TO_BOTTOM', 'REMOVE'].indexOf(b) < 0 })
|
||||||
|
|
||||||
// if we are sortable then we will need to also be grouped...
|
// if we are sortable then we will need to also be grouped...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user