change to some nav ids, notice in empty notifications popup

This commit is contained in:
Fabio Comuni 2011-07-25 17:12:42 +02:00
parent ba4ea589d0
commit 23d6339a41
4 changed files with 26 additions and 9 deletions

View file

@ -61,8 +61,9 @@
/* popup menus */ /* popup menus */
$('a[rel^=#]').click(function(e){ $('a[rel^=#]').click(function(e){
e.stopPropagation();
menu = $( $(this).attr('rel') ); menu = $( $(this).attr('rel') );
e.stopPropagation();
if (menu.attr('popup')=="false") return false;
$(this).parent().toggleClass("selected"); $(this).parent().toggleClass("selected");
menu.toggle(); menu.toggle();
return false; return false;
@ -72,6 +73,7 @@
/* notifications template */ /* notifications template */
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html()); var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
var notifications_empty = unescape($("#nav-notifications-menu").html());
/* nav update event */ /* nav update event */
$('nav').bind('nav-update', function(e,data){; $('nav').bind('nav-update', function(e,data){;
@ -88,12 +90,15 @@
if (notif>0){ if (notif>0){
nnm = $("#nav-notifications-menu"); nnm = $("#nav-notifications-menu");
nnm.html(""); nnm.html("");
nnm.attr('popup','true');
eNotif.children("note").each(function(){ eNotif.children("note").each(function(){
e = $(this); e = $(this);
text = e.text().format("<span class='contactname'>"+e.attr('name')+"</span>"); text = e.text().format("<span class='contactname'>"+e.attr('name')+"</span>");
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date')); html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'));
nnm.append(html); nnm.append(html);
}); });
} else {
$("#nav-notifications-menu").html(notifications_empty);
} }
if(notif == 0) { notif = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') } if(notif == 0) { notif = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') }
$('#notify-update').html(notif); $('#notify-update').html(notif);

View file

@ -5,7 +5,7 @@
</header> </header>
<nav> <nav>
<ul> <ul>
<li id="nav-user-link" class="nav-menu-icon"><a href="#" rel="#nav-user-menu" title="$sitelocation"><img src="http://localhost/~fabio/friendika/photo/52728a08b979618a787e43664bfbae98-6.jpg" alt="User"></a> <li id="nav-user-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-user-menu" title="$sitelocation"><img src="http://localhost/~fabio/friendika/photo/52728a08b979618a787e43664bfbae98-6.jpg" alt="User"></a>
<ul id="nav-user-menu" class="menu-popup"> <ul id="nav-user-menu" class="menu-popup">
<li><a href="profile">Profile</a></li> <li><a href="profile">Profile</a></li>
<li><a href="photos">Photos</a></li> <li><a href="photos">Photos</a></li>
@ -34,9 +34,10 @@
{{ endif }} {{ endif }}
{{ if $nav.notifications }} {{ if $nav.notifications }}
<li id="nav-notifications-link" class="nav-menu-icon"><a href="#" rel="#nav-notifications-menu" title="$nav.notifications.1"><span class="icon s22 notify">$nav.notifications.1</span></a> <li id="nav-notifications-linkmenu" class="nav-menu-icon"><a href="$nav.notifications.0" rel="#nav-notifications-menu" title="$nav.notifications.1"><span class="icon s22 notify">$nav.notifications.1</span></a>
<span id="notify-update" class="nav-notify"></span> <span id="notify-update" class="nav-notify"></span>
<ul id="nav-notifications-menu" class="menu-popup"> <ul id="nav-notifications-menu" class="menu-popup">
<li class="empty">Nothing new here</li>
</ul> </ul>
</li> </li>
{{ endif }} {{ endif }}
@ -47,7 +48,7 @@
<li id="nav-site-link" class="nav-menu-icon"><a href="#" rel="#nav-site-menu"><span class="icon s22 gear">Site</span></a> <li id="nav-site-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-site-menu"><span class="icon s22 gear">Site</span></a>
<ul id="nav-site-menu" class="menu-popup"> <ul id="nav-site-menu" class="menu-popup">
{{ if $nav.settings }}<li><a class="$nav.settings.2" href="$nav.settings.0" title="$nav.settings.3">$nav.settings.1</a></li>{{ endif }} {{ if $nav.settings }}<li><a class="$nav.settings.2" href="$nav.settings.0" title="$nav.settings.3">$nav.settings.1</a></li>{{ endif }}
{{ if $nav.admin }}<li><a class="$nav.admin.2" href="$nav.admin.0" title="$nav.admin.3" >$nav.admin.1</a></li>{{ endif }} {{ if $nav.admin }}<li><a class="$nav.admin.2" href="$nav.admin.0" title="$nav.admin.3" >$nav.admin.1</a></li>{{ endif }}

View file

@ -144,14 +144,14 @@ nav .nav-notify {
nav .nav-notify.show { nav .nav-notify.show {
display: block; display: block;
} }
nav #nav-site-link { nav #nav-site-linkmenu {
float: right; float: right;
} }
nav #nav-site-link .menu-popup { nav #nav-site-linkmenu .menu-popup {
right: 0px; right: 0px;
left: auto; left: auto;
} }
nav #nav-notifications-link.selected .icon.s22.notify { nav #nav-notifications-linkmenu.selected .icon.s22.notify {
background-image: url("../../../images/icons/notify_on_22.png"); background-image: url("../../../images/icons/notify_on_22.png");
} }
ul.menu-popup { ul.menu-popup {
@ -183,6 +183,11 @@ ul.menu-popup li {
height: auto; height: auto;
display: block; display: block;
} }
ul.menu-popup .empty {
padding: 5px;
text-align: center;
color: #9eabb0;
}
#nav-notifications-menu { #nav-notifications-menu {
width: 400px; width: 400px;
} }

View file

@ -188,12 +188,12 @@ nav {
#nav-site-link { #nav-site-linkmenu {
float: right; float: right;
.menu-popup{ right: 0px; left: auto; } .menu-popup{ right: 0px; left: auto; }
} }
#nav-notifications-link.selected .icon.s22.notify { background-image: url("../../../images/icons/notify_on_22.png") } #nav-notifications-linkmenu.selected .icon.s22.notify { background-image: url("../../../images/icons/notify_on_22.png") }
} }
@ -213,6 +213,12 @@ ul.menu-popup {
a:hover { background-color: @Metalic1; } a:hover { background-color: @Metalic1; }
.menu-sep { border-top: 1px solid @Metalic2; } .menu-sep { border-top: 1px solid @Metalic2; }
li { float: none; overflow: auto; height: auto; display: block; } li { float: none; overflow: auto; height: auto; display: block; }
.empty {
padding: 5px;
text-align: center;
color: @Metalic2;
}
} }
#nav-notifications-menu { #nav-notifications-menu {