diff --git a/admin/templatetags/admin_extras.py b/admin/templatetags/admin_extras.py index 65bc8a969..4fff9c50d 100644 --- a/admin/templatetags/admin_extras.py +++ b/admin/templatetags/admin_extras.py @@ -41,7 +41,7 @@ def domain_menu(domain_id, selection, perms): ] entries += events.raiseQueryEvent("AdminMenuDisplay", target="admin_menu_bar", perms=perms, domain=domain_id) - return render_to_string('main/menu.html', + return render_to_string('common/menu.html', {"selection" : selection, "entries" : entries, "perms" : perms}) @@ -66,7 +66,7 @@ def settings_menu(selection, perms): "url" : reverse(admin.views.viewextensions), "label" : _("Extensions")}, ] - return render_to_string('main/menu.html', + return render_to_string('common/menu.html', {"selection" : selection, "entries" : entries, "perms" : perms}) @@ -86,7 +86,7 @@ def domains_menu(selection, perms): ] entries += events.raiseQueryEvent("AdminMenuDisplay", target="admin_menu_box", perms=perms) - return render_to_string('main/menu.html', + return render_to_string('common/menu.html', {"entries" : entries, "selection" : selection, "perms" : perms}) @@ -94,8 +94,8 @@ def domains_menu(selection, perms): def loadadminextmenu(perms): menu = events.raiseQueryEvent("AdminMenuDisplay", target="admin_menu_box", perms=perms) - return render_to_string('main/menulist.html', - {"menu" : menu, "perms" : perms}) + return render_to_string('common/menulist.html', + {"entries" : menu, "perms" : perms}) @register.simple_tag def param(app, definition): diff --git a/admin/views.py b/admin/views.py index e5b5e23ec..c4b93c134 100644 --- a/admin/views.py +++ b/admin/views.py @@ -11,7 +11,7 @@ from django.core.urlresolvers import reverse from django.contrib.auth.decorators \ import login_required, permission_required, user_passes_test from django.contrib.auth.models import User, Group -from mailng import admin, main +from mailng import admin, userprefs from mailng.admin.models import Domain, Mailbox, Alias, Extension from forms import MailboxForm, DomainForm, AliasForm, PermissionForm from mailng.lib.authbackends import crypt_password @@ -51,7 +51,7 @@ def domains(request): mb = Mailbox.objects.get(user=request.user.id) return mailboxes(request, dom_id=mb.domain.id) - return HttpResponseRedirect(reverse(main.views.index)) + return HttpResponseRedirect(reverse(userprefs.views.index)) domains = Domain.objects.all() counters = {} diff --git a/extensions/amavis_quarantine/templatetags/amextras.py b/extensions/amavis_quarantine/templatetags/amextras.py index 03e1d31a0..b8aaccb08 100644 --- a/extensions/amavis_quarantine/templatetags/amextras.py +++ b/extensions/amavis_quarantine/templatetags/amextras.py @@ -48,7 +48,7 @@ def viewm_menu(selection, backurl, mail_id, perms): "menu" : options_menu} ] - return render_to_string('main/menu.html', + return render_to_string('common/menu.html', {"selection" : selection, "entries" : entries, "perms" : perms}) @@ -82,7 +82,7 @@ def quar_menu(selection, perms): } ] - menu = render_to_string('main/menu.html', + menu = render_to_string('common/menu.html', {"selection" : selection, "entries" : entries, "perms" : perms}) searchbar = render_to_string('common/email_searchbar.html', {}) diff --git a/extensions/webmail/main.py b/extensions/webmail/main.py index 74d57c8ba..3cad08f5b 100644 --- a/extensions/webmail/main.py +++ b/extensions/webmail/main.py @@ -54,7 +54,8 @@ def menu(**kwargs): if kwargs["target"] != "user_menu_box": return [] return [ - {"name" : _("Webmail"), + {"name" : "webmail", + "label" : _("Webmail"), "url" : reverse(index), "img" : "/static/pics/webmail.png"} ] diff --git a/extensions/webmail/templatetags/webextras.py b/extensions/webmail/templatetags/webextras.py index da6fc0f75..cf8eb8b99 100644 --- a/extensions/webmail/templatetags/webextras.py +++ b/extensions/webmail/templatetags/webextras.py @@ -32,7 +32,7 @@ def viewm_menu(selection, backurl, folder, mail_id, perms): "label" : _("Delete")}, ] - return render_to_string('main/menu.html', + return render_to_string('common/menu.html', {"selection" : selection, "entries" : entries, "perms" : perms}) @@ -48,7 +48,7 @@ def compose_menu(selection, backurl, perms): "img" : "/static/pics/send-receive.png", "label" : _("Send")}, ] - return render_to_string('main/menu.html', + return render_to_string('common/menu.html', {"selection" : selection, "entries" : entries, "perms" : perms}) @@ -90,7 +90,7 @@ def listing_menu(selection, folder, perms): ] } ] - menu = render_to_string("main/menu.html", + menu = render_to_string("common/menu.html", {"selection" : selection, "entries" : entries, "perms" : perms}) searchbar = render_to_string("common/email_searchbar.html", {}) diff --git a/main/templatetags/main_extras.py b/main/templatetags/main_extras.py deleted file mode 100644 index 774ac99b5..000000000 --- a/main/templatetags/main_extras.py +++ /dev/null @@ -1,31 +0,0 @@ -from django import template -from django.template.loader import render_to_string -from django.utils.translation import ugettext as _ -from django.core.urlresolvers import reverse -from mailng import main -from mailng.lib import events - -register = template.Library() - -@register.simple_tag -def menu(selection, perms): - entries = [ - {"name" : "changepwd", - "url" : reverse(main.views.changepassword), - "img" : "/static/pics/edit.png", - "label" : _("Change password"), - "class" : "boxed", - "rel" : "{handler:'iframe',size:{x:350,y:220}}"} - ] - entries += events.raiseQueryEvent("UserMenuDisplay", target="user_menu_bar") - - return render_to_string('main/menu.html', - {"selection" : selection, "entries" : entries, - "perms" : perms}) - -@register.simple_tag -def loadextmenu(perms): - menu = events.raiseQueryEvent("UserMenuDisplay", target="user_menu_box", - perms=perms) - return render_to_string('main/menulist.html', - {"menu" : menu, "perms" : perms}) diff --git a/static/js/common.js b/static/js/common.js index 7164fa5da..d4969ef77 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -176,33 +176,28 @@ function HashWrapper(deflocation) { parse_menubar = function(id) { if ($(id)) { - //var first = true; - $(id).getElements('li.dropdown').each(function(elem){ var list = elem.getElement('ul.links'); var myFx = new Fx.Slide(list, { duration: 200 - }).hide(); - - myFx.addEvent("start", function() { - this.wrapper.setStyle("clear", "both"); }); + + myFx.wrapper.setStyles({ + /*"clear" : "both",*/ + "position" : "absolute" + }); + myFx.hide(); elem.addEvents({ - 'mouseenter' : function(){ + 'mouseenter' : function(evt) { myFx.cancel(); myFx.slideIn(); }, - 'mouseleave' : function(){ + 'mouseleave' : function() { myFx.cancel(); myFx.slideOut(); } }); - /*if (!first) { - elem.setStyle("margin-left", "10em"); - } else { - first = false; - }*/ }); SqueezeBox.assign($$('a.boxed'), { parse: 'rel', diff --git a/static/stylesheets/default.css b/static/stylesheets/default.css index 56a4b68f0..9bee80dfd 100644 --- a/static/stylesheets/default.css +++ b/static/stylesheets/default.css @@ -194,14 +194,12 @@ div.right { .dropdown { /*position: absolute;*/ position: relative; - /*clear: both;*/ z-index: 2; /*width: 250px;*/ } .dropdown li { padding: 5px; - width: 170px; cursor: pointer; } @@ -215,6 +213,7 @@ div.right { border-right: 5px solid #333; border-left: 5px solid #333; width: 150px; + float: left; } .dropdown ul li { diff --git a/templates/common/menu.html b/templates/common/menu.html new file mode 100644 index 000000000..b664754a9 --- /dev/null +++ b/templates/common/menu.html @@ -0,0 +1 @@ +