2014-09-02 09:36:42 +02:00
|
|
|
<ul>
|
2014-09-14 17:00:31 +02:00
|
|
|
<%
|
2014-09-29 22:17:32 +02:00
|
|
|
var links = [];
|
|
|
|
links.push({
|
|
|
|
target: '#/home',
|
|
|
|
title: 'Home',
|
|
|
|
icon: 'fa-home'});
|
|
|
|
|
2014-09-14 17:00:31 +02:00
|
|
|
if (canListPosts) {
|
2014-09-29 22:17:32 +02:00
|
|
|
links.push({
|
|
|
|
target: '#/posts',
|
|
|
|
title: 'Posts',
|
|
|
|
icon: 'fa-th'});
|
|
|
|
|
2014-09-14 17:00:31 +02:00
|
|
|
if (canUploadPosts) {
|
2014-09-29 22:17:32 +02:00
|
|
|
links.push({
|
|
|
|
target: '#/upload',
|
|
|
|
title: 'Upload',
|
|
|
|
icon: 'fa-upload'});
|
2014-09-14 17:00:31 +02:00
|
|
|
}
|
2014-10-22 18:44:57 +02:00
|
|
|
}
|
2014-09-29 22:17:32 +02:00
|
|
|
|
2014-10-22 18:44:57 +02:00
|
|
|
if (canListComments) {
|
2014-09-29 22:17:32 +02:00
|
|
|
links.push({
|
|
|
|
target: '#/comments',
|
|
|
|
title: 'Comments',
|
|
|
|
icon: 'fa-comments'});
|
2014-09-14 17:00:31 +02:00
|
|
|
}
|
2014-09-29 22:17:32 +02:00
|
|
|
|
2014-09-14 17:00:31 +02:00
|
|
|
if (canListTags) {
|
2014-09-29 22:17:32 +02:00
|
|
|
links.push({
|
|
|
|
target: '#/tags',
|
|
|
|
title: 'Tags',
|
|
|
|
icon: 'fa-tags'});
|
2014-09-14 17:00:31 +02:00
|
|
|
}
|
2014-09-29 22:17:32 +02:00
|
|
|
|
2014-09-14 17:00:31 +02:00
|
|
|
if (canListUsers) {
|
2014-09-29 22:17:32 +02:00
|
|
|
links.push({
|
|
|
|
target: '#/users',
|
|
|
|
title: 'Users',
|
|
|
|
icon: 'fa-users'});
|
2014-09-14 17:00:31 +02:00
|
|
|
}
|
2014-09-29 22:17:32 +02:00
|
|
|
|
2014-09-14 17:00:31 +02:00
|
|
|
if (!loggedIn) {
|
2014-09-29 22:17:32 +02:00
|
|
|
links.push({
|
|
|
|
target: '#/login',
|
|
|
|
title: 'Login',
|
|
|
|
icon: 'fa-sign-in'});
|
|
|
|
|
|
|
|
links.push({
|
|
|
|
target: '#/register',
|
|
|
|
title: 'Register',
|
|
|
|
icon: 'fa-file-text-o'});
|
|
|
|
|
2014-09-14 17:00:31 +02:00
|
|
|
} else {
|
2014-09-29 22:17:32 +02:00
|
|
|
links.push({
|
|
|
|
className: 'my-account',
|
|
|
|
target: '#/user/' + user.name,
|
|
|
|
title: 'Account',
|
|
|
|
icon: 'fa-user'});
|
|
|
|
|
|
|
|
links.push({
|
|
|
|
target: '#/logout',
|
|
|
|
title: 'Logout',
|
|
|
|
icon: 'fa-sign-out'});
|
2014-09-14 17:00:31 +02:00
|
|
|
}
|
2014-09-29 22:17:32 +02:00
|
|
|
|
|
|
|
links.push({
|
|
|
|
target: '#/help',
|
|
|
|
title: 'Help',
|
|
|
|
icon: 'fa-question-circle'});
|
|
|
|
|
|
|
|
var takenAccessKeys = [];
|
|
|
|
links = _.map(links, function(link) {
|
|
|
|
if (typeof(link.className) === 'undefined') {
|
|
|
|
link.className = link.title.toLowerCase();
|
|
|
|
}
|
|
|
|
if (typeof(link.accessKey) === 'undefined') {
|
2014-10-10 23:39:10 +02:00
|
|
|
for (var i = 0; i < link.title.length; i ++) {
|
|
|
|
var accessKey = link.title.charAt(i);
|
|
|
|
if (!_.contains(takenAccessKeys, accessKey)) {
|
|
|
|
link.accessKey = accessKey;
|
|
|
|
takenAccessKeys.push(accessKey);
|
|
|
|
break;
|
|
|
|
}
|
2014-09-29 22:17:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return link;
|
|
|
|
});
|
2014-09-14 17:00:31 +02:00
|
|
|
%>
|
2014-09-07 19:49:11 +02:00
|
|
|
|
2014-09-14 17:00:31 +02:00
|
|
|
<% _.each(links, function(link) { %><!--
|
2014-09-29 22:17:32 +02:00
|
|
|
--><li class="<%= link.className %>">
|
|
|
|
<a class="big-button" href="<%= link.target %>" <%= link.accessKey ? 'accessKey="' + link.accessKey + '"' : '' %>>
|
|
|
|
<i class="fa <%= link.icon %>"></i><br/>
|
2014-10-10 23:39:10 +02:00
|
|
|
<% var pos = link.title.indexOf(link.accessKey) %>
|
|
|
|
<%= pos === -1 ? link.title : link.title.substring(0, pos) + '<span class="accesskey">' + link.accessKey + '</span>' + link.title.substring(pos + 1) %>
|
2014-09-16 18:51:36 +02:00
|
|
|
</a>
|
2014-09-14 17:00:31 +02:00
|
|
|
</li><!--
|
|
|
|
--><% }) %>
|
2014-09-02 09:36:42 +02:00
|
|
|
</ul>
|