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:
Michael Vogel 2016-12-22 07:31:07 +01:00 committed by GitHub
commit 584cf75af3
19 changed files with 97 additions and 29 deletions

View File

@ -198,8 +198,10 @@ class NotificationsManager {
* string 'label' => The type of the notification * string 'label' => The type of the notification
* string 'link' => URL to the source * string 'link' => URL to the source
* string 'image' => The avatar image * string 'image' => The avatar image
* string 'url' => The profile url of the contact
* string 'text' => The notification text * 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" * bool 'seen' => Is the notification marked as "seen"
*/ */
private function formatNotifs($notifs, $ident = "") { private function formatNotifs($notifs, $ident = "") {
@ -223,26 +225,32 @@ class NotificationsManager {
$default_item_label = 'notify'; $default_item_label = 'notify';
$default_item_link = $this->a->get_baseurl(true).'/notify/view/'. $it['id']; $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_image = proxy_url($it['photo'], false, PROXY_SIZE_MICRO);
$default_item_url = $it['url'];
$default_item_text = strip_tags(bbcode($it['msg'])); $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; break;
case 'home': case 'home':
$default_item_label = 'comment'; $default_item_label = 'comment';
$default_item_link = $this->a->get_baseurl(true).'/display/'.$it['pguid']; $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_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_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; break;
default: default:
$default_item_label = (($it['id'] == $it['parent']) ? 'post' : 'comment'); $default_item_label = (($it['id'] == $it['parent']) ? 'post' : 'comment');
$default_item_link = $this->a->get_baseurl(true).'/display/'.$it['pguid']; $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_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO);
$default_item_url = $it['author-link'];
$default_item_text = (($it['id'] == $it['parent']) $default_item_text = (($it['id'] == $it['parent'])
? sprintf(t("%s created a new post"), $it['author-name']) ? sprintf(t("%s created a new post"), $it['author-name'])
: sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname'])); : 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', 'label' => 'like',
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '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']), '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'] 'seen' => $it['seen']
); );
break; break;
@ -264,8 +274,10 @@ class NotificationsManager {
'label' => 'dislike', 'label' => 'dislike',
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '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']), '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'] 'seen' => $it['seen']
); );
break; break;
@ -275,8 +287,10 @@ class NotificationsManager {
'label' => 'attend', 'label' => 'attend',
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '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']), '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'] 'seen' => $it['seen']
); );
break; break;
@ -286,8 +300,10 @@ class NotificationsManager {
'label' => 'attendno', 'label' => 'attendno',
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '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']), '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'] 'seen' => $it['seen']
); );
break; break;
@ -297,8 +313,10 @@ class NotificationsManager {
'label' => 'attendmaybe', 'label' => 'attendmaybe',
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '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']), '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'] 'seen' => $it['seen']
); );
break; break;
@ -312,8 +330,10 @@ class NotificationsManager {
'label' => 'friend', 'label' => 'friend',
'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'],
'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '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']), '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'] 'seen' => $it['seen']
); );
break; break;
@ -323,8 +343,10 @@ class NotificationsManager {
'label' => $default_item_label, 'label' => $default_item_label,
'link' => $default_item_link, 'link' => $default_item_link,
'image' => $default_item_image, 'image' => $default_item_image,
'url' => $default_item_url,
'text' => $default_item_text, 'text' => $default_item_text,
'when' => $default_item_when, 'when' => $default_item_when,
'ago' => $default_item_ago,
'seen' => $it['seen'] 'seen' => $it['seen']
); );
} }
@ -459,7 +481,7 @@ class NotificationsManager {
if($seen === 0) if($seen === 0)
$sql_seen = " AND `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 ", WHERE `uid` = %d $sql_seen ORDER BY `date` DESC LIMIT %d, %d ",
intval(local_user()), intval(local_user()),
intval($start), intval($start),
@ -626,9 +648,9 @@ class NotificationsManager {
$sql_seen = " AND `item`.`unseen` = 1 "; $sql_seen = " AND `item`.`unseen` = 1 ";
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, `item`.`unseen`, $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`, `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` `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` FROM `item` INNER JOIN `item` AS `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`visible` = 1 AND WHERE `item`.`visible` = 1 AND
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1 `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1
$sql_seen $sql_seen

View File

@ -285,8 +285,10 @@ function notifications_content(&$a) {
'$item_label' => $it['label'], '$item_label' => $it['label'],
'$item_link' => $it['link'], '$item_link' => $it['link'],
'$item_image' => $it['image'], '$item_image' => $it['image'],
'$item_url' => $it['url'],
'$item_text' => htmlentities($it['text']), '$item_text' => htmlentities($it['text']),
'$item_when' => $it['when'], '$item_when' => $it['when'],
'$item_ago' => $it['ago'],
'$item_seen' => $it['seen'], '$item_seen' => $it['seen'],
)); ));
} }

View File

@ -1,4 +1,4 @@
<div class="notif-item {{if !$item_seen}}unseen{{/if}}"> <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> </div>

View File

@ -1,4 +1,4 @@
<div class="notif-item {{if !$item_seen}}unseen{{/if}}"> <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> </div>

View File

@ -1,4 +1,4 @@
<div class="notif-item {{if !$item_seen}}unseen{{/if}}"> <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> </div>

View File

@ -1,4 +1,4 @@
<div class="notif-item {{if !$item_seen}}unseen{{/if}}"> <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> </div>

View File

@ -1,4 +1,4 @@
<div class="notif-item {{if !$item_seen}}unseen{{/if}}"> <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> </div>

View File

@ -1,4 +1,4 @@
<div class="notif-item {{if !$item_seen}}unseen{{/if}}"> <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> </div>

View File

@ -1,4 +1,4 @@
<div class="notif-item {{if !$item_seen}}unseen{{/if}}"> <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> </div>

View File

@ -1,4 +1,4 @@
<div class="notif-item {{if !$item_seen}}unseen{{/if}}"> <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> </div>

View File

@ -1882,6 +1882,9 @@ ul.dropdown-menu li:hover {
-moz-box-shadow: 0 0 3px #dadada; -moz-box-shadow: 0 0 3px #dadada;
} }
.section-title-wrapper {
overflow: hidden;
}
/* Profile-page */ /* Profile-page */
#profile-content-standard, #profile-content-standard,
#profile-content-advanced { #profile-content-advanced {
@ -2208,7 +2211,7 @@ ul li:hover .contact-wrapper a.contact-action-link:hover {
margin-left: 20px; margin-left: 20px;
} }
/* Notifications */ /* Intro Notifications */
ul.notif-network-list { ul.notif-network-list {
margin-left: -15px; margin-left: -15px;
margin-right: -15px; margin-right: -15px;
@ -2217,17 +2220,12 @@ ul.notif-network-list > li {
padding-left: 15px; padding-left: 15px;
padding-right: 15px; padding-right: 15px;
} }
ul.notif-network-list li.unseen {
border-left: 3px solid #f3fcfd;
background-color: #f3fcfd;
}
.intro-wrapper.media { .intro-wrapper.media {
overflow: visible; overflow: visible;
word-wrap: break-word; word-wrap: break-word;
margin-top: 0; margin-top: 0;
} }
.intro-photo-wrapper img.intro-photo, .intro-photo-wrapper img.intro-photo {
.notif-item img.notif-image {
height:80px; height:80px;
width: 80px; width: 80px;
border-radius: 4px; border-radius: 4px;
@ -2280,6 +2278,26 @@ ul.notif-network-list > li:hover .intro-action-buttons {
margin-top: 5px 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 */ /* Search Page */
/* This is a little bit hacky. Since the search page is used for diferent /* This is a little bit hacky. Since the search page is used for diferent

View File

@ -0,0 +1,2 @@
{{include file="notify.tpl"}}

View File

@ -0,0 +1,2 @@
{{include file="notify.tpl"}}

View File

@ -0,0 +1,2 @@
{{include file="notify.tpl"}}

View File

@ -0,0 +1,2 @@
{{include file="notify.tpl"}}

View File

@ -0,0 +1,2 @@
{{include file="notify.tpl"}}

View File

@ -0,0 +1,2 @@
{{include file="notify.tpl"}}

View File

@ -0,0 +1,2 @@
{{include file="notify.tpl"}}

View 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>