Skip to content

Commit 9ff408d

Browse files
authored
Merge pull request #3841 from dpalou/MOBILE-4362
Mobile 4362
2 parents 935da86 + 379156b commit 9ff408d

File tree

12 files changed

+91
-30
lines changed

12 files changed

+91
-30
lines changed

src/addons/block/myoverview/components/myoverview/myoverview.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
176176
* @inheritdoc
177177
*/
178178
ngOnChanges(changes: SimpleChanges): void {
179+
super.ngOnChanges(changes);
180+
179181
if (this.loaded && changes.block) {
180182
// Block was re-fetched, load content.
181183
this.reloadContent();

src/addons/mod/assign/components/submission/submission.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,11 +1089,11 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
10891089
// Only show outcomes with info on it, outcomeid could be null if outcomes are disabled on site.
10901090
gradeInfo.outcomes?.forEach((outcome) => {
10911091
if (outcome.id == String(grade.outcomeid)) {
1092-
outcome.selected = grade.gradeformatted;
1092+
// Clean HTML tags, grade can contain an icon.
1093+
outcome.selected = CoreTextUtils.cleanTags(grade.gradeformatted || '');
10931094
outcome.modified = grade.gradedategraded;
10941095
if (outcome.options) {
1095-
outcome.selectedId =
1096-
CoreGradesHelper.getGradeValueFromLabel(outcome.options, outcome.selected || '');
1096+
outcome.selectedId = CoreGradesHelper.getGradeValueFromLabel(outcome.options, outcome.selected);
10971097
this.originalGrades.outcomes[outcome.id] = outcome.selectedId;
10981098
outcome.itemNumber = grade.itemnumber;
10991099
}

src/core/components/recaptcha/core-recaptcha.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
<ion-item *ngIf="model[modelValueName]">
88
<ion-label color="success">{{ 'core.answered' | translate }}</ion-label>
99
</ion-item>
10-
<ion-item *ngIf="expired" class="ion-text-wrap">
10+
<ion-item *ngIf="expired" class="ion-text-wrap core-input-error">
1111
<ion-label color="danger">{{ 'core.login.recaptchaexpired' | translate }}</ion-label>
1212
</ion-item>
13+
<ion-item *ngIf="showRequiredError && !model[modelValueName] && !expired" class="ion-text-wrap core-input-error">
14+
<ion-label color="danger">{{ 'core.required' | translate }}</ion-label>
15+
</ion-item>
1316
</div>

src/core/components/recaptcha/recaptcha.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class CoreRecaptchaComponent implements OnInit {
3232
@Input() publicKey?: string; // The site public key.
3333
@Input() modelValueName = 'recaptcharesponse'; // Name of the model property where to store the response.
3434
@Input() siteUrl = ''; // The site URL. If not defined, current site.
35+
@Input() showRequiredError = false; // Whether to display the required error if recaptcha hasn't been answered.
3536

3637
expired = false;
3738

src/core/features/block/classes/base-block-component.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import { OnInit, Input, Component, Optional, Inject } from '@angular/core';
15+
import { OnInit, Input, Component, Optional, Inject, OnChanges, SimpleChanges } from '@angular/core';
1616
import { CoreLogger } from '@singletons/logger';
1717
import { CoreDomUtils } from '@services/utils/dom';
1818
import { CoreUtils } from '@services/utils/utils';
@@ -30,7 +30,7 @@ import { CorePromisedValue } from '@classes/promised-value';
3030
@Component({
3131
template: '',
3232
})
33-
export abstract class CoreBlockBaseComponent implements OnInit, ICoreBlockComponent, AsyncDirective {
33+
export abstract class CoreBlockBaseComponent implements OnInit, OnChanges, ICoreBlockComponent, AsyncDirective {
3434

3535
@Input() title!: string; // The block title.
3636
@Input() block!: CoreCourseBlock; // The block to render.
@@ -54,15 +54,31 @@ export abstract class CoreBlockBaseComponent implements OnInit, ICoreBlockCompon
5454
* @inheritdoc
5555
*/
5656
async ngOnInit(): Promise<void> {
57-
if (this.block.configs && this.block.configs.length > 0) {
58-
this.block.configs.forEach((config) => {
59-
config.value = CoreTextUtils.parseJSON(config.value);
60-
});
57+
await this.loadContent();
58+
}
6159

62-
this.block.configsRecord = CoreUtils.arrayToObject(this.block.configs, 'name');
60+
/**
61+
* @inheritdoc
62+
*/
63+
ngOnChanges(changes: SimpleChanges): void {
64+
if (changes.block) {
65+
this.parseConfigs();
6366
}
67+
}
6468

65-
await this.loadContent();
69+
/**
70+
* Parse configs if needed.
71+
*/
72+
protected parseConfigs(): void {
73+
if (!this.block.configs?.length || this.block.configsRecord) {
74+
return;
75+
}
76+
77+
this.block.configs.forEach((config) => {
78+
config.value = CoreTextUtils.parseJSON(config.value);
79+
});
80+
81+
this.block.configsRecord = CoreUtils.arrayToObject(this.block.configs, 'name');
6682
}
6783

6884
/**

src/core/features/login/pages/credentials/credentials.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
193193

194194
this.siteName = this.siteConfig.sitename;
195195
this.logoUrl = CoreLoginHelper.getLogoUrl(this.siteConfig);
196-
this.authInstructions = this.siteConfig.authinstructions || Translate.instant('core.login.loginsteps');
197196
this.showScanQR = await CoreLoginHelper.displayQRInCredentialsScreen(this.siteConfig.tool_mobile_qrcodetype);
198197

199198
const disabledFeatures = CoreLoginHelper.getDisabledFeatures(this.siteConfig);
@@ -204,6 +203,8 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
204203
!!this.supportConfig?.canContactSupport(),
205204
this.showForgottenPassword,
206205
);
206+
this.authInstructions = this.siteConfig.authinstructions ||
207+
(this.canSignup ? Translate.instant('core.login.loginsteps') : '');
207208

208209
if (!this.eventThrown && !this.viewLeft) {
209210
this.eventThrown = true;

src/core/features/login/pages/email-signup/email-signup.html

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ <h1>{{ 'core.login.newaccount' | translate }}</h1>
2121
<div class="list-item-limited-width">
2222

2323
<!-- Site has an unsupported required field. -->
24-
<ion-list *ngIf="!allRequiredSupported">
24+
<ion-list *ngIf="!allRequiredSupported" class="ion-padding">
2525
<ion-item class="ion-text-wrap">
2626
<ion-label>
2727
{{ 'core.login.signuprequiredfieldnotsupported' | translate }}
2828
</ion-label>
2929
</ion-item>
30-
<ion-button expand="block" class="ion-margin" [href]="signupUrl" core-link autoLogin="no" [showBrowserWarning]="false">
30+
<ion-button expand="block" [href]="signupUrl" core-link autoLogin="no" [showBrowserWarning]="false">
3131
{{ 'core.openinbrowser' | translate }}
3232
</ion-button>
3333
</ion-list>
@@ -62,9 +62,11 @@ <h2>{{ 'core.agelocationverification' | translate }}</h2>
6262
</ion-item>
6363

6464
<!-- Submit button. -->
65-
<ion-button expand="block" class="ion-margin" type="submit" [disabled]="!ageVerificationForm.valid">
66-
{{ 'core.proceed' | translate }}
67-
</ion-button>
65+
<div class="ion-padding">
66+
<ion-button expand="block" type="submit" [disabled]="!ageVerificationForm.valid">
67+
{{ 'core.proceed' | translate }}
68+
</ion-button>
69+
</div>
6870

6971
<ion-item class="ion-text-wrap">
7072
<ion-label>
@@ -186,7 +188,8 @@ <h2>{{ 'core.login.supplyinfo' | translate }}</h2>
186188
<h2><span [core-mark-required]="true">{{ 'core.login.security_question' | translate }}</span></h2>
187189
</ion-label>
188190
</ion-item-divider>
189-
<core-recaptcha [publicKey]="settings.recaptchapublickey" [model]="captcha" [siteUrl]="siteUrl"></core-recaptcha>
191+
<core-recaptcha [publicKey]="settings.recaptchapublickey" [model]="captcha" [siteUrl]="siteUrl"
192+
[showRequiredError]="formSubmitClicked"></core-recaptcha>
190193
</ng-container>
191194

192195
<!-- Site policy (if any). -->
@@ -213,10 +216,12 @@ <h2>{{ 'core.login.policyagreement' | translate }}</h2>
213216
</ion-item>
214217
</ng-container>
215218

216-
<!-- Submit button. -->
217-
<ion-button expand="block" class="ion-margin" type="submit">{{ 'core.login.createaccount' | translate }}</ion-button>
218-
<!-- Remove this once Ionic fixes this bug: https://github.com/ionic-team/ionic-framework/issues/19368 -->
219-
<input type="submit" class="core-submit-hidden-enter" />
219+
<div class="ion-padding">
220+
<!-- Submit button. -->
221+
<ion-button expand="block" type="submit">{{ 'core.login.createaccount' | translate }}</ion-button>
222+
<!-- Remove this once Ionic fixes this bug: https://github.com/ionic-team/ionic-framework/issues/19368 -->
223+
<input type="submit" class="core-submit-hidden-enter" />
224+
</div>
220225
</form>
221226
</ng-container>
222227
</div>
@@ -239,9 +244,11 @@ <h2 *ngIf="siteName" class="item-heading ion-padding">
239244
<p *ngIf="supportEmail">{{ supportEmail }}</p>
240245
</ion-label>
241246
</ion-item>
242-
<ion-button *ngIf="!supportName && !supportEmail" expand="block" class="ion-margin" (click)="showContactOnSite()">
243-
{{ 'core.openinbrowser' | translate }}
244-
</ion-button>
247+
<div class="ion-padding">
248+
<ion-button *ngIf="!supportName && !supportEmail" expand="block" (click)="showContactOnSite()">
249+
{{ 'core.openinbrowser' | translate }}
250+
</ion-button>
251+
</div>
245252
</ion-list>
246253
</div>
247254
</ion-content>

src/core/features/login/pages/email-signup/email-signup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class CoreLoginEmailSignupPage implements OnInit {
6060
settingsLoaded = false;
6161
allRequiredSupported = true;
6262
signupUrl?: string;
63+
formSubmitClicked = false;
6364
captcha = {
6465
recaptcharesponse: '',
6566
};
@@ -265,6 +266,8 @@ export class CoreLoginEmailSignupPage implements OnInit {
265266
e.preventDefault();
266267
e.stopPropagation();
267268

269+
this.formSubmitClicked = true;
270+
268271
if (!this.signupForm.valid || (this.settings?.recaptchapublickey && !this.captcha.recaptcharesponse)) {
269272
// Form not valid. Mark all controls as dirty to display errors.
270273
for (const name in this.signupForm.controls) {
Loading

src/core/features/settings/pages/general/general.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ <h1>{{ 'core.settings.general' | translate }}</h1>
7575
</ion-label>
7676
<ion-toggle [(ngModel)]="debugDisplay" (ionChange)="debugDisplayChanged($event)" slot="end"></ion-toggle>
7777
</ion-item>
78-
<ion-item class="ion-text-wrap" *ngIf="analyticsSupported">
78+
<ion-item class="ion-text-wrap" *ngIf="analyticsAvailable">
7979
<ion-label>
8080
<p class="item-heading">{{ 'core.settings.enableanalytics' | translate }}</p>
8181
<p>{{ 'core.settings.enableanalyticsdescription' | translate }}</p>

0 commit comments

Comments
 (0)