Merge pull request #1703 from crazyserver/MOBILE-2795

Mobile 2795
main
Juan Leyva 2019-01-04 16:20:48 +01:00 committed by GitHub
commit b83656655a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 48 additions and 32 deletions

View File

@ -57,7 +57,7 @@
"searchnomessagesfound": "No messages found",
"searchnononcontactsfound": "No non contacts found",
"sendcontactrequest": "Send contact request",
"showdeletemessages": "Show delete messages",
"showdeletemessages": "Show delete options",
"type_blocked": "Blocked",
"type_offline": "Offline",
"type_online": "Online",

View File

@ -1,8 +1,8 @@
<ion-header>
<ion-navbar core-back-button>
<ion-title>
<img *ngIf="!otherMember && conversationImage" class="core-bar-button-image" [src]="conversationImage" alt="" onError="this.src='assets/img/group-avatar.png'" core-external-content role="presentation" [siteId]="siteId || null">
<ion-avatar *ngIf="otherMember" class="core-bar-button-image" core-user-avatar [user]="otherMember" [linkProfile]="false" [checkOnline]="otherMember.showonlinestatus" item-start (click)="showInfo && viewInfo()"></ion-avatar>
<img *ngIf="loaded && !otherMember && conversationImage" class="core-bar-button-image" [src]="conversationImage" alt="" onError="this.src='assets/img/group-avatar.png'" core-external-content role="presentation" [siteId]="siteId || null">
<ion-avatar *ngIf="loaded && otherMember" class="core-bar-button-image" core-user-avatar [user]="otherMember" [linkProfile]="false" [checkOnline]="otherMember.showonlinestatus" item-start (click)="showInfo && viewInfo()"></ion-avatar>
<core-format-text [text]="title" (click)="showInfo && !isGroup && viewInfo()"></core-format-text>
<core-icon *ngIf="conversation && conversation.isfavourite" name="fa-star"></core-icon>
</ion-title>

View File

@ -2,7 +2,7 @@
<ion-navbar core-back-button>
<ion-title><core-format-text [text]="title"></core-format-text></ion-title>
<ion-buttons end>
<button ion-button clear (click)="save()" [attr.aria-label]="'core.save' | translate">
<button ion-button clear (click)="save($event)" [attr.aria-label]="'core.save' | translate">
{{ 'core.save' | translate }}
</button>
</ion-buttons>

View File

@ -113,7 +113,7 @@
{{ 'addon.mod_feedback.preview' | translate }}
</button>
</ion-col>
<ion-col *ngIf="access.cancomplete && access.cansubmit">
<ion-col *ngIf="access.cancomplete && access.cansubmit && access.isopen">
<button ion-button block icon-end *ngIf="!goPage" (click)="gotoAnswerQuestions()">
{{ 'addon.mod_feedback.complete_the_form' | translate }}
<ion-icon name="arrow-forward"></ion-icon>

View File

@ -138,7 +138,7 @@ export class AddonModFeedbackHelperProvider {
responses[name] = value;
});
} else {
if (itemData.typ == 'multichoice') {
if (itemData.typ == 'multichoice' && itemData.subtype != 'r') {
name = nameTemp + '[0]';
} else {
name = nameTemp;

View File

@ -55,7 +55,7 @@ export class MoodleMobileApp implements OnInit {
desktopClass += this.appProvider.isMac() ? ' platform-mac' : '';
desktopClass += this.appProvider.isLinux() ? ' platform-linux' : '';
desktopClass += this.appProvider.isWindows() ? ' platform-windows' : '';
app.setElementClass(desktopClass, true);
desktopClass != '' ? app.setElementClass(desktopClass, true) : false;
});
}

View File

@ -411,6 +411,10 @@ ion-app.app-root {
}
}
.col > .button-block {
contain: content;
}
// File uploader.
// -------------------------

View File

@ -205,7 +205,7 @@
"addon.messages.searchnomessagesfound": "No messages found",
"addon.messages.searchnononcontactsfound": "No non contacts found",
"addon.messages.sendcontactrequest": "Send contact request",
"addon.messages.showdeletemessages": "Show delete messages",
"addon.messages.showdeletemessages": "Show delete options",
"addon.messages.type_blocked": "Blocked",
"addon.messages.type_offline": "Offline",
"addon.messages.type_online": "Online",
@ -1165,7 +1165,7 @@
"core.areyousure": "Are you sure?",
"core.back": "Back",
"core.cancel": "Cancel",
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL.",
"core.cannotconnect": "Cannot connect: Verify that you have typed the URL correctly.",
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
"core.captureaudio": "Record audio",
"core.capturedimage": "Taken picture.",
@ -1460,7 +1460,7 @@
"core.login.selectsite": "Please select your site:",
"core.login.signupplugindisabled": "{{$a}} is not enabled.",
"core.login.siteaddress": "Site address",
"core.login.sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.",
"core.login.sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects and so cannot connect to your site.",
"core.login.siteinmaintenance": "Your site is in maintenance mode",
"core.login.sitepolicynotagreederror": "Site policy not agreed.",
"core.login.siteurl": "Site URL",
@ -1522,7 +1522,7 @@
"core.nograde": "No grade",
"core.none": "None",
"core.nopasswordchangeforced": "You cannot proceed without changing your password.",
"core.nopermissionerror": "Sorry, but you do not currently have permissions to do that",
"core.nopermissionerror": "Sorry, but you do not currently have permissions to do that.",
"core.nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}})",
"core.noresults": "No results",
"core.notapplicable": "n/a",
@ -1596,7 +1596,7 @@
"core.settings.cordovaversion": "Cordova version",
"core.settings.currentlanguage": "Current language",
"core.settings.debugdisplay": "Display debug messages",
"core.settings.debugdisplaydescription": "If enabled, error modals will display more data about the error if possible.",
"core.settings.debugdisplaydescription": "If enabled, additional information about errors will be displayed.",
"core.settings.deletesitefiles": "Are you sure that you want to delete the downloaded files from the site '{{sitename}}'?",
"core.settings.deletesitefilestitle": "Delete site files",
"core.settings.deviceinfo": "Device info",

View File

@ -12,11 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component, Input, OnInit, OnChanges, SimpleChange } from '@angular/core';
import { Component, Input, OnInit, OnChanges, OnDestroy, SimpleChange } from '@angular/core';
import { NavController } from 'ionic-angular';
import { CoreSitesProvider } from '@providers/sites';
import { CoreAppProvider } from '@providers/app';
import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreEventsProvider } from '@providers/events';
import { CoreUserProvider } from '@core/user/providers/user';
/**
* Component to display a "user avatar".
@ -27,7 +29,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils';
selector: 'ion-avatar[core-user-avatar]',
templateUrl: 'core-user-avatar.html'
})
export class CoreUserAvatarComponent implements OnInit, OnChanges {
export class CoreUserAvatarComponent implements OnInit, OnChanges, OnDestroy {
@Input() user: any;
// The following params will override the ones in user object.
@Input() profileUrl?: string;
@ -42,10 +44,17 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges {
protected timetoshowusers = 300000; // Miliseconds default.
protected myUser = false;
protected currentUserId: number;
protected pictureObs;
constructor(private navCtrl: NavController, private sitesProvider: CoreSitesProvider, private utils: CoreUtilsProvider,
private appProvider: CoreAppProvider) {
private appProvider: CoreAppProvider, eventsProvider: CoreEventsProvider) {
this.currentUserId = this.sitesProvider.getCurrentSiteUserId();
this.pictureObs = eventsProvider.on(CoreUserProvider.PROFILE_PICTURE_UPDATED, (data) => {
if (data.userId == this.userId) {
this.profileUrl = data.picture;
}
}, this.sitesProvider.getCurrentSiteId());
}
/**
@ -69,11 +78,11 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges {
* Set fields from user.
*/
protected setFields(): void {
this.profileUrl = this.profileUrl || (this.user && (this.user.profileimageurl || this.user.userprofileimageurl ||
const profileUrl = this.profileUrl || (this.user && (this.user.profileimageurl || this.user.userprofileimageurl ||
this.user.userpictureurl || this.user.profileimageurlsmall));
if (typeof this.profileUrl != 'string') {
this.profileUrl = '';
if (typeof profileUrl == 'string') {
this.profileUrl = profileUrl;
}
this.fullname = this.fullname || (this.user && (this.user.fullname || this.user.userfullname));
@ -117,4 +126,11 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges {
this.navCtrl.push('CoreUserProfilePage', { userId: this.userId, courseId: this.courseId });
}
}
/**
* Component destroyed.
*/
ngOnDestroy(): void {
this.pictureObs && this.pictureObs.off();
}
}

View File

@ -78,20 +78,16 @@ export class CoreCommentsViewerPage {
// Get the user profile image.
this.userProvider.getProfile(comment.userid, undefined, true).then((user) => {
comment.profileimageurl = user.profileimageurl;
}).catch(() => {
// Ignore errors.
});
});
}).catch((error) => {
if (error) {
if (this.component == 'assignsubmission_comments') {
this.domUtils.showAlertTranslated('core.notice', 'core.commentsnotworking');
} else {
this.domUtils.showErrorModal(error);
}
if (error && this.component == 'assignsubmission_comments') {
this.domUtils.showAlertTranslated('core.notice', 'core.commentsnotworking');
} else {
this.domUtils.showErrorModal(this.translate.instant('core.error') + ': get_comments');
this.domUtils.showErrorModalDefault(error, this.translate.instant('core.error') + ': get_comments');
}
return Promise.reject(null);
});
}

View File

@ -77,7 +77,7 @@
"selectsite": "Please select your site:",
"signupplugindisabled": "{{$a}} is not enabled.",
"siteaddress": "Site address",
"sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.",
"sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects and so cannot connect to your site.",
"siteinmaintenance": "Your site is in maintenance mode",
"sitepolicynotagreederror": "Site policy not agreed.",
"siteurl": "Site URL",

View File

@ -11,7 +11,7 @@
"cordovaversion": "Cordova version",
"currentlanguage": "Current language",
"debugdisplay": "Display debug messages",
"debugdisplaydescription": "If enabled, error modals will display more data about the error if possible.",
"debugdisplaydescription": "If enabled, additional information about errors will be displayed.",
"deletesitefiles": "Are you sure that you want to delete the downloaded files from the site '{{sitename}}'?",
"deletesitefilestitle": "Delete site files",
"deviceinfo": "Device info",

View File

@ -148,7 +148,7 @@ export class CoreUserProfilePage {
this.eventsProvider.trigger(CoreUserProvider.PROFILE_PICTURE_UPDATED, {
userId: this.userId,
picture: profileImageURL
});
}, this.site.getId());
this.sitesProvider.updateSiteInfo(this.site.getId());
this.refreshUser();
}).finally(() => {

View File

@ -11,7 +11,7 @@
"areyousure": "Are you sure?",
"back": "Back",
"cancel": "Cancel",
"cannotconnect": "Cannot connect: Verify that you have correctly typed the URL.",
"cannotconnect": "Cannot connect: Verify that you have typed the URL correctly.",
"cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
"captureaudio": "Record audio",
"capturedimage": "Taken picture.",
@ -164,7 +164,7 @@
"nograde": "No grade",
"none": "None",
"nopasswordchangeforced": "You cannot proceed without changing your password.",
"nopermissionerror": "Sorry, but you do not currently have permissions to do that",
"nopermissionerror": "Sorry, but you do not currently have permissions to do that.",
"nopermissions": "Sorry, but you do not currently have permissions to do that ({{$a}})",
"noresults": "No results",
"notapplicable": "n/a",