MOBILE-2201 data: Display message in pages where tags are not supported

main
Albert Gasset 2019-07-08 11:21:48 +02:00
parent c07eb58568
commit c00cbb9b8d
5 changed files with 20 additions and 4 deletions

View File

@ -431,6 +431,7 @@
"addon.mod_data.confirmdeleterecord": "data", "addon.mod_data.confirmdeleterecord": "data",
"addon.mod_data.descending": "data", "addon.mod_data.descending": "data",
"addon.mod_data.disapprove": "data", "addon.mod_data.disapprove": "data",
"addon.mod_data.edittagsnotsupported": "local_moodlemobileapp",
"addon.mod_data.emptyaddform": "data", "addon.mod_data.emptyaddform": "data",
"addon.mod_data.entrieslefttoadd": "data", "addon.mod_data.entrieslefttoadd": "data",
"addon.mod_data.entrieslefttoaddtoview": "data", "addon.mod_data.entrieslefttoaddtoview": "data",
@ -455,6 +456,7 @@
"addon.mod_data.recorddisapproved": "data", "addon.mod_data.recorddisapproved": "data",
"addon.mod_data.resetsettings": "data", "addon.mod_data.resetsettings": "data",
"addon.mod_data.search": "data", "addon.mod_data.search": "data",
"addon.mod_data.searchbytagsnotsupported": "local_moodlemobileapp",
"addon.mod_data.selectedrequired": "data", "addon.mod_data.selectedrequired": "data",
"addon.mod_data.single": "data", "addon.mod_data.single": "data",
"addon.mod_data.timeadded": "data", "addon.mod_data.timeadded": "data",

View File

@ -10,6 +10,7 @@
"confirmdeleterecord": "Are you sure you want to delete this entry?", "confirmdeleterecord": "Are you sure you want to delete this entry?",
"descending": "Descending", "descending": "Descending",
"disapprove": "Undo approval", "disapprove": "Undo approval",
"edittagsnotsupported": "Sorry, editing tags is not supported by the app.",
"emptyaddform": "You did not fill out any fields!", "emptyaddform": "You did not fill out any fields!",
"entrieslefttoadd": "You must add {{$a.entriesleft}} more entry/entries in order to complete this activity", "entrieslefttoadd": "You must add {{$a.entriesleft}} more entry/entries in order to complete this activity",
"entrieslefttoaddtoview": "You must add {{$a.entrieslefttoview}} more entry/entries before you can view other participants' entries.", "entrieslefttoaddtoview": "You must add {{$a.entrieslefttoview}} more entry/entries before you can view other participants' entries.",
@ -34,6 +35,7 @@
"recorddisapproved": "Entry unapproved", "recorddisapproved": "Entry unapproved",
"resetsettings": "Reset filters", "resetsettings": "Reset filters",
"search": "Search", "search": "Search",
"searchbytagsnotsupported": "Sorry, searching by tags is not supported by the app.",
"selectedrequired": "All selected required", "selectedrequired": "All selected required",
"single": "View single", "single": "View single",
"timeadded": "Time added", "timeadded": "Time added",

View File

@ -28,6 +28,7 @@ import { AddonModDataHelperProvider } from '../../providers/helper';
import { AddonModDataOfflineProvider } from '../../providers/offline'; import { AddonModDataOfflineProvider } from '../../providers/offline';
import { AddonModDataFieldsDelegate } from '../../providers/fields-delegate'; import { AddonModDataFieldsDelegate } from '../../providers/fields-delegate';
import { AddonModDataComponentsModule } from '../../components/components.module'; import { AddonModDataComponentsModule } from '../../components/components.module';
import { CoreTagProvider } from '@core/tag/providers/tag';
/** /**
* Page that displays the view edit page. * Page that displays the view edit page.
@ -68,7 +69,8 @@ export class AddonModDataEditPage {
protected courseProvider: CoreCourseProvider, protected dataProvider: AddonModDataProvider, protected courseProvider: CoreCourseProvider, protected dataProvider: AddonModDataProvider,
protected dataOffline: AddonModDataOfflineProvider, protected dataHelper: AddonModDataHelperProvider, protected dataOffline: AddonModDataOfflineProvider, protected dataHelper: AddonModDataHelperProvider,
sitesProvider: CoreSitesProvider, protected navCtrl: NavController, protected translate: TranslateService, sitesProvider: CoreSitesProvider, protected navCtrl: NavController, protected translate: TranslateService,
protected eventsProvider: CoreEventsProvider, protected fileUploaderProvider: CoreFileUploaderProvider) { protected eventsProvider: CoreEventsProvider, protected fileUploaderProvider: CoreFileUploaderProvider,
private tagProvider: CoreTagProvider) {
this.module = params.get('module') || {}; this.module = params.get('module') || {};
this.entryId = params.get('entryId') || null; this.entryId = params.get('entryId') || null;
this.courseId = params.get('courseId'); this.courseId = params.get('courseId');
@ -309,6 +311,11 @@ export class AddonModDataEditPage {
template = template.replace(replace, 'field_' + field.id); template = template.replace(replace, 'field_' + field.id);
}); });
// Editing tags is not supported.
replace = new RegExp('##tags##', 'gi');
const message = '<p class="item-dimmed">{{ \'addon.mod_data.edittagsnotsupported\' | translate }}</p>';
template = template.replace(replace, this.tagProvider.areTagsAvailableInSite() ? message : '');
return template; return template;
} }

View File

@ -21,6 +21,7 @@ import { CoreTextUtilsProvider } from '@providers/utils/text';
import { AddonModDataComponentsModule } from '../../components/components.module'; import { AddonModDataComponentsModule } from '../../components/components.module';
import { AddonModDataFieldsDelegate } from '../../providers/fields-delegate'; import { AddonModDataFieldsDelegate } from '../../providers/fields-delegate';
import { AddonModDataHelperProvider } from '../../providers/helper'; import { AddonModDataHelperProvider } from '../../providers/helper';
import { CoreTagProvider } from '@core/tag/providers/tag';
/** /**
* Page that displays the search modal. * Page that displays the search modal.
@ -42,7 +43,8 @@ export class AddonModDataSearchPage {
constructor(params: NavParams, private viewCtrl: ViewController, fb: FormBuilder, protected utils: CoreUtilsProvider, constructor(params: NavParams, private viewCtrl: ViewController, fb: FormBuilder, protected utils: CoreUtilsProvider,
protected domUtils: CoreDomUtilsProvider, protected fieldsDelegate: AddonModDataFieldsDelegate, protected domUtils: CoreDomUtilsProvider, protected fieldsDelegate: AddonModDataFieldsDelegate,
protected textUtils: CoreTextUtilsProvider, protected dataHelper: AddonModDataHelperProvider) { protected textUtils: CoreTextUtilsProvider, protected dataHelper: AddonModDataHelperProvider,
private tagProvider: CoreTagProvider) {
this.search = params.get('search'); this.search = params.get('search');
this.fields = params.get('fields'); this.fields = params.get('fields');
this.data = params.get('data'); this.data = params.get('data');
@ -117,9 +119,10 @@ export class AddonModDataSearchPage {
[placeholder]="\'addon.mod_data.authorlastname\' | translate" formControlName="lastname"></ion-input></span>'; [placeholder]="\'addon.mod_data.authorlastname\' | translate" formControlName="lastname"></ion-input></span>';
template = template.replace(replace, render); template = template.replace(replace, render);
// Tags are unsupported right now. // Searching by tags is not supported.
replace = new RegExp('##tags##', 'gi'); replace = new RegExp('##tags##', 'gi');
template = template.replace(replace, ''); const message = '<p class="item-dimmed">{{ \'addon.mod_data.searchbytagsnotsupported\' | translate }}</p>';
template = template.replace(replace, this.tagProvider.areTagsAvailableInSite() ? message : '');
return template; return template;
} }

View File

@ -431,6 +431,7 @@
"addon.mod_data.confirmdeleterecord": "Are you sure you want to delete this entry?", "addon.mod_data.confirmdeleterecord": "Are you sure you want to delete this entry?",
"addon.mod_data.descending": "Descending", "addon.mod_data.descending": "Descending",
"addon.mod_data.disapprove": "Undo approval", "addon.mod_data.disapprove": "Undo approval",
"addon.mod_data.edittagsnotsupported": "Sorry, editing tags is not supported by the app.",
"addon.mod_data.emptyaddform": "You did not fill out any fields!", "addon.mod_data.emptyaddform": "You did not fill out any fields!",
"addon.mod_data.entrieslefttoadd": "You must add {{$a.entriesleft}} more entry/entries in order to complete this activity", "addon.mod_data.entrieslefttoadd": "You must add {{$a.entriesleft}} more entry/entries in order to complete this activity",
"addon.mod_data.entrieslefttoaddtoview": "You must add {{$a.entrieslefttoview}} more entry/entries before you can view other participants' entries.", "addon.mod_data.entrieslefttoaddtoview": "You must add {{$a.entrieslefttoview}} more entry/entries before you can view other participants' entries.",
@ -455,6 +456,7 @@
"addon.mod_data.recorddisapproved": "Entry unapproved", "addon.mod_data.recorddisapproved": "Entry unapproved",
"addon.mod_data.resetsettings": "Reset filters", "addon.mod_data.resetsettings": "Reset filters",
"addon.mod_data.search": "Search", "addon.mod_data.search": "Search",
"addon.mod_data.searchbytagsnotsupported": "Sorry, searching by tags is not supported by the app.",
"addon.mod_data.selectedrequired": "All selected required", "addon.mod_data.selectedrequired": "All selected required",
"addon.mod_data.single": "View single", "addon.mod_data.single": "View single",
"addon.mod_data.timeadded": "Time added", "addon.mod_data.timeadded": "Time added",