Skip to content

Commit

Permalink
enhance mobile UI close #366
Browse files Browse the repository at this point in the history
- take advantage of @media pointer: coarse
- Redirect home visitors to connect view
  • Loading branch information
vincent-peugnet committed Nov 14, 2023
1 parent a6596ec commit 4203057
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 170 deletions.
8 changes: 6 additions & 2 deletions app/class/Controllerhome.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ public function __construct($router)

public function desktop()
{
if ($this->user->isvisitor() && Config::homepage() === 'redirect' && !empty(Config::homeredirect())) {
$this->routedirect('pageread', ['page' => Config::homeredirect()]);
if ($this->user->isvisitor()) {
if (Config::homepage() === 'redirect' && !empty(Config::homeredirect())) {
$this->routedirect('pageread', ['page' => Config::homeredirect()]);
} else {
$this->showtemplate('connect', ['route' => 'home']);
}
} else {
$display = $_GET['display'] ?? 'list';

Expand Down
160 changes: 65 additions & 95 deletions app/view/templates/backtopbar.php
Original file line number Diff line number Diff line change
@@ -1,113 +1,83 @@
<header id="topbar">

<span id="search">
<form action="<?= $this->url('search') ?>" method="post">
<input type="text" list="searchdatalist" name="id" id="search" placeholder="page id" required <?= $tab !== 'edit' && !$user->isvisitor() ? 'autofocus' : '' ?>>
<input type="submit" name="action" value="read">
<?= $user->iseditor() ? '<input type="submit" name="action" value="edit">' : '' ?>

<?php if($user->iseditor()) { ?>
<datalist id="searchdatalist">
<?php foreach ($pagelist as $id) { ?>
<option value="<?= $id ?>"><?= $id ?></option>
<?php } ?>
</datalist>
<?php } ?>

</form>
</span>



<?php if($user->iseditor()) { ?>

<span id="menu">
<a href="<?= $this->url('home') ?>" <?= $tab == 'home' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-home"></i>
<span>home</span>
</a>
<a href="<?= $this->url('media') ?>" <?= $tab == 'media' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-link"></i>
<span>media</span>
</a>

</span>



<?php } ?>

<span id="search">
<form action="<?= $this->url('search') ?>" method="post">
<input type="text" list="searchdatalist" name="id" id="search" placeholder="page id" required <?= $tab !== 'edit' && !$user->isvisitor() ? 'autofocus' : '' ?>>
<input type="submit" name="action" value="read">
<?= $user->iseditor() ? '<input type="submit" name="action" value="edit">' : '' ?>

<?php if($user->iseditor()) { ?>
<datalist id="searchdatalist">
<?php foreach ($pagelist as $id) { ?>
<option value="<?= $id ?>"><?= $id ?></option>
<?php } ?>
</datalist>
<?php } ?>

</form>
</span>



<?php if($user->iseditor()) { ?>

<span id="menu">
<a href="<?= $this->url('home') ?>" <?= $tab == 'home' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-home"></i>
<span>home</span>
</a>
<a href="<?= $this->url('media') ?>" <?= $tab == 'media' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-link"></i>
<span>media</span>
</a>
</span>

<?php } ?>

<span id="user">

<?php if($user->isvisitor()) { ?>


<form action="<?= $this->url('log') ?>" method="post" id="connect">
<input type="text" name="user" id="loginuser" autofocus placeholder="user" required>
<input type="password" name="pass" id="loginpass" placeholder="password" required>
<input type="hidden" name="route" value="home">
<input type="hidden" name="rememberme" value="0">
<input type="checkbox" name="rememberme" id="rememberme" value="1">
<label for="rememberme">Remember me</label>
<input type="submit" name="log" value="login">
</form>


<?php } else { ?>

<span>

<?php
if($user->isadmin()) {
?>

<a href="<?= $this->url('user') ?>" <?= $tab == 'user' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-users"></i>
<span>users</span>
</a>

<a href="<?= $this->url('admin') ?>" <?= $tab == 'admin' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-cog"></i>
<span>admin</span>

</a>
<?php
}
?>
<a href="<?= $this->url('info') ?>" <?= $tab == 'info' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-book"></i>
<span>documentation</span>
</a>
<span id="user">

<a
href="<?= $this->url('profile') ?>"
title="Edit my profile"
<?= $tab == 'profile' ? 'class="currentpage"' : '' ?>
>
<i class="fa fa-user"></i>
<span><?= $user->id() ?></span>
</a>
</span>
<span>
<?php if($user->isadmin()) { ?>

<a href="<?= $this->url('user') ?>" <?= $tab == 'user' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-users"></i>
<span>users</span>
</a>

<form action="<?= $this->url('log') ?>" method="post" id="connect">
<input type="submit" name="log" value="logout" >
<?php if($tab === 'edit') { ?>
<input type="hidden" name="route" value="pageread">
<input type="hidden" name="id" value="<?= $pageid ?>">
<?php } ?>
<a href="<?= $this->url('admin') ?>" <?= $tab == 'admin' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-cog"></i>
<span>admin</span>

</form>
</a>
<?php } ?>
<a href="<?= $this->url('info') ?>" <?= $tab == 'info' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-book"></i>
<span>documentation</span>
</a>

<a
href="<?= $this->url('profile') ?>"
title="Edit my profile"
<?= $tab == 'profile' ? 'class="currentpage"' : '' ?>
>
<i class="fa fa-user"></i>
<span><?= $user->id() ?></span>
</a>
</span>


</span>
<form action="<?= $this->url('log') ?>" method="post" id="connect">
<input type="submit" name="log" value="logout" >
<?php if($tab === 'edit') { ?>
<input type="hidden" name="route" value="pageread">
<input type="hidden" name="id" value="<?= $pageid ?>">
<?php } ?>

</form>



<?php } ?>
</span>

</header>
64 changes: 32 additions & 32 deletions app/view/templates/connect.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
<?php $this->layout('layout', ['title' => 'Connect', 'description' => 'connect', 'stylesheets' => [$css . 'home.css']]) ?>


<?php $this->layout('layout', ['title' => 'Connect', 'description' => 'connect', 'stylesheets' => [$css . 'back.css', $css . 'connect.css']]) ?>


<?php $this->start('page') ?>

<span>
<?= $user->level() ?>
</span>
<div class="block connect">
<h2>Login</h2>

<?php if($user->isvisitor()) { ?>
<?php if($user->isvisitor()) { ?>

<form action="<?= $this->url('log') ?>" method="post">
<input type="hidden" name="route" value="<?= $route ?>">
<?php
if(in_array($route, ['pageedit', 'pageread', 'pageadd'])) {
echo '<input type="hidden" name="id" value="'. $id .'">';
}
?>
<form action="<?= $this->url('log') ?>" method="post" id="connect">
<input type="text" name="user" id="loginuser" autofocus placeholder="user" required>
<input type="password" name="pass" id="loginpass" placeholder="password" required>
<input type="hidden" name="rememberme" value="0">
<input type="checkbox" name="rememberme" id="rememberme" value="1">
<label for="rememberme">Remember me</label>
<input name="log" type="submit" value="login">
</form>
<form action="<?= $this->url('log') ?>" method="post">
<input type="hidden" name="route" value="<?= $route ?>">
<?php
if(in_array($route, ['pageedit', 'pageread', 'pageadd'])) {
echo '<input type="hidden" name="id" value="'. $id .'">';
}
?>
<form action="<?= $this->url('log') ?>" method="post" id="connect">
<input type="text" name="user" id="loginuser" autofocus placeholder="user" required>
<input type="password" name="pass" id="loginpass" placeholder="password" required>
<input type="hidden" name="rememberme" value="0">
<span>
<input type="checkbox" name="rememberme" id="rememberme" value="1">
<label for="rememberme">Remember me</label>
</span>
<input name="log" type="submit" value="login">
</form>


<?php } else { ?>
<?php } else { ?>

<form action="<?= $this->url('log') ?>" method="post">
<input name="log" type="submit" value="logout">
</form>
<form action="<?= $this->url('log') ?>" method="post">
<input name="log" type="submit" value="logout">
</form>



<?php } ?>
<?php } ?>

<?php
if(in_array($route, ['pageedit', 'pageread', 'pageadd'])) {
echo '<p><a href="' . $this->upage('pageread', $id) . '">back to page read view</a></p>';
}
?>
<?php
if(in_array($route, ['pageedit', 'pageread', 'pageadd'])) {
echo '<p><a href="' . $this->upage('pageread', $id) . '">back to page read view</a></p>';
}
?>
</div>

<?php $this->stop() ?>
17 changes: 9 additions & 8 deletions assets/css/back.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,10 @@ aside #save-workspace {
right: 0;
}


.submenu h2 {
font-size: medium;
}

.submenu h3 {
margin: 0;
font-size: medium;
font-size: inherit;
margin-top: 5px;
font-weight: inherit;
}


Expand Down Expand Up @@ -194,7 +188,7 @@ div.checkbox [type="checkbox"] {

div.radio input[type="radio"] {
display: inline-block;
width: auto;
width: inherit;
}

main.font input, main.font select, main.font textarea {
Expand Down Expand Up @@ -255,6 +249,13 @@ span.details {

}

@media (pointer: coarse) {
aside summary {
padding-bottom: 5px;
padding-top: 5px;
}
}


h2 .right a {
color: var(--outline-background-color);
Expand Down
Loading

0 comments on commit 4203057

Please sign in to comment.