if startpage is /hq redirect all notifications links to /hq and minor notifications and hq fixes

This commit is contained in:
Mario Vavti 2018-01-27 22:23:47 +01:00
parent 7c600b0380
commit 2e4e56f7cc
6 changed files with 42 additions and 46 deletions

View File

@ -29,6 +29,8 @@ class Hq extends \Zotlabs\Web\Controller {
); );
} }
killme();
} }
function get($update = 0, $load = false) { function get($update = 0, $load = false) {

View File

@ -145,7 +145,8 @@ class Notifications {
'$module' => \App::$module, '$module' => \App::$module,
'$notifications' => $notifications, '$notifications' => $notifications,
'$no_notifications' => t('Sorry, you have got no notifications at the moment'), '$no_notifications' => t('Sorry, you have got no notifications at the moment'),
'$loading' => t('Loading') '$loading' => t('Loading'),
'$startpage' => get_pconfig(local_channel(), 'system', 'startpage')
)); ));
return $o; return $o;

View File

@ -51,7 +51,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.1.4' ); define ( 'STD_VERSION', '3.1.5' );
define ( 'ZOT_REVISION', '1.3' ); define ( 'ZOT_REVISION', '1.3' );
define ( 'DB_UPDATE_VERSION', 1198 ); define ( 'DB_UPDATE_VERSION', 1198 );

View File

@ -456,11 +456,7 @@ function handleNotificationsItems(notifyType, data) {
notify_menu.append(html); notify_menu.append(html);
}); });
$(".dropdown-menu img[data-src], .notification img[data-src]").each(function(i, el){ datasrc2src('#notifications .notification img[data-src]');
// Replace data-src attribute with src attribute for every image
$(el).attr('src', $(el).data("src"));
$(el).removeAttr("data-src");
});
if($('#tt-' + notifyType + '-only').hasClass('active')) if($('#tt-' + notifyType + '-only').hasClass('active'))
$('#nav-' + notifyType + '-menu [data-thread_top=false]').hide(); $('#nav-' + notifyType + '-menu [data-thread_top=false]').hide();
@ -834,7 +830,7 @@ function liveUpdate(notify_id) {
// else data was valid - reset the recursion counter // else data was valid - reset the recursion counter
liveRecurse = 0; liveRecurse = 0;
if(typeof notify_id !== 'undefined') { if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') {
$.post( $.post(
"hq", "hq",
{ {

View File

@ -1,13 +1,3 @@
{{if $no_messages}}
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h3>{{$no_messages_label.0}}</h3>
<br>
{{$no_messages_label.1}}
</div>
{{/if}}
<div id="jot-popup"> <div id="jot-popup">
{{$editor}} {{$editor}}
</div> </div>

View File

@ -21,7 +21,7 @@
}; };
}); });
{{if $module == 'display' || $module == 'hq'}} {{if $module == 'display' || $module == 'hq' || $startpage == 'hq'}}
$(document).on('click', '.notification', function(e) { $(document).on('click', '.notification', function(e) {
var b64mid = $(this).data('b64mid'); var b64mid = $(this).data('b64mid');
var notify_id = $(this).data('notify_id'); var notify_id = $(this).data('notify_id');
@ -31,30 +31,37 @@
if(b64mid === 'undefined' && notify_id === 'undefined') if(b64mid === 'undefined' && notify_id === 'undefined')
return; return;
{{if $module == 'display'}} {{if $module != 'hq' && $startpage == 'hq'}}
history.pushState(stateObj, '', 'display/' + b64mid);
{{/if}}
{{if $module == 'hq'}}
history.pushState(stateObj, '', 'hq/' + b64mid);
{{/if}}
{{if $module == 'hq'}}
if(b64mid !== 'undefined') {
{{else}}
if(path === 'display' && b64mid) {
{{/if}}
e.preventDefault(); e.preventDefault();
window.location.href = 'hq/' + b64mid;
return;
{{else}}
{{if $module == 'display'}}
history.pushState(stateObj, '', 'display/' + b64mid);
{{/if}}
if(! page_load) { {{if $module == 'hq'}}
if($(this).parent().attr('id') !== 'nav-pubs-menu') history.pushState(stateObj, '', 'hq/' + b64mid);
$(this).fadeOut(); {{/if}}
getData(b64mid, notify_id); {{if $module == 'hq'}}
if(b64mid !== 'undefined') {
{{else}}
if(path === 'display' && b64mid) {
{{/if}}
e.preventDefault();
if(! page_load) {
if($(this).parent().attr('id') !== 'nav-pubs-menu')
$(this).fadeOut();
getData(b64mid, notify_id);
}
if($('#notifications_wrapper').hasClass('fs'))
$('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs');
} }
{{/if}}
if($('#notifications_wrapper').hasClass('fs'))
$('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs');
}
}); });
{{/if}} {{/if}}
@ -115,14 +122,14 @@
<div id="no_notifications" class="d-xl-none"> <div id="no_notifications" class="d-xl-none">
{{$no_notifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span> {{$no_notifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div> </div>
<div id="nav-notifications-template" rel="template">
<a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}" data-b64mid="{6}" data-notify_id="{7}" data-thread_top="{8}" data-contact_name="{2}">
<img class="menu-img-3" data-src="{1}">
<span class="contactname">{2}</span>
<span class="dropdown-sub-text">{3}<br>{4}</span>
</a>
</div>
<div id="notifications" class="navbar-nav"> <div id="notifications" class="navbar-nav">
<div id="nav-notifications-template" rel="template">
<a class="list-group-item clearfix notification {5}" href="{0}" title="{2} {3}" data-b64mid="{6}" data-notify_id="{7}" data-thread_top="{8}" data-contact_name="{2}">
<img class="menu-img-3" data-src="{1}">
<span class="contactname">{2}</span>
<span class="dropdown-sub-text">{3}<br>{4}</span>
</a>
</div>
{{foreach $notifications as $notification}} {{foreach $notifications as $notification}}
<div class="collapse {{$notification.type}}-button"> <div class="collapse {{$notification.type}}-button">
<a class="list-group-item notification-link" href="#" title="{{$notification.title}}" data-target="#nav-{{$notification.type}}-sub" data-toggle="collapse" data-type="{{$notification.type}}"> <a class="list-group-item notification-link" href="#" title="{{$notification.title}}" data-target="#nav-{{$notification.type}}-sub" data-toggle="collapse" data-type="{{$notification.type}}">