Add a popup menu in the main menu which allows to quickly jump between projects.
* refactor out the common menu code from several base*.html classes into main-menu.html and put the raw links into a unordered list (which makes it easier to create dynamic menus as we cannot insert block items into inline items in strict mode) * query the list of available projects on every request and set them for every template in Middleware.php * make the popup menu pretty
This commit is contained in:
parent
c3ff90c4f8
commit
7e10524f92
@ -112,6 +112,7 @@ function IDF_Middleware_ContextPreProcessor($request)
|
||||
$c = array_merge($c, $request->rights);
|
||||
}
|
||||
$c['usherConfigured'] = Pluf::f("mtn_usher_conf", null) !== null;
|
||||
$c['allProjects'] = IDF_Views::getProjects($request->user);
|
||||
return $c;
|
||||
}
|
||||
|
||||
|
@ -29,16 +29,13 @@
|
||||
<![endif]-->
|
||||
{block extraheader}{/block}
|
||||
<title>{block pagetitle}{$page_title|strip_tags}{/block}{if $project} - {$project.shortdesc}{/if}</title>
|
||||
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="{block docid}doc3{/block}">
|
||||
<div id="hd">
|
||||
{if $project}<h1 class="project-title">{$project}</h1>{/if}
|
||||
<p class="top"><a href="#title" accesskey="2"></a>
|
||||
{if !$user.isAnonymous()}{aurl 'url', 'idf_dashboard'}{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans} <a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a>{else}<a href="{url 'IDF_Views::login'}">{trans 'Sign in or create your account'}</a>{/if}
|
||||
{if $project} | <a href="{url 'IDF_Views::index'}">{trans 'Project List'}</a>{/if}
|
||||
| <a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a>
|
||||
</p>
|
||||
{include 'idf/main-menu.html'}
|
||||
<div id="header">
|
||||
<div id="main-tabs">
|
||||
{if $project}
|
||||
@ -69,7 +66,6 @@
|
||||
</div>
|
||||
<div id="ft">{block foot}{/block}</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
|
||||
{include 'idf/js-hotkeys.html'}
|
||||
{block javascript}{/block}
|
||||
{if $project}
|
||||
|
@ -29,15 +29,12 @@
|
||||
<![endif]-->
|
||||
{block extraheader}{/block}
|
||||
<title>{block pagetitle}{$page_title|strip_tags}{/block}</title>
|
||||
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="{block docid}doc3{/block}" class="{block docclass}yui-t3{/block}">
|
||||
<div id="hd">
|
||||
<p class="top"><a href="#title" accesskey="2"></a>
|
||||
{if !$user.isAnonymous()}{aurl 'url', 'idf_dashboard'}{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans} <a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a>{else}<a href="{url 'IDF_Views::login'}">{trans 'Sign in or create your account'}</a>{/if}
|
||||
| <a href="{url 'IDF_Views::index'}">{trans 'Project List'}</a> {if $isAdmin}| <a href="{url 'IDF_Views_Admin::projects'}">{trans 'Forge Management'}</a>{/if}
|
||||
| <a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a>
|
||||
</p>
|
||||
{include 'idf/main-menu.html'}
|
||||
<h1 id="title" class="title">{block title}{$page_title}{/block}</h1>
|
||||
</div>
|
||||
<div id="bd">
|
||||
@ -53,7 +50,6 @@
|
||||
</div>
|
||||
<div id="ft">{block foot}{/block}</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
|
||||
{include 'idf/js-hotkeys.html'}
|
||||
{block javascript}{/block}
|
||||
</body>
|
||||
|
@ -29,17 +29,13 @@
|
||||
<![endif]-->
|
||||
{block extraheader}{/block}
|
||||
<title>{block pagetitle}{$page_title|strip_tags}{/block}{if $project} - {$project.shortdesc}{/if}</title>
|
||||
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="{block docid}doc3{/block}" class="{block docclass}yui-t3{/block}">
|
||||
<div id="hd">
|
||||
{if $project}<h1 class="project-title">{$project}</h1>{/if}
|
||||
<p class="top"><a href="#title" accesskey="2"></a>
|
||||
{if !$user.isAnonymous()}{aurl 'url', 'idf_dashboard'}{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans} <a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a>{else}<a href="{url 'IDF_Views::login'}">{trans 'Sign in or create your account'}</a>{/if}
|
||||
{if $project} | <a href="{url 'IDF_Views::index'}">{trans 'Project List'}</a>{/if}
|
||||
{if $isAdmin}| <a href="{url 'IDF_Views_Admin::projects'}">{trans 'Forge Management'}</a>{/if}
|
||||
| <a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a>
|
||||
</p>
|
||||
{include 'idf/main-menu.html'}
|
||||
<div id="header">
|
||||
<div id="main-tabs">
|
||||
{if $project}
|
||||
@ -71,7 +67,6 @@
|
||||
</div>
|
||||
<div id="ft">{block foot}{/block}</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
|
||||
{include 'idf/js-hotkeys.html'}
|
||||
{block javascript}{/block}
|
||||
{if $project}
|
||||
|
@ -29,16 +29,12 @@
|
||||
<![endif]-->
|
||||
{block extraheader}{/block}
|
||||
<title>{block pagetitle}{$page_title|strip_tags}{/block}</title>
|
||||
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="{block docid}doc3{/block}" class="{block docclass}yui-t3{/block}">
|
||||
<div id="hd">
|
||||
<p class="top"><a href="#title" accesskey="2"></a>
|
||||
{aurl 'url', 'IDF_Views_User::dashboard'}{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans} <a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a>
|
||||
| <a href="{url 'IDF_Views::index'}">{trans 'Project List'}</a>
|
||||
| <a href="{url 'IDF_Views_Admin::projects'}">{trans 'Forge Management'}</a>
|
||||
| <a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a>
|
||||
</p>
|
||||
{include 'idf/main-menu.html'}
|
||||
<div id="header">
|
||||
<div id="main-tabs">
|
||||
<a href="{url 'IDF_Views_Admin::projects'}"{block tabprojects}{/block}>{trans 'Projects'}</a>
|
||||
@ -64,7 +60,6 @@
|
||||
</div>
|
||||
<div id="ft">{block foot}{/block}</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
|
||||
{include 'idf/js-hotkeys.html'}
|
||||
{block javascript}{/block}
|
||||
</body>
|
||||
|
31
src/IDF/templates/idf/main-menu.html
Normal file
31
src/IDF/templates/idf/main-menu.html
Normal file
@ -0,0 +1,31 @@
|
||||
<a href="#title" accesskey="2"></a>
|
||||
<ul id="main-menu">
|
||||
{if !$user.isAnonymous()}
|
||||
{aurl 'url', 'idf_dashboard'}
|
||||
<li>{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans}
|
||||
<a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a></li>{else}<li>
|
||||
<a href="{url 'IDF_Views::login'}">{trans 'Sign in or create your account'}</a></li>
|
||||
{/if}<li id="project-list"><a href="{url 'IDF_Views::index'}">{trans 'Project List'} ▾</a>
|
||||
{if $allProjects.count() != 0}
|
||||
<ul>{foreach $allProjects as $p}
|
||||
<li>{if $p.private}<img style="vertical-align: text-bottom;" src="{media '/idf/img/lock.png'}" alt="{trans 'Private project'}" /> {/if}
|
||||
<a href="{url 'IDF_Views_Project::home', array($p.shortname)}">{$p}</a></li>
|
||||
{/foreach}</ul>
|
||||
{/if}</li>{if $isAdmin}<li><a href="{url 'IDF_Views_Admin::projects'}">{trans 'Forge Management'}</a></li>{/if}<li>
|
||||
<a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a></li>
|
||||
</ul>
|
||||
|
||||
{if $allProjects.count() != 0}
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
{literal}
|
||||
$(document).ready(function() {
|
||||
$('#project-list').bind('mouseenter', function(ev) {
|
||||
$(this).find('ul').show();
|
||||
}).bind('mouseleave', function(ev) {
|
||||
$(this).find('ul').hide();
|
||||
});
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
{/if}
|
||||
|
@ -716,3 +716,84 @@ div.deprecated-page {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
/**
|
||||
* main menu
|
||||
*/
|
||||
#main-menu {
|
||||
padding: 0;
|
||||
margin: 5px 0 13px;
|
||||
}
|
||||
|
||||
#main-menu > li {
|
||||
list-style-type: none;
|
||||
margin-left: 5px;
|
||||
padding-left: 5px;
|
||||
border-left: 1px solid black;
|
||||
display: inline-block;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
#main-menu > li:first-child {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* project list popup
|
||||
*/
|
||||
#project-list {
|
||||
position: relative;
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
#project-list > a {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
margin-top: -3px;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
#project-list + li {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
#project-list ul {
|
||||
display: none;
|
||||
background: #A5E26A;
|
||||
border-top: 0;
|
||||
position: absolute;
|
||||
padding: 5px 5px 5px 20px;
|
||||
margin: 0;
|
||||
z-index: 1000;
|
||||
top: 1.1em;
|
||||
-moz-border-radius: 0 3px 3px 3px;
|
||||
border-radius: 0 3px 3px 3px;
|
||||
-moz-box-shadow: 0 10px 20px #333;
|
||||
-webkit-box-shadow: 0 10px 20px #333;
|
||||
box-shadow: 0 10px 20px #333;
|
||||
|
||||
}
|
||||
|
||||
#project-list ul li {
|
||||
padding: 5px;
|
||||
padding-left: 0;
|
||||
white-space: nowrap;
|
||||
font-size: 0.95em;
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
#project-list ul li a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#project-list:hover > a {
|
||||
background: #A5E26A;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#project-list:hover a {
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user