Browse Source

Make item count for dropdown selector configurable.

pull/410/head
Sebastian Stehle 6 years ago
parent
commit
5a48d62061
  1. 2
      src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs
  2. 10
      src/Squidex/app/shared/components/references-dropdown.component.ts
  3. 6
      src/Squidex/appsettings.json

2
src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs

@ -17,6 +17,8 @@ namespace Squidex.Areas.Api.Controllers.UI
public MapOptions Map { get; set; }
public int ReferencesDropdownItemCount { get; set; } = 100;
public bool ShowInfo { get; set; }
public bool HideNews { get; set; }

10
src/Squidex/app/shared/components/references-dropdown.component.ts

@ -20,7 +20,8 @@ import {
SchemaDetailsDto,
SchemasService,
StatefulControlComponent,
Types
Types,
UIOptions
} from '@app/shared/internal';
export const SQX_REFERENCES_DROPDOWN_CONTROL_VALUE_ACCESSOR: any = {
@ -57,6 +58,7 @@ const NO_EMIT = { emitEvent: false };
export class ReferencesDropdownComponent extends StatefulControlComponent<State, string[] | string> implements OnInit {
private languageField: AppLanguageDto;
private selectedId: string | undefined;
private itemCount: number;
@Input()
public schemaId: string;
@ -73,7 +75,7 @@ export class ReferencesDropdownComponent extends StatefulControlComponent<State,
public selectionControl = new FormControl('');
constructor(changeDetector: ChangeDetectorRef,
constructor(changeDetector: ChangeDetectorRef, uiOptions: UIOptions,
private readonly appsState: AppsState,
private readonly contentsService: ContentsService,
private readonly schemasService: SchemasService
@ -84,6 +86,8 @@ export class ReferencesDropdownComponent extends StatefulControlComponent<State,
contentNames: []
});
this.itemCount = uiOptions.get('referencesDropdownItemCount');
this.own(
this.selectionControl.valueChanges
.subscribe((value: ContentName) => {
@ -116,7 +120,7 @@ export class ReferencesDropdownComponent extends StatefulControlComponent<State,
this.schemasService.getSchema(this.appsState.appName, this.schemaId).pipe(
switchMap(schema => {
if (schema) {
return this.contentsService.getContents(this.appsState.appName, this.schemaId, 100, 0);
return this.contentsService.getContents(this.appsState.appName, this.schemaId, this.itemCount, 0);
} else {
return throwError('Invalid schema');
}

6
src/Squidex/appsettings.json

@ -96,7 +96,11 @@
/*
* Show the exposed values as information on the apps overview page.
*/
"showInfo": false
"showInfo": false,
/*
* The number of content items for dropdown selector.
*/
"referencesDropdownItemCount": 100
},
"email": {

Loading…
Cancel
Save