Перейти к содержанию

Colorful notifications // Красочные уведомления


MrHaim

Рекомендуемые сообщения

Hi!

 

A simple guide to coloring notifications, thanks to which they will be sorted into the categories you want. Example below.

image.thumb.png.9b499fc1ad17ddc73b89c513a5ec6894.png.c1871a7ef7fcd0829e23c644bedad159.png

To begin with, we add the following code snippet to two notification templates.

data-lkNotify='{$notification['data']['title']}'

For this we go to:

Styles -> Edit HTML/CSS -> Templates -> core -> front -> system -> notificationsAjax and notificationsRows

image.png.b264b9616f0e42bfe4628818f3a47bba.png.9f65a4871f7ba8acc01012579e5db780.png

 

notificationsAjax - popup with notifications

We add the above code snippet in place as in the screenshot below.

image.thumb.png.ae98529273196762ed1c2e21e1815584.png.123483a58f43cc67f9cc0f4f08bb5d79.png

 

Ready for the default template:

 

{{if empty( $notifications )}}
	<li class='ipsDataItem ipsDataItem_unread'>
		<div class='ipsPad ipsType_light ipsType_center ipsType_normal'>{lang="no_results_notifications"}</div>
	</li>
{{else}}
	{{foreach $notifications as $notification}}
		<li class='ipsDataItem {{if !$notification['notification']->read_time}}ipsDataItem_unread{{endif}}' data-lkNotify='{$notification['data']['title']}'>
			<div class='ipsDataItem_icon'>
				{{if isset( $notification['data']['author'] )}}
					{template="userPhoto" app="core" group="global" params="$notification['data']['author'], 'mini'"}
				{{endif}}
			</div>
			<div class='ipsDataItem_main'>
              	<a href="{$notification['data']['url']}">
					<span class='ipsDataItem_title'>{$notification['data']['title']}</span>
					<br>
					<span class="ipsType_light">{datetime="$notification['notification']->updated_time"}</span>
				</a>
			</div>
		</li>
	{{endforeach}}
{{endif}}

 

notificationsRows - subpage with notifications

We add the same piece of code in place as in the screenshot below.

image.thumb.png.db77ac2f15f4e36fbf7109d9464d4755.png.34a62e152b1a7ed1754bedf5984e6110.png

 

Ready for the default template:

{{if \count( $rows )}} 
	{{foreach $rows as $notification}}
		{{if isset( $notification['data']['title'] )}}
			<li class='ipsDataItem {{if $notification['data']['unread']}}ipsDataItem_unread{{endif}} ipsClearfix' data-lkNotify='{$notification['data']['title']}'>
				<div class='ipsDataItem_icon'>
					{{if isset( $notification['data']['author'] )}}
						{template="userPhoto" app="core" group="global" params="$notification['data']['author'], 'tiny'"}
					{{endif}}
				</div>
				<div class='ipsDataItem_main'>
					{{if !$notification['data']['unread']}}
						<span class="ipsItemStatus ipsItemStatus_small ipsItemStatus_read">
							<i class="fa fa-circle"></i>
						</span>
						<strong>
					{{endif}}
							<a href="{$notification['data']['url']}" class='ipsDataItem_title'>{$notification['data']['title']}</a>
					{{if !$notification['data']['unread']}}
						</strong>
					{{endif}}
					<br>
					<span class="ipsType_light">{datetime="$notification['notification']->updated_time"}</span>
				</div>
			</li>
			{{endif}}
	{{endforeach}}
{{endif}}

 

It remains to add the CSS code to the template. For this we go to:

Styles -> Edit HTML/CSS -> CSS -> core -> front -> custom -> custom.css

We add colors according to the scheme below:

[data-lkNotify*="zareagował na"],
[data-lkNotify*="reacted to a"] {
    background-image: linear-gradient(to right, #ffeaea, transparent)!important;
}

[data-lkNotify*="wspomniał o tobie"],
[data-lkNotify*="mentioned you in a"] {
    background-image: linear-gradient(to right, #eaffea, transparent)!important;
}

[data-lkNotify*="zacytował cię"],
[data-lkNotify*="quoted you in a"] {
    background-image: linear-gradient(to right, #eaeaff, transparent)!important;
}

[data-lkNotify*="zaczął cię obserwować"],
[data-lkNotify*="is now following you"] {
    background-image: linear-gradient(to right, #eaffff, transparent)!important;
}

Pros

  • Segregated notifications
  • Simple implementation

Minuses

  • Extra lines of code in CSS for multi-language support.

 

Credit Marcin Lis

Ссылка на комментарий
Поделиться на другие сайты

Присоединяйтесь к обсуждению

Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.
Примечание: Ваш пост будет проверен модератором, прежде чем станет видимым.

Гость
Ответить в этой теме...

×   Вставлено с форматированием.   Вставить как обычный текст

  Разрешено использовать не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отображать как обычную ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставлять изображения напрямую. Загружайте или вставляйте изображения по ссылке.

  • Последние посетители   0 пользователей онлайн

    • Ни одного зарегистрированного пользователя не просматривает данную страницу
×
×
  • Создать...