tweaking tag ui...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-12-07 12:12:35 +03:00
parent 26f9c46105
commit cbf420cbc4

View File

@ -265,7 +265,12 @@ var TagUIActions = actions.Actions({
that.tags that.tags
.sort() .sort()
// prep for sort... // prep for sort...
.map(function(t, i){ return [t, i, (that.data.tags.values(t) || {}).len] }) .map(function(t, i){
return [
t,
i,
(that.data.tags.values(t) || []).length,
tags.indexOf(t) >= 0] })
// XXX add ability to sort by popularity, both local // XXX add ability to sort by popularity, both local
// (selected tags) and global... // (selected tags) and global...
.run(function(){ .run(function(){
@ -278,10 +283,16 @@ var TagUIActions = actions.Actions({
return ac != null && bc != null ? return ac != null && bc != null ?
bc - ac bc - ac
// keep used tags before unused... // keep set tags before unset...
: ac == null ? // XXX these do not seem to work...
: a[3] && !b[3] ?
1 1
: bc == null ? : !a[3] && b[3] ?
-1
// keep used tags before unused...
: ac == null || (!a[3] && b[3]) ?
1
: bc == null || (a[3] && !b[3]) ?
-1 -1
// sort by position... // sort by position...
: a[0] - b[0] : a[0] - b[0]
@ -289,12 +300,13 @@ var TagUIActions = actions.Actions({
.map(function(tag){ .map(function(tag){
// normalize... // normalize...
var count = tag[2] var count = tag[2]
var tagged = tag[3]
tag = tag[0] tag = tag[0]
return make(tag, { return make(tag, {
cls: tags.indexOf(tag) >= 0 ? 'tagged' : '', cls: tagged ? 'tagged' : '',
style: { style: {
opacity: tags.indexOf(tag) >= 0 ? '' : '0.3' opacity: tagged ? '' : '0.3'
}, },
attrs: { attrs: {
count: opts.hideTagCount count: opts.hideTagCount