Added user profile button on nav

* Add default_profile.png file on assets
* Create navmenu.js module
* Load "app" on regular javascript inside template
This commit is contained in:
Niko 2022-02-11 15:48:39 +01:00
parent 4139c9ef74
commit f40c9c7437
5 changed files with 29 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -8,10 +8,14 @@
<script type="application/javascript" src="/js/relativeTime.js"></script>
<script type="application/javascript" src="/js/updateLocale.js"></script>
-->
<link rel="stylesheet" href="/assets/fonts/fork-awesome.min.css">
<?php tpl_styles(['normalize', 'base', 'app']) ?>
<?php tpl_styles(['themes.'.($theme ?? DEFAULT_THEME)]) ?>
<?php tpl_styles($styles ?? null) ?>
<script>var app = {};</script>
<?php tpl_scripts(['http', 'navmenu']) ?>
<?php tpl_scripts($scripts ?? null) ?>
</head>
<body class="app">
@ -37,5 +41,13 @@
"icon: search") ?>
</div>
</div>
<?php if ($actor !== null): ?>
<div class="flex icon button round">
<a class="center" href="javascript:app.navmenu.show()">
<img class="avatar round"
src="<?php echo htmlspecialchars($actor->icon) ?>"/>
</a>
</div>
<?php endif ?>
</div>
</header>

View File

@ -6,8 +6,15 @@ module('config.app');
$args = urlargs(1);
$uri = '/'.implode('/', $args);
$database = new DB();
$session = session();
$user = $database->findOne('u__users', ['_id' => $session->id_user]);
$actor = $database->getActorByUsername($user->username);
?>
<?php tpl('app.header') ?>
<?php tpl('app.header', [
'actor' => $actor,
]) ?>
<main class="flex">
<div id="app-container" class="flex center width-max">
<div class="panel center">APP HERE</div>

View File

@ -13,6 +13,10 @@ body.app {
top: 2px;
}
img.avatar {
width: 2.6em;
}
header .component.button .fa {
font-size: 1.3em;
}

View File

@ -0,0 +1,5 @@
app.navmenu = {
show: function() {
console.log('TODO: show menu for profile');
},
};