Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GITC-521 : search on applying filter #9626

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 35 additions & 52 deletions app/grants/templates/grants/explorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,110 +116,93 @@
</span>

<!-- GRANT TYPE FILTERS -->
<b-dropdown @hide="fetchGrants(1)" ref="grantFlitersDropdown" size="sm" menu-class="scroll-menu p-0 mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip v-if="grant_types.length">
<b-dropdown ref="grantFlitersDropdown" size="sm" menu-class="scroll-menu p-0 mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip v-if="grant_types.length">
<template #button-content>
Categories <span v-if="params.grant_types.length"> • [[params.grant_types.length]]</span>
</template>
<b-dropdown-form>
<b-form-checkbox-group id="checkbox-group-types" v-model.lazy="params.grant_types" aria-describedby="ariaDescribedby" name="grant_types">
<template v-for="grant_type in grant_types" v-if="grant_type.is_visible">
<b-form-checkbox class="mb-3" :value="grant_type.keyword">[[grant_type.label]]</b-form-checkbox>
</template>
</b-form-checkbox-group>
<b-dropdown-divider></b-dropdown-divider>
<div>
<b-button variant="link" size="sm" :class="{'disabled' : !params.grant_types.length}" @click="params.grant_types=[], closeDropdown('grantFlitersDropdown')">Clear</b-button>
<b-button variant="primary" size="sm" @click="closeDropdown('grantFlitersDropdown')">Apply</b-button>
<div class="mt-2">
<b-form-checkbox-group id="checkbox-group-types" v-model.lazy="params.grant_types" aria-describedby="ariaDescribedby" name="grant_types">
<template v-for="grant_type in grant_types" v-if="grant_type.is_visible">
<b-form-checkbox @input="fetchGrants(1)" class="mb-3" :value="grant_type.keyword">[[grant_type.label]]</b-form-checkbox>
</template>
</b-form-checkbox-group>
</div>
</b-dropdown-form>
</b-dropdown>

<!-- TAG FILTERS -->
<b-dropdown @hide="fetchGrants(1)" ref="tagFiltersDropdown" size="sm" menu-class="scroll-menu p-0 mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip>
<b-dropdown ref="tagFiltersDropdown" size="sm" menu-class="scroll-menu p-0 mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip>
<template #button-content>
Tags <span v-if="params.grant_tags?.length"> • [[params.grant_tags.length]]</span>
</template>
<b-dropdown-form>
<b-form-checkbox-group id="checkbox-group-tags" v-model="params.grant_tags" aria-describedby="ariaDescribedby" name="grant_tags">
<template v-for="tag in tagsOptions">
<b-form-checkbox class="mb-3" :value="tag.name">[[tag.name]]</b-form-checkbox>
</template>
</b-form-checkbox-group>
<b-dropdown-divider></b-dropdown-divider>
<div>
<b-button variant="link" size="sm" :class="{'disabled' : !params.grant_tags.length}" @click="params.grant_tags=[], closeDropdown('tagFiltersDropdown')">Clear</b-button>
<b-button variant="primary" size="sm" @click="closeDropdown('tagFiltersDropdown')">Apply</b-button>
<div class="mt-2">
<b-form-checkbox-group id="checkbox-group-tags" v-model="params.grant_tags" aria-describedby="ariaDescribedby" name="grant_tags">
<template v-for="tag in tagsOptions">
<b-form-checkbox @input="fetchGrants(1)" class="mb-3" :value="tag.name">[[tag.name]]</b-form-checkbox>
</template>
</b-form-checkbox-group>
</div>
</b-dropdown-form>
</b-dropdown>

<!-- REGION FILTERS -->
<b-dropdown @hide="fetchGrants(1)" ref="regionFiltersDropdown" size="sm" menu-class="scroll-menu p-0 mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip>
<b-dropdown ref="regionFiltersDropdown" size="sm" menu-class="scroll-menu p-0 mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip>
<template #button-content>
Regions <span v-if="params.grant_regions?.length"> • [[params.grant_regions.length]]</span>
</template>
<b-dropdown-form>
<b-form-checkbox-group id="checkbox-group-regions" v-model="params.grant_regions" aria-describedby="ariaDescribedby" name="grant_regions" stacked>
<template v-for="region in grantRegions">
<b-form-checkbox class="mb-3" :value="region.name">[[region.label]]</b-form-checkbox>
</template>
</b-form-checkbox-group>
<b-dropdown-divider></b-dropdown-divider>
<div>
<b-button variant="link" size="sm" :class="{'disabled' : !params.grant_regions.length}" @click="params.grant_regions=[], closeDropdown('regionFiltersDropdown')">Clear</b-button>
<b-button variant="primary" size="sm" @click="closeDropdown('regionFiltersDropdown')">Apply</b-button>
<div class="mt-2">
<b-form-checkbox-group id="checkbox-group-regions" v-model="params.grant_regions" aria-describedby="ariaDescribedby" name="grant_regions" stacked>
<template v-for="region in grantRegions">
<b-form-checkbox @input="fetchGrants(1)" class="mb-3" :value="region.name">[[region.label]]</b-form-checkbox>
</template>
</b-form-checkbox-group>
</div>
</b-dropdown-form>
</b-dropdown>

<!-- TENANT FILTERS -->
<b-dropdown @hide="fetchGrants(1)" ref="tenantFiltersDropdown" size="sm" menu-class="scroll-menu p-0 mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip>
<b-dropdown ref="tenantFiltersDropdown" size="sm" menu-class="scroll-menu p-0 mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip>
<template #button-content>
Blockchains <span v-if="params.tenants?.length"> • [[params.tenants.length]]</span>
</template>
<b-dropdown-form>
<b-form-checkbox-group id="checkbox-group-tenants" v-model="params.tenants" aria-describedby="ariaDescribedby" name="tenants" stacked>
<template v-for="tenant in grantTenants">
<b-form-checkbox class="mb-3" :value="tenant.name">[[tenant.label]]</b-form-checkbox>
</template>
</b-form-checkbox-group>
<b-dropdown-divider></b-dropdown-divider>
<div>
<b-button variant="link" size="sm" :class="{'disabled' : !params.tenants.length}" @click="params.tenants=[], closeDropdown('tenantFiltersDropdown')">Clear</b-button>
<b-button variant="primary" size="sm" @click="closeDropdown('tenantFiltersDropdown')">Apply</b-button>
<div class="mt-2">
<b-form-checkbox-group id="checkbox-group-tenants" v-model="params.tenants" aria-describedby="ariaDescribedby" name="tenants" stacked>
<template v-for="tenant in grantTenants">
<b-form-checkbox @input="fetchGrants(1)" class="mb-3" :value="tenant.name">[[tenant.label]]</b-form-checkbox>
</template>
</b-form-checkbox-group>
</div>
</b-dropdown-form>
</b-dropdown>

<!-- MORE FILTERS -->
<b-dropdown @hide="fetchGrants(1)" ref="moreFiltersDropdown" size="sm" menu-class="mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip>
<b-dropdown ref="moreFiltersDropdown" size="sm" menu-class="mt-1" variant="outline-gc-grey" toggle-class="rounded-pill mt-2" no-caret no-flip>
<template #button-content>
More Filters
<span v-if="params.idle || params.only_contributions || params.me || params.following">
• [[ [params.idle, params.only_contributions, params.me, params.following].filter((v)=>v).length ]]</span>
</template>
<b-dropdown-form>
<div class="pt-2">
<b-form-checkbox id="idle" v-model="params.idle" name="idle"> Show Idle Grants</b-form-checkbox>
<div class="mt-2">
<b-form-checkbox @input="fetchGrants(1)" id="idle" v-model="params.idle" name="idle"> Show Idle Grants</b-form-checkbox>
<b-dropdown-text class="font-smaller-4"style="width: 230px;">Grants not updated in 3 months</b-dropdown-text>
</div>
<b-dropdown-divider></b-dropdown-divider>
<div>
<div class="d-block">
<b-dropdown-header id="dropdown-header-shortcuts">
My Shortcuts
</b-dropdown-header>
<b-form-checkbox id="only_contributions" v-model="params.only_contributions" name="only_contributions">My Contributions</b-form-checkbox>
<b-form-checkbox @input="fetchGrants(1)" id="only_contributions" v-model="params.only_contributions" name="only_contributions">My Contributions</b-form-checkbox>
<b-dropdown-text class="font-smaller-4 pb-2" style="width: 230px;">Grants I’ve contributed to</b-dropdown-text>
<b-form-checkbox id="me" v-model="params.me" name="me"> My Grants</b-form-checkbox>
<b-form-checkbox @input="fetchGrants(1)" id="me" v-model="params.me" name="me"> My Grants</b-form-checkbox>
<b-dropdown-text class="font-smaller-4 pb-2" style="width: 230px;">Grants I’ve created</b-dropdown-text>
<b-form-checkbox id="following" v-model="params.following" name="following"> Following</b-form-checkbox>
<b-form-checkbox @input="fetchGrants(1)" id="following" v-model="params.following" name="following"> Following</b-form-checkbox>
<b-dropdown-text class="font-smaller-4 pb-2" style="width: 230px;">Grants I’ve followed</b-dropdown-text>
</div>
<b-dropdown-divider></b-dropdown-divider>
<div>
<b-button variant="link" size="sm" @click="params.idle=false,params.only_contributions=false, params.me=false, params.following=false, closeDropdown('moreFiltersDropdown')">Clear</b-button>
<b-button variant="primary" size="sm" @click="closeDropdown('moreFiltersDropdown')">Apply</b-button>
</div>
</b-dropdown-form>
</b-dropdown>

Expand Down
2 changes: 1 addition & 1 deletion app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def get_collections(

_collections = GrantCollection.objects.filter(hidden=False)

if collection_id:
if collection_id and collection_id.isdigit():
_collections = _collections.filter(pk=int(collection_id))

if not idle_grants:
Expand Down