MOBILE-2795 database: Display found results number

main
Dani Palou 2019-01-10 15:37:35 +01:00
parent fee1dde1dc
commit 076b1a8be9
4 changed files with 23 additions and 3 deletions

View File

@ -54,9 +54,16 @@
{{ 'addon.mod_data.entrieslefttoadd' | translate:{$a: {entriesleft: access.entrieslefttoadd} } }}
</div>
<ion-item class="item" *ngIf="search.searching && !isEmpty">
<a (click)="searchReset()">{{ 'addon.mod_data.resetsettings' | translate}}</a>
</ion-item>
<!-- Reset search. -->
<ng-container *ngIf="search.searching && !isEmpty">
<ion-item class="item" *ngIf="!foundRecordsData">
<a (click)="searchReset()">{{ 'addon.mod_data.resetsettings' | translate}}</a>
</ion-item>
<div class="core-success-card" *ngIf="foundRecordsData" (click)="searchReset()">
<p [innerHTML]="'addon.mod_data.foundrecords' | translate:{$a: foundRecordsData}"></p>
</div>
</ng-container>
<div class="addon-data-contents addon-data-entries-{{data.id}}" *ngIf="!isEmpty">
<style *ngIf="cssTemplate">

View File

@ -67,6 +67,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
cssTemplate = '';
extraImports = [AddonModDataComponentsModule];
jsData;
foundRecordsData;
protected syncEventName = AddonModDataSyncProvider.AUTO_SYNCED;
protected entryChangedObserver: any;
@ -263,6 +264,16 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
AddonModDataProvider.PER_PAGE) < entries.totalcount;
this.entriesRendered = '';
if (typeof entries.maxcount != 'undefined') {
this.foundRecordsData = {
num: entries.totalcount,
max: entries.maxcount,
reseturl: '#'
};
} else {
this.foundRecordsData = undefined;
}
if (!this.isEmpty) {
this.cssTemplate = this.dataHelper.prefixCSS(this.data.csstemplate, '.addon-data-entries-' + this.data.id);

View File

@ -18,6 +18,7 @@
"errormustsupplyvalue": "You must supply a value here.",
"expired": "Sorry, this activity closed on {{$a}} and is no longer available",
"fields": "Fields",
"foundrecords": "Found records: {{$a.num}}/{{$a.max}} (<a href=\"{{$a.reseturl}}\">Reset filters</a>)",
"latlongboth": "Both latitude and longitude are required.",
"menuchoose": "Choose...",
"modulenameplural": "Databases",

View File

@ -391,6 +391,7 @@
"addon.mod_data.errormustsupplyvalue": "You must supply a value here.",
"addon.mod_data.expired": "Sorry, this activity closed on {{$a}} and is no longer available",
"addon.mod_data.fields": "Fields",
"addon.mod_data.foundrecords": "Found records: {{$a.num}}/{{$a.max}} (<a href=\"{{$a.reseturl}}\">Reset filters</a>)",
"addon.mod_data.latlongboth": "Both latitude and longitude are required.",
"addon.mod_data.menuchoose": "Choose...",
"addon.mod_data.modulenameplural": "Databases",