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:
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}
|
||||
|
Reference in New Issue
Block a user