Merge pull request #1979 from felixlohmeier/all-menu-new-facets

Add custom text facet recipes from the wiki to "All" menu
This commit is contained in:
Antonin Delpeuch 2019-03-12 03:27:20 +01:00 committed by GitHub
commit 76162cfed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 0 deletions

View File

@ -581,6 +581,9 @@
"core-views/starred-rows": "Starred Rows",
"core-views/facet-flag": "Facet by flag",
"core-views/flagged-rows": "Flagged Rows",
"core-views/blank-rows": "Blank Rows",
"core-views/non-blank-values": "Non-blank values per column",
"core-views/non-blank-records": "Non-blank records per column",
"core-views/edit-rows": "Edit rows",
"core-views/star-rows": "Star rows",
"core-views/unstar-rows": "Unstar rows",

View File

@ -650,6 +650,57 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) {
}
);
}
},
{
label: $.i18n('core-views/facet-blank'),
id: "core/facet-by-blank",
click: function() {
ui.browsingEngine.addFacet(
"list",
{
"name" : $.i18n('core-views/blank-rows'),
"columnName" : "",
"expression" : "(filter(row.columnNames,cn,isNonBlank(cells[cn].value)).length()==0).toString()"
},
{
"scroll" : false
}
);
}
},
{
label: $.i18n('core-views/non-blank-values'),
id: "core/non-blank-values",
click: function() {
ui.browsingEngine.addFacet(
"list",
{
"name" : $.i18n('core-views/non-blank-values'),
"columnName" : "",
"expression" : "filter(row.columnNames,cn,isNonBlank(cells[cn].value))"
},
{
"scroll" : false
}
);
}
},
{
label: $.i18n('core-views/non-blank-records'),
id: "core/non-blank-records",
click: function() {
ui.browsingEngine.addFacet(
"list",
{
"name" : $.i18n('core-views/non-blank-records'),
"columnName" : "",
"expression" : "filter(row.columnNames,cn,isNonBlank(if(row.record.fromRowIndex==row.index,row.record.cells[cn].value.join(\"\"),null)))"
},
{
"scroll" : false
}
);
}
}
]
},