mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +00:00
re-did the sort doc...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
d02d7c8564
commit
0283beddf6
@ -720,14 +720,42 @@ module.Sort = core.ImageGridFeatures.Feature({
|
|||||||
// - by hour/day/month/year in date modes...
|
// - by hour/day/month/year in date modes...
|
||||||
// - ???
|
// - ???
|
||||||
var SortUIActions = actions.Actions({
|
var SortUIActions = actions.Actions({
|
||||||
|
config: {
|
||||||
|
// If true expand the sort method alias tree...
|
||||||
|
//
|
||||||
|
'sort-doc-expand-methods': true,
|
||||||
|
},
|
||||||
|
|
||||||
// XXX add links from method names to their expansions and actual
|
// XXX add links from method names to their expansions and actual
|
||||||
// methods (docs)...
|
// methods (docs)...
|
||||||
// ...method docs do not exist at this point...
|
// ...method docs do not exist at this point...
|
||||||
// XXX do a better action calling scheme...
|
// XXX do a better action calling scheme...
|
||||||
showSortMethodDoc: ['- Sort/',
|
showSortMethodDoc: ['- Sort/',
|
||||||
widgets.makeUIDialog(function(method){
|
widgets.makeUIDialog(function(method, expand, indent){
|
||||||
var that = this
|
var that = this
|
||||||
var data = this.expandSortMethod(method)
|
expand = expand || this.config['sort-doc-expand-methods'] || false
|
||||||
|
indent = indent || ' '
|
||||||
|
|
||||||
|
var expandMethods = function(method){
|
||||||
|
var methods = that.expandSortMethod(method)
|
||||||
|
return [ methods instanceof Array || typeof(methods) == typeof('str') ?
|
||||||
|
`<a href="javascript:ig.showSortMethodDoc('${method}', ${expand})">${method}</a>`
|
||||||
|
: method ]
|
||||||
|
.concat(
|
||||||
|
methods instanceof Array ?
|
||||||
|
methods
|
||||||
|
.map(!expand ?
|
||||||
|
// !expand -> keep only the first/root item...
|
||||||
|
function(e){
|
||||||
|
return expandMethods(e)[0] || [] }
|
||||||
|
: expandMethods)
|
||||||
|
.reduce(function(r, e){
|
||||||
|
return r.concat(e instanceof Array ? e : [e]) }, [])
|
||||||
|
.map(function(e){
|
||||||
|
return indent + e })
|
||||||
|
: typeof(methods) == typeof('str') ?
|
||||||
|
[indent + methods]
|
||||||
|
: []) }
|
||||||
|
|
||||||
return $('<div class="help-dialog">')
|
return $('<div class="help-dialog">')
|
||||||
.append($('<div class="sort-method">')
|
.append($('<div class="sort-method">')
|
||||||
@ -735,17 +763,14 @@ var SortUIActions = actions.Actions({
|
|||||||
.append($('<h2>')
|
.append($('<h2>')
|
||||||
.text(method))
|
.text(method))
|
||||||
.append($('<hr>'))
|
.append($('<hr>'))
|
||||||
// parse the action doc...
|
|
||||||
.append($('<pre>')
|
.append($('<pre>')
|
||||||
.html(
|
.html(
|
||||||
'Sort order:\n '
|
'Sort order:\n'
|
||||||
+data
|
+ expandMethods(method)
|
||||||
.map(function(m){
|
// ignore the first item as we mention
|
||||||
var e = that.expandSortMethod(m)
|
// it in the title...
|
||||||
return (e instanceof Array || typeof(e) == typeof('str')) ?
|
.slice(1)
|
||||||
`<a href="javascript:ig.showSortMethodDoc('${m}')">${m}</a>`
|
.join('\n'))))
|
||||||
: m })
|
|
||||||
.join('\n '))))
|
|
||||||
})],
|
})],
|
||||||
|
|
||||||
// XXX should we be able to edit modes???
|
// XXX should we be able to edit modes???
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user