mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.6 KiB
63 lines
1.6 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
import { AssetsState, DialogModel, LocalStoreService, Queries, Query, ResourceOwner, Router2State, UIState } from '@app/shared';
|
|
import { Settings } from '@app/shared/state/settings';
|
|
|
|
@Component({
|
|
selector: 'sqx-assets-page',
|
|
styleUrls: ['./assets-page.component.scss'],
|
|
templateUrl: './assets-page.component.html',
|
|
providers: [
|
|
Router2State
|
|
]
|
|
})
|
|
export class AssetsPageComponent extends ResourceOwner implements OnInit {
|
|
public queries = new Queries(this.uiState, 'assets');
|
|
|
|
public addAssetFolderDialog = new DialogModel();
|
|
|
|
public isListView: boolean;
|
|
|
|
constructor(
|
|
public readonly assetsRoute: Router2State,
|
|
public readonly assetsState: AssetsState,
|
|
private readonly localStore: LocalStoreService,
|
|
private readonly uiState: UIState
|
|
) {
|
|
super();
|
|
|
|
this.isListView = this.localStore.getBoolean(Settings.Local.ASSETS_MODE);
|
|
}
|
|
|
|
public ngOnInit() {
|
|
this.assetsState.loadAndListen(this.assetsRoute);
|
|
}
|
|
|
|
public reload() {
|
|
this.assetsState.load(true);
|
|
}
|
|
|
|
public search(query: Query) {
|
|
this.assetsState.search(query);
|
|
}
|
|
|
|
public selectTags(tags: ReadonlyArray<string>) {
|
|
this.assetsState.selectTags(tags);
|
|
}
|
|
|
|
public toggleTag(tag: string) {
|
|
this.assetsState.toggleTag(tag);
|
|
}
|
|
|
|
public changeView(isListView: boolean) {
|
|
this.isListView = isListView;
|
|
|
|
this.localStore.setBoolean(Settings.Local.ASSETS_MODE, isListView);
|
|
}
|
|
}
|