Merge pull request #3041 from rabuzarus/20161221_-_frio_notifications
frio notifications templates + local date & profile link for the notifications page
This commit is contained in:
commit
584cf75af3
19 changed files with 97 additions and 29 deletions
|
@ -198,8 +198,10 @@ class NotificationsManager {
|
|||
* string 'label' => The type of the notification
|
||||
* string 'link' => URL to the source
|
||||
* string 'image' => The avatar image
|
||||
* string 'url' => The profile url of the contact
|
||||
* string 'text' => The notification text
|
||||
* string 'when' => Relative date of the notification
|
||||
* string 'when' => The date of the notification
|
||||
* string 'ago' => T relative date of the notification
|
||||
* bool 'seen' => Is the notification marked as "seen"
|
||||
*/
|
||||
private function formatNotifs($notifs, $ident = "") {
|
||||
|
@ -223,26 +225,32 @@ class NotificationsManager {
|
|||
$default_item_label = 'notify';
|
||||
$default_item_link = $this->a->get_baseurl(true).'/notify/view/'. $it['id'];
|
||||
$default_item_image = proxy_url($it['photo'], false, PROXY_SIZE_MICRO);
|
||||
$default_item_url = $it['url'];
|
||||
$default_item_text = strip_tags(bbcode($it['msg']));
|
||||
$default_item_when = relative_date($it['date']);
|
||||
$default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['date'], 'r');
|
||||
$default_item_ago = relative_date($it['date']);
|
||||
break;
|
||||
|
||||
case 'home':
|
||||
$default_item_label = 'comment';
|
||||
$default_item_link = $this->a->get_baseurl(true).'/display/'.$it['pguid'];
|
||||
$default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO);
|
||||
$default_item_url = $it['author-link'];
|
||||
$default_item_text = sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname']);
|
||||
$default_item_when = relative_date($it['created']);
|
||||
$default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['created'], 'r');
|
||||
$default_item_ago = relative_date($it['created']);
|
||||
break;
|
||||
|
||||
default:
|
||||
$default_item_label = (($it['id'] == $it['parent']) ? 'post' : 'comment');
|
||||
$default_item_link = $this->a->get_baseurl(true).'/display/'.$it['pguid'];
|
||||
$default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO);
|
||||
$default_item_url = $it['author-link'];
|
||||
$default_item_text = (($it['id'] == $it['parent'])
|
||||
? sprintf(t("%s created a new post"), $it['author-name'])
|
||||
: sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname']));
|
||||
$default_item_when = relative_date($it['created']);
|
||||
$default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['created'], 'r');
|
||||
$default_item_ago = relative_date($it['created']);
|
||||
|
||||
}
|
||||
|
||||
|
@ -253,8 +261,10 @@ class NotificationsManager {
|
|||
'label' => 'like',
|
||||
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'url' => $it['author-link'],
|
||||
'text' => sprintf(t("%s liked %s's post"), $it['author-name'], $it['pname']),
|
||||
'when' => relative_date($it['created']),
|
||||
'when' => $default_item_when,
|
||||
'ago' => $default_item_ago,
|
||||
'seen' => $it['seen']
|
||||
);
|
||||
break;
|
||||
|
@ -264,8 +274,10 @@ class NotificationsManager {
|
|||
'label' => 'dislike',
|
||||
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'url' => $it['author-link'],
|
||||
'text' => sprintf(t("%s disliked %s's post"), $it['author-name'], $it['pname']),
|
||||
'when' => relative_date($it['created']),
|
||||
'when' => $default_item_when,
|
||||
'ago' => $default_item_ago,
|
||||
'seen' => $it['seen']
|
||||
);
|
||||
break;
|
||||
|
@ -275,8 +287,10 @@ class NotificationsManager {
|
|||
'label' => 'attend',
|
||||
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'url' => $it['author-link'],
|
||||
'text' => sprintf(t("%s is attending %s's event"), $it['author-name'], $it['pname']),
|
||||
'when' => relative_date($it['created']),
|
||||
'when' => $default_item_when,
|
||||
'ago' => $default_item_ago,
|
||||
'seen' => $it['seen']
|
||||
);
|
||||
break;
|
||||
|
@ -286,8 +300,10 @@ class NotificationsManager {
|
|||
'label' => 'attendno',
|
||||
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'url' => $it['author-link'],
|
||||
'text' => sprintf( t("%s is not attending %s's event"), $it['author-name'], $it['pname']),
|
||||
'when' => relative_date($it['created']),
|
||||
'when' => $default_item_when,
|
||||
'ago' => $default_item_ago,
|
||||
'seen' => $it['seen']
|
||||
);
|
||||
break;
|
||||
|
@ -297,8 +313,10 @@ class NotificationsManager {
|
|||
'label' => 'attendmaybe',
|
||||
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'url' => $it['author-link'],
|
||||
'text' => sprintf(t("%s may attend %s's event"), $it['author-name'], $it['pname']),
|
||||
'when' => relative_date($it['created']),
|
||||
'when' => $default_item_when,
|
||||
'ago' => $default_item_ago,
|
||||
'seen' => $it['seen']
|
||||
);
|
||||
break;
|
||||
|
@ -312,8 +330,10 @@ class NotificationsManager {
|
|||
'label' => 'friend',
|
||||
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
|
||||
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
|
||||
'url' => $it['author-link'],
|
||||
'text' => sprintf(t("%s is now friends with %s"), $it['author-name'], $it['fname']),
|
||||
'when' => relative_date($it['created']),
|
||||
'when' => $default_item_when,
|
||||
'ago' => $default_item_ago,
|
||||
'seen' => $it['seen']
|
||||
);
|
||||
break;
|
||||
|
@ -323,8 +343,10 @@ class NotificationsManager {
|
|||
'label' => $default_item_label,
|
||||
'link' => $default_item_link,
|
||||
'image' => $default_item_image,
|
||||
'url' => $default_item_url,
|
||||
'text' => $default_item_text,
|
||||
'when' => $default_item_when,
|
||||
'ago' => $default_item_ago,
|
||||
'seen' => $it['seen']
|
||||
);
|
||||
}
|
||||
|
@ -459,7 +481,7 @@ class NotificationsManager {
|
|||
if($seen === 0)
|
||||
$sql_seen = " AND `seen` = 0 ";
|
||||
|
||||
$r = q("SELECT `id`, `photo`, `msg`, `date`, `seen` FROM `notify`
|
||||
$r = q("SELECT `id`, `url`, `photo`, `msg`, `date`, `seen` FROM `notify`
|
||||
WHERE `uid` = %d $sql_seen ORDER BY `date` DESC LIMIT %d, %d ",
|
||||
intval(local_user()),
|
||||
intval($start),
|
||||
|
@ -626,9 +648,9 @@ class NotificationsManager {
|
|||
$sql_seen = " AND `item`.`unseen` = 1 ";
|
||||
|
||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, `item`.`unseen`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
|
||||
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
|
||||
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` AS `object`,
|
||||
`pitem`.`author-name` AS `pname`, `pitem`.`author-link` AS `plink`, `pitem`.`guid` AS `pguid`
|
||||
FROM `item` INNER JOIN `item` AS `pitem` ON `pitem`.`id`=`item`.`parent`
|
||||
WHERE `item`.`visible` = 1 AND
|
||||
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1
|
||||
$sql_seen
|
||||
|
|
|
@ -285,8 +285,10 @@ function notifications_content(&$a) {
|
|||
'$item_label' => $it['label'],
|
||||
'$item_link' => $it['link'],
|
||||
'$item_image' => $it['image'],
|
||||
'$item_url' => $it['url'],
|
||||
'$item_text' => htmlentities($it['text']),
|
||||
'$item_when' => $it['when'],
|
||||
'$item_ago' => $it['ago'],
|
||||
'$item_seen' => $it['seen'],
|
||||
));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
|
||||
<a href="{{$item_link}}" target="friendica-notification"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
|
||||
<a href="{{$item_link}}" target="friendica-notification"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_ago}}</span></a>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_ago}}</span></a>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_ago}}</span></a>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_ago}}</span></a>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
|
||||
<a href="{{$item_link}}" target="friendica-notification"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
|
||||
<a href="{{$item_link}}" target="friendica-notification"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_ago}}</span></a>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_ago}}</span></a>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_ago}}</span></a>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}}">
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_when}}</span></a>
|
||||
<a href="{{$item_link}}" target="friendica-notifications"><img src="{{$item_image}}" class="notif-image">{{$item_text}} <span class="notif-when">{{$item_ago}}</span></a>
|
||||
</div>
|
|
@ -1882,6 +1882,9 @@ ul.dropdown-menu li:hover {
|
|||
-moz-box-shadow: 0 0 3px #dadada;
|
||||
}
|
||||
|
||||
.section-title-wrapper {
|
||||
overflow: hidden;
|
||||
}
|
||||
/* Profile-page */
|
||||
#profile-content-standard,
|
||||
#profile-content-advanced {
|
||||
|
@ -2208,7 +2211,7 @@ ul li:hover .contact-wrapper a.contact-action-link:hover {
|
|||
margin-left: 20px;
|
||||
}
|
||||
|
||||
/* Notifications */
|
||||
/* Intro Notifications */
|
||||
ul.notif-network-list {
|
||||
margin-left: -15px;
|
||||
margin-right: -15px;
|
||||
|
@ -2217,17 +2220,12 @@ ul.notif-network-list > li {
|
|||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
ul.notif-network-list li.unseen {
|
||||
border-left: 3px solid #f3fcfd;
|
||||
background-color: #f3fcfd;
|
||||
}
|
||||
.intro-wrapper.media {
|
||||
overflow: visible;
|
||||
word-wrap: break-word;
|
||||
margin-top: 0;
|
||||
}
|
||||
.intro-photo-wrapper img.intro-photo,
|
||||
.notif-item img.notif-image {
|
||||
.intro-photo-wrapper img.intro-photo {
|
||||
height:80px;
|
||||
width: 80px;
|
||||
border-radius: 4px;
|
||||
|
@ -2280,6 +2278,26 @@ ul.notif-network-list > li:hover .intro-action-buttons {
|
|||
margin-top: 5px
|
||||
}
|
||||
|
||||
/* Notifications Page */
|
||||
ul.notif-network-list li.unseen {
|
||||
background-color: #f3fcfd;
|
||||
}
|
||||
.notif-item img.notif-image {
|
||||
height: 48px;
|
||||
width: 48px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.notif-item .notif-desc-wrapper {
|
||||
height: 48px;
|
||||
}
|
||||
.notif-item .notif-desc-wrapper a {
|
||||
height: 100%;
|
||||
display: block;
|
||||
color: #555;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Search Page */
|
||||
|
||||
/* This is a little bit hacky. Since the search page is used for diferent
|
||||
|
|
2
view/theme/frio/templates/notifications_attend_item.tpl
Normal file
2
view/theme/frio/templates/notifications_attend_item.tpl
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
{{include file="notify.tpl"}}
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
{{include file="notify.tpl"}}
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
{{include file="notify.tpl"}}
|
2
view/theme/frio/templates/notifications_friends_item.tpl
Normal file
2
view/theme/frio/templates/notifications_friends_item.tpl
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
{{include file="notify.tpl"}}
|
2
view/theme/frio/templates/notifications_likes_item.tpl
Normal file
2
view/theme/frio/templates/notifications_likes_item.tpl
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
{{include file="notify.tpl"}}
|
2
view/theme/frio/templates/notifications_network_item.tpl
Normal file
2
view/theme/frio/templates/notifications_network_item.tpl
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
{{include file="notify.tpl"}}
|
2
view/theme/frio/templates/notifications_posts_item.tpl
Normal file
2
view/theme/frio/templates/notifications_posts_item.tpl
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
{{include file="notify.tpl"}}
|
12
view/theme/frio/templates/notify.tpl
Normal file
12
view/theme/frio/templates/notify.tpl
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
<div class="notif-item {{if !$item_seen}}unseen{{/if}} {{$item_label}} media">
|
||||
<div class="notif-photo-wrapper media-object pull-left">
|
||||
<a class="userinfo" href="{{$item_url}}"><img src="{{$item_image}}" class="notif-image"></a>
|
||||
</div>
|
||||
<div class="notif-desc-wrapper media-body">
|
||||
<a href="{{$item_link}}">
|
||||
{{$item_text}}
|
||||
<div><time class="notif-when time" data-toggle="tooltip" title="{{$item_when}}">{{$item_ago}}</time></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in a new issue