From 95b91f0ce27b786ae35d31a7d736272981461391 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 9 Nov 2018 17:45:01 -0500 Subject: [PATCH] added collpase/expand functions to groupings --- jslib | 2 +- src/app/organizations/vault/groupings.component.ts | 13 ++++++++++++- src/app/vault/groupings.component.html | 12 ++++++------ src/app/vault/groupings.component.ts | 7 +++++-- src/locales/en/messages.json | 4 ++++ src/scss/styles.scss | 12 +++++++++++- src/services/htmlStorage.service.ts | 2 +- 7 files changed, 40 insertions(+), 12 deletions(-) diff --git a/jslib b/jslib index 1e6b3b4aae..786fa02b90 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 1e6b3b4aae84495d757d02583d0d69a8d18a029b +Subproject commit 786fa02b90d64044aee23011a18f6e202856a362 diff --git a/src/app/organizations/vault/groupings.component.ts b/src/app/organizations/vault/groupings.component.ts index 73ad717944..465fd45234 100644 --- a/src/app/organizations/vault/groupings.component.ts +++ b/src/app/organizations/vault/groupings.component.ts @@ -4,6 +4,8 @@ import { ApiService } from 'jslib/abstractions/api.service'; import { CollectionService } from 'jslib/abstractions/collection.service'; import { FolderService } from 'jslib/abstractions/folder.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; +import { StorageService } from 'jslib/abstractions/storage.service'; +import { UserService } from 'jslib/abstractions/user.service'; import { CollectionData } from 'jslib/models/data/collectionData'; import { Collection } from 'jslib/models/domain/collection'; @@ -21,8 +23,9 @@ export class GroupingsComponent extends BaseGroupingsComponent { organization: Organization; constructor(collectionService: CollectionService, folderService: FolderService, + storageService: StorageService, userService: UserService, private apiService: ApiService, private i18nService: I18nService) { - super(collectionService, folderService); + super(collectionService, folderService, storageService, userService); } async loadCollections() { @@ -48,4 +51,12 @@ export class GroupingsComponent extends BaseGroupingsComponent { this.collections.push(unassignedCollection); this.nestedCollections = await this.collectionService.getAllNested(this.collections); } + + collapse(grouping: CollectionView) { + super.collapse(grouping, 'org_'); + } + + isCollapsed(grouping: CollectionView) { + return super.isCollapsed(grouping, 'org_'); + } } diff --git a/src/app/vault/groupings.component.html b/src/app/vault/groupings.component.html index f4aa2a89b7..5f3f100af2 100644 --- a/src/app/vault/groupings.component.html +++ b/src/app/vault/groupings.component.html @@ -55,14 +55,14 @@
  • -
      +
      @@ -75,9 +75,9 @@
      • - - {{c.node.name}} -
          + + {{c.node.name}} +
          diff --git a/src/app/vault/groupings.component.ts b/src/app/vault/groupings.component.ts index 5d1611bb06..b335606b38 100644 --- a/src/app/vault/groupings.component.ts +++ b/src/app/vault/groupings.component.ts @@ -6,6 +6,8 @@ import { import { CollectionService } from 'jslib/abstractions/collection.service'; import { FolderService } from 'jslib/abstractions/folder.service'; +import { StorageService } from 'jslib/abstractions/storage.service'; +import { UserService } from 'jslib/abstractions/user.service'; import { GroupingsComponent as BaseGroupingsComponent } from 'jslib/angular/components/groupings.component'; @@ -19,8 +21,9 @@ export class GroupingsComponent extends BaseGroupingsComponent { searchText: string = ''; searchPlaceholder: string = null; - constructor(collectionService: CollectionService, folderService: FolderService) { - super(collectionService, folderService); + constructor(collectionService: CollectionService, folderService: FolderService, + storageService: StorageService, userService: UserService) { + super(collectionService, folderService, storageService, userService); } searchTextChanged() { diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 9797b02d81..953ad2f897 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -207,6 +207,10 @@ "toggleVisibility": { "message": "Toggle Visibility" }, + "toggleCollapsed": { + "message": "Toggle Collapsed", + "description": "Toggling an expand/collapse state." + }, "generatePassword": { "message": "Generate Password" }, diff --git a/src/scss/styles.scss b/src/scss/styles.scss index 7dfff87cd1..44686987b0 100644 --- a/src/scss/styles.scss +++ b/src/scss/styles.scss @@ -424,6 +424,12 @@ app-vault-groupings, app-org-vault-groupings { display: none; } + li { + > .fa, > div > .fa { + cursor: pointer; + } + } + li.active { > .show-active, > div .show-active { display: inline; @@ -431,10 +437,14 @@ app-vault-groupings, app-org-vault-groupings { } li.active { - > a:first-child, > div a:first-child { + > a:first-of-type, > div a:first-of-type { font-weight: bold; color: theme-color("primary"); } + + > .fa, > div > .fa { + color: theme-color("primary"); + } } } } diff --git a/src/services/htmlStorage.service.ts b/src/services/htmlStorage.service.ts index 1b9810326c..90d21ef54b 100644 --- a/src/services/htmlStorage.service.ts +++ b/src/services/htmlStorage.service.ts @@ -6,7 +6,7 @@ export class HtmlStorageService implements StorageService { private localStorageKeys = new Set(['appId', 'anonymousAppId', 'rememberedEmail', 'passwordGenerationOptions', ConstantsService.disableFaviconKey, ConstantsService.lockOptionKey, 'rememberEmail', 'enableGravatars', ConstantsService.localeKey, ConstantsService.lockOptionKey]); - private localStorageStartsWithKeys = ['twoFactorToken_']; + private localStorageStartsWithKeys = ['twoFactorToken_', ConstantsService.collapsedGroupingsKey + '_']; constructor(private platformUtilsService: PlatformUtilsService) { }