commit
5a1bcb8380
|
@ -1,3 +1,5 @@
|
|||
@import "~theme/globals";
|
||||
|
||||
:host {
|
||||
.core-notification-icon {
|
||||
width: 34px;
|
||||
|
@ -17,11 +19,17 @@
|
|||
|
||||
.header {
|
||||
background-color: var(--gray-lighter);
|
||||
}
|
||||
|
||||
.picture {
|
||||
width: auto;
|
||||
text-align: center;
|
||||
.picture {
|
||||
width: 48px;
|
||||
text-align: center;
|
||||
@include padding-horizontal(4px, 0px);
|
||||
padding-top: 8px;
|
||||
|
||||
img {
|
||||
width: 44px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.subject {
|
|
@ -48,7 +48,7 @@
|
|||
<ion-item class="ion-text-wrap">
|
||||
<ion-label>
|
||||
<core-format-text [text]="notification.mobiletext | coreCreateLinks" contextLevel="system"
|
||||
[contextInstanceId]="0" [maxHeight]="notification.displayfullhtml ? 120 : null">
|
||||
[contextInstanceId]="0" [maxHeight]="120">
|
||||
</core-format-text>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
|
|
@ -36,7 +36,7 @@ import {
|
|||
@Component({
|
||||
selector: 'page-addon-notifications-list',
|
||||
templateUrl: 'list.html',
|
||||
styleUrls: ['list.scss'],
|
||||
styleUrls: ['../../notifications.scss'],
|
||||
})
|
||||
export class AddonNotificationsListPage implements OnInit, OnDestroy {
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import { CoreUtils } from '@services/utils/utils';
|
|||
@Component({
|
||||
selector: 'page-addon-notifications-notification',
|
||||
templateUrl: 'notification.html',
|
||||
styleUrls: ['../../notifications.scss'],
|
||||
})
|
||||
export class AddonNotificationsNotificationPage implements OnInit {
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import {
|
|||
AddonNotificationsPreferencesNotificationProcessor,
|
||||
AddonNotificationsPreferencesProcessor,
|
||||
} from './notifications';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
|
||||
/**
|
||||
* Service that provides some helper functions for notifications.
|
||||
|
@ -42,13 +41,8 @@ export class AddonNotificationsHelperProvider {
|
|||
notification: AddonNotificationsNotificationMessageFormatted,
|
||||
): AddonNotificationsNotificationToRender {
|
||||
const formattedNotification: AddonNotificationsNotificationToRender = notification;
|
||||
formattedNotification.displayfullhtml = this.shouldDisplayFullHtml(notification);
|
||||
formattedNotification.iconurl = formattedNotification.iconurl || undefined; // Make sure the property exists.
|
||||
|
||||
formattedNotification.mobiletext = formattedNotification.displayfullhtml ?
|
||||
notification.fullmessagehtml :
|
||||
CoreTextUtils.replaceNewLines((formattedNotification.mobiletext || '').replace(/-{4,}/ig, ''), '<br>');
|
||||
|
||||
return formattedNotification;
|
||||
}
|
||||
|
||||
|
@ -140,16 +134,6 @@ export class AddonNotificationsHelperProvider {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we should display full HTML of the notification.
|
||||
*
|
||||
* @param notification Notification.
|
||||
* @return Whether to display full HTML.
|
||||
*/
|
||||
protected shouldDisplayFullHtml(notification: AddonNotificationsNotificationToRender): boolean {
|
||||
return notification.component == 'mod_forum' && notification.eventtype == 'digests';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const AddonNotificationsHelper = makeSingleton(AddonNotificationsHelperProvider);
|
||||
|
@ -187,6 +171,5 @@ export type AddonNotificationsPreferencesProcessorFormatted = AddonNotifications
|
|||
* Notification with some calculated data to render it.
|
||||
*/
|
||||
export type AddonNotificationsNotificationToRender = AddonNotificationsNotificationMessageFormatted & {
|
||||
displayfullhtml?: boolean; // Whether to display the full HTML of the notification.
|
||||
iconurl?: string;
|
||||
};
|
||||
|
|
|
@ -56,13 +56,7 @@ export class AddonNotificationsProvider {
|
|||
const promises = notifications.map(async (notificationRaw) => {
|
||||
const notification = <AddonNotificationsNotificationMessageFormatted> notificationRaw;
|
||||
|
||||
// Set message to show.
|
||||
if (notification.component && notification.component == 'mod_forum') {
|
||||
notification.mobiletext = notification.smallmessage;
|
||||
} else {
|
||||
notification.mobiletext = notification.fullmessage;
|
||||
}
|
||||
|
||||
notification.mobiletext = notification.fullmessagehtml || notification.fullmessage || notification.smallmessage;
|
||||
notification.moodlecomponent = notification.component;
|
||||
notification.notification = 1;
|
||||
notification.notif = 1;
|
||||
|
@ -171,7 +165,7 @@ export class AddonNotificationsProvider {
|
|||
|
||||
// Request 1 more notification so we can know if there are more notifications.
|
||||
const originalLimit = options.limit;
|
||||
options.limit + 1;
|
||||
options.limit = options.limit + 1;
|
||||
|
||||
const site = await CoreSites.getSite(options.siteId);
|
||||
|
||||
|
|
|
@ -166,8 +166,8 @@ export class CoreFormatTextDirective implements OnChanges {
|
|||
const originalWidth = img.attributes.getNamedItem('width');
|
||||
|
||||
const forcedWidth = Number(originalWidth?.value);
|
||||
if (!isNaN(forcedWidth)) {
|
||||
if (originalWidth!.value.indexOf('%') < 0) {
|
||||
if (originalWidth && !isNaN(forcedWidth)) {
|
||||
if (originalWidth.value.indexOf('%') < 0) {
|
||||
img.style.width = forcedWidth + 'px';
|
||||
} else {
|
||||
img.style.width = forcedWidth + '%';
|
||||
|
|
Loading…
Reference in New Issue