MOBILE-3509 notifications: Display forum digest notification html
parent
6fa5578b53
commit
fc86308b21
|
@ -30,7 +30,7 @@
|
||||||
<p *ngIf="notification.userfromfullname">{{ notification.userfromfullname }}</p>
|
<p *ngIf="notification.userfromfullname">{{ notification.userfromfullname }}</p>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item text-wrap>
|
<ion-item text-wrap>
|
||||||
<p><core-format-text [text]="notification.mobiletext | coreCreateLinks" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
<p><core-format-text [text]="notification.mobiletext | coreCreateLinks" contextLevel="system" [contextInstanceId]="0" [maxHeight]="notification.displayfullhtml ? 120 : null"></core-format-text></p>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<addon-notifications-actions [contextUrl]="notification.contexturl" [courseId]="notification.courseid" [data]="notification.customdata"></addon-notifications-actions>
|
<addon-notifications-actions [contextUrl]="notification.contexturl" [courseId]="notification.courseid" [data]="notification.customdata"></addon-notifications-actions>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|
|
@ -1,5 +1,61 @@
|
||||||
page-addon-notifications-list .core-notification-icon {
|
page-addon-notifications-list {
|
||||||
|
.core-notification-icon {
|
||||||
width: 34px;
|
width: 34px;
|
||||||
height: 34px;
|
height: 34px;
|
||||||
margin: 10px !important;
|
margin: 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item core-format-text {
|
||||||
|
.forumpost {
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
display: block;
|
||||||
|
padding: 6px;
|
||||||
|
margin: 0 0 1em 0;
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
padding: 5px;
|
||||||
|
border-bottom: 1px solid #e3e3e3;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picture {
|
||||||
|
width: auto;
|
||||||
|
|
||||||
|
img {
|
||||||
|
margin: 3px;
|
||||||
|
|
||||||
|
&.userpicture {
|
||||||
|
margin-left: 3px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.subject {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userpicture {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdl-right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
background-color: #e3e3e3;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -204,8 +204,21 @@ export class AddonNotificationsListPage {
|
||||||
* @param notification The notification object.
|
* @param notification The notification object.
|
||||||
*/
|
*/
|
||||||
protected formatText(notification: AddonNotificationsAnyNotification): void {
|
protected formatText(notification: AddonNotificationsAnyNotification): void {
|
||||||
const text = notification.mobiletext.replace(/-{4,}/ig, '');
|
notification.displayfullhtml = this.shouldDisplayFullHtml(notification);
|
||||||
notification.mobiletext = this.textUtils.replaceNewLines(text, '<br>');
|
|
||||||
|
notification.mobiletext = notification.displayfullhtml ?
|
||||||
|
notification.fullmessagehtml :
|
||||||
|
this.textUtils.replaceNewLines(notification.mobiletext.replace(/-{4,}/ig, ''), '<br>');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether we should display full HTML of the notification.
|
||||||
|
*
|
||||||
|
* @param notification Notification.
|
||||||
|
* @return Whether to display full HTML.
|
||||||
|
*/
|
||||||
|
protected shouldDisplayFullHtml(notification: AddonNotificationsAnyNotification): boolean {
|
||||||
|
return notification.component == 'mod_forum' && notification.eventtype == 'digests';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -616,4 +616,5 @@ export type AddonNotificationsNotificationCalculatedData = {
|
||||||
courseid?: number; // Calculated in the app. Course the notification belongs to.
|
courseid?: number; // Calculated in the app. Course the notification belongs to.
|
||||||
profileimageurlfrom?: string; // Calculated in the app. Avatar of user that sent the notification.
|
profileimageurlfrom?: string; // Calculated in the app. Avatar of user that sent the notification.
|
||||||
userfromfullname?: string; // Calculated in the app in some cases. User from full name.
|
userfromfullname?: string; // Calculated in the app in some cases. User from full name.
|
||||||
|
displayfullhtml?: boolean; // Whether to display the full HTML of the notification.
|
||||||
};
|
};
|
||||||
|
|
|
@ -1914,6 +1914,7 @@
|
||||||
"core.openmodinbrowser": "Open {{$a}} in browser",
|
"core.openmodinbrowser": "Open {{$a}} in browser",
|
||||||
"core.othergroups": "Other groups",
|
"core.othergroups": "Other groups",
|
||||||
"core.pagea": "Page {{$a}}",
|
"core.pagea": "Page {{$a}}",
|
||||||
|
"core.parentlanguage": "",
|
||||||
"core.paymentinstant": "Use the button below to pay and be enrolled within minutes!",
|
"core.paymentinstant": "Use the button below to pay and be enrolled within minutes!",
|
||||||
"core.percentagenumber": "{{$a}}%",
|
"core.percentagenumber": "{{$a}}%",
|
||||||
"core.phone": "Phone",
|
"core.phone": "Phone",
|
||||||
|
|
Loading…
Reference in New Issue