Browse Source
Merge pull request #319 from Avd6977/master
Schema Category Behavior Update
pull/321/head
Sebastian Stehle
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
6 deletions
-
src/Squidex/app/shared/components/schema-category.component.html
-
src/Squidex/app/shared/components/schema-category.component.ts
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
<div *ngIf="!isReadonly || (schemasForCategory && schemasForCategory.length > 0)" dnd-droppable class="droppable category" [allowDrop]="allowDrop" (onDropSuccess)="changeCategory($event.dragData)"> |
|
|
|
<div *ngIf="!isReadonly || (schemasForCategory && schemasFiltered.length > 0)" dnd-droppable class="droppable category" [allowDrop]="allowDrop" (onDropSuccess)="changeCategory($event.dragData)"> |
|
|
|
<div class="drop-indicator"></div> |
|
|
|
|
|
|
|
<div class="header clearfix"> |
|
|
|
@ -6,7 +6,7 @@ |
|
|
|
<i [class.icon-caret-right]="!isOpen" [class.icon-caret-down]="isOpen"></i> |
|
|
|
</a> |
|
|
|
|
|
|
|
<h3>{{displayName}} ({{schemasForCategory.length}})</h3> |
|
|
|
<h3>{{displayName}} ({{schemasFiltered.length}})</h3> |
|
|
|
|
|
|
|
|
|
|
|
<a class="btn btn-sm btn-link float-right" *ngIf="schemasForCategory.length === 0 && !isReadonly" (click)="removing.emit()"> |
|
|
|
@ -37,4 +37,4 @@ |
|
|
|
</a> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -60,13 +60,13 @@ export class SchemaCategoryComponent implements OnInit, OnChanges { |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
|
this.isOpen = this.localStore.get(`schema-category.${name}`) !== 'false'; |
|
|
|
this.isOpen = this.localStore.get(`schema-category.${this.name}`) !== 'false'; |
|
|
|
} |
|
|
|
|
|
|
|
public toggle() { |
|
|
|
this.isOpen = !this.isOpen; |
|
|
|
|
|
|
|
this.localStore.set(`schema-category.${name}`, this.isOpen + ''); |
|
|
|
this.localStore.set(`schema-category.${this.name}`, this.isOpen + ''); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnChanges(changes: SimpleChanges): void { |
|
|
|
@ -75,6 +75,12 @@ export class SchemaCategoryComponent implements OnInit, OnChanges { |
|
|
|
|
|
|
|
this.schemasForCategory = this.schemas.filter(x => this.isSameCategory(x)); |
|
|
|
this.schemasFiltered = this.schemasForCategory.filter(x => !query || x.name.indexOf(query) >= 0); |
|
|
|
|
|
|
|
if (query) { |
|
|
|
this.isOpen = true; |
|
|
|
} else { |
|
|
|
this.isOpen = this.localStore.get(`schema-category.${this.name}`) !== 'false'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (changes['name']) { |
|
|
|
@ -97,4 +103,4 @@ export class SchemaCategoryComponent implements OnInit, OnChanges { |
|
|
|
public trackBySchema(index: number, schema: SchemaDto) { |
|
|
|
return schema.id; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|