Merge pull request #3720 from alfonso-salces/MOBILE-4267

MOBILE-4267 about: Add idnumber, department and institution
main
Dani Palou 2023-06-26 11:37:45 +02:00 committed by GitHub
commit b60fd49cec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 19 deletions

View File

@ -2492,6 +2492,7 @@
"core.user.completeyourprofile": "local_moodlemobileapp",
"core.user.contact": "local_moodlemobileapp",
"core.user.country": "moodle",
"core.user.department": "moodle",
"core.user.description": "moodle",
"core.user.details": "report_security",
"core.user.detailsnotavailable": "local_moodlemobileapp",
@ -2500,6 +2501,8 @@
"core.user.emailagain": "moodle",
"core.user.errorloaduser": "local_moodlemobileapp",
"core.user.firstname": "moodle",
"core.user.idnumber": "moodle",
"core.user.institution": "moodle",
"core.user.interests": "moodle",
"core.user.lastcourseaccess": "moodle",
"core.user.lastname": "moodle",

View File

@ -9,6 +9,7 @@
"completeyourprofile": "Complete your profile",
"contact": "Contact",
"country": "Country",
"department": "Department",
"description": "Description",
"details": "Details",
"detailsnotavailable": "The details of this user are not available to you.",
@ -17,6 +18,8 @@
"emailagain": "Email (again)",
"errorloaduser": "Error loading user.",
"firstname": "First name",
"idnumber": "ID number",
"institution": "Institution",
"interests": "Interests",
"lastcourseaccess": "Last access to course",
"lastname": "Last name",

View File

@ -59,21 +59,13 @@
</a></p>
</ion-label>
</ion-item>
<ion-item class="ion-text-wrap" *ngIf="formattedAddress">
<ion-label>
<p class="item-heading">{{ 'core.user.address' | translate}}</p>
<p><a class="core-anchor" [href]="encodedAddress" core-link auto-login="no" [showBrowserWarning]="false">
{{ formattedAddress }}
</a></p>
</ion-label>
</ion-item>
<ion-item class="ion-text-wrap" *ngIf="user.city && !formattedAddress">
<ion-item class="ion-text-wrap" *ngIf="user.city">
<ion-label>
<p class="item-heading">{{ 'core.user.city' | translate}}</p>
<p>{{ user.city }}</p>
</ion-label>
</ion-item>
<ion-item class="ion-text-wrap" *ngIf="user.country && !formattedAddress">
<ion-item class="ion-text-wrap" *ngIf="user.country">
<ion-label>
<p class="item-heading">{{ 'core.user.country' | translate}}</p>
<p>{{ user.country }}</p>
@ -85,6 +77,26 @@
<p>{{ user.timezone }}</p>
</ion-label>
</ion-item>
<ng-container *ngIf="canShowDepartment">
<ion-item class="ion-text-wrap" *ngIf="user.idnumber">
<ion-label>
<p class="item-heading">{{ 'core.user.idnumber' | translate }}</p>
<p>{{ user.idnumber }}</p>
</ion-label>
</ion-item>
<ion-item class="ion-text-wrap" *ngIf="user.institution">
<ion-label>
<p class="item-heading">{{ 'core.user.institution' | translate }}</p>
<p>{{ user.institution }}</p>
</ion-label>
</ion-item>
<ion-item class="ion-text-wrap" *ngIf="user.department">
<ion-label>
<p class="item-heading">{{ 'core.user.department' | translate }}</p>
<p>{{ user.department }}</p>
</ion-label>
</ion-item>
</ng-container>
</ion-item-group>
<ion-item-group *ngIf="hasDetails">
<ion-item-divider>

View File

@ -13,12 +13,10 @@
// limitations under the License.
import { Component, OnDestroy, OnInit } from '@angular/core';
import { SafeUrl } from '@angular/platform-browser';
import { IonRefresher } from '@ionic/angular';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import {
@ -52,11 +50,10 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
hasDetails = false;
user?: CoreUserProfile;
title?: string;
formattedAddress?: string;
encodedAddress?: SafeUrl;
canChangeProfilePicture = false;
interests?: string[];
displayTimezone = false;
canShowDepartment = false;
protected userId!: number;
protected site!: CoreSite;
@ -88,6 +85,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
async ngOnInit(): Promise<void> {
this.userId = CoreNavigator.getRouteNumberParam('userId') || 0;
this.courseId = CoreNavigator.getRouteNumberParam('courseId') || 0;
this.canShowDepartment = this.userId != this.site.getUserId();
// Allow to change the profile image only in the app profile page.
this.canChangeProfilePicture =
@ -110,11 +108,6 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
try {
const user = await CoreUser.getProfile(this.userId, this.courseId);
if (user.address) {
this.formattedAddress = CoreUserHelper.formatAddress(user.address, user.city, user.country);
this.encodedAddress = CoreTextUtils.buildAddressURL(this.formattedAddress);
}
this.interests = user.interests ?
user.interests.split(',').map(interest => interest.trim()) :
undefined;