84769302d77939430b003999bd6397ecc64207b5
galt
Fri Feb 7 15:33:28 2020 -0800
CIRM cdwWebBrowse: Placing the Clear-All-Facets button in a more logical location. Now only visble if some facets have been chosen.
diff --git src/hg/lib/tablesTables.c src/hg/lib/tablesTables.c
index dab9121..77e170c 100644
--- src/hg/lib/tablesTables.c
+++ src/hg/lib/tablesTables.c
@@ -393,147 +393,152 @@
boolean withFilters, char *itemPlural,
int pageSize, struct fieldedTableSegment *largerContext, struct hash *suggestHash,
struct facetField **ffArray, char *visibleFacetList,
void (*addFunc)(int))
/* Show a fielded table that can be sorted by clicking on column labels and optionally
* that includes a row of filter controls above the labels .
* The maxLenField is maximum character length of field before truncation with ...
* Pass in 0 for no max */
{
if (strchr(returnUrl, '?') == NULL)
errAbort("Expecting returnUrl to include ? in showFieldedTable\nIt's %s", returnUrl);
if (withFilters || visibleFacetList)
showTableFilterInstructionsEtc(table, itemPlural, largerContext, addFunc, visibleFacetList);
-// Show top bar with quick-deselects for selected facet values
-// as well a clear restriction button that cleans out cdwFile_filter cart var.
-
if (visibleFacetList)
{
- char *where = cartUsualString(cart, "cdwFile_filter", "");
- if (!isEmpty(where))
- {
- // left column
- printf("
\n");
+ // Show top bar with quick-deselects for selected facet values
+ // as well a clear restriction button that cleans out cdwFile_filter cart var.
- printf("Restricting files to where %s. ", where);
+ struct dyString *facetBar = dyStringNew(1024);
- printf("  ");
- printf("");
- jsOnEventById("click", "clearRestrictionButton",
- "$('[name=cdwBrowseFiles_page]').val('1');\n"
- "$('[name=clearRestriction]').val('1');\n"
- "$('#submit').click();\n");
+ char *where = cartUsualString(cart, "cdwFile_filter", "");
- printf(" ");
- }
boolean gotSelected = FALSE;
struct slName *nameList = slNameListFromComma(visibleFacetList);
int f;
for (f = 0; f < table->fieldCount; ++f)
{
struct facetField *field = ffArray[f];
if (slNameInListUseCase(nameList, field->fieldName)) // i.e. is this field a visible facet?
{
if (!field->allSelected)
{
- if (!gotSelected)
- {
- if (isEmpty(where)) // we still need to do this
- {
- // left column
- printf("
\n");
+
struct slName *nameList = slNameListFromComma(visibleFacetList);
int f;
for (f = 0; f < table->fieldCount; ++f)
{
struct facetField *field = ffArray[f];
if (slNameInListUseCase(nameList, field->fieldName)) // i.e. is this field a visible facet?
{
htmlPrintf("
\n");
htmlPrintf("
%s
\n", field->fieldName);
struct facetVal *val;
if (!field->allSelected) // add reset facet link
{
char *op = "reset";
htmlPrintf("