Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparing new HTML structure #461

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
eb70b12
CSS rebuild: main variables, common elements & helpers, bases for inp…
jbidoret Oct 22, 2024
3cf3a16
Preparing new HTML structure: top bar
jbidoret Oct 22, 2024
5db7423
Preparing new HTML structure: home nav bar (dropdowns)
jbidoret Oct 22, 2024
563efb9
Preparing new HTML structure: media nav bar (dropdowns)
jbidoret Oct 22, 2024
be031c4
Preparing new HTML structure: layout cleanup
jbidoret Oct 22, 2024
92dd1f6
Backtopbar: restructuring HTML (removing spans)
jbidoret Oct 22, 2024
ed08157
Backtopbar: restructuring HTML (reindent)
jbidoret Oct 22, 2024
4265c1e
CSS: Horizontal bars (common) + #topbar (specific)
jbidoret Oct 22, 2024
36e949c
Navbars (dropdown menus): added class dropdown
jbidoret Oct 22, 2024
6772f4d
Navbars (dropdown menus): added wrapper around dropdown-content
jbidoret Oct 22, 2024
1c57e37
Navbars (dropdown menus): removed .submenu wrapper(replacede by .drop…
jbidoret Oct 22, 2024
0e34d9c
CSS: add dropdowns
jbidoret Oct 22, 2024
8c64abd
Navbars (dropdown menus): wrap each dropdown section in a .dropdown-s…
jbidoret Oct 22, 2024
19cb3be
Navbars (dropdown menus): removed br
jbidoret Oct 22, 2024
91c4b34
CSS: add .button styles within .submit-field
jbidoret Oct 22, 2024
04e7859
Navbars (dropdown menus): replace strong by h3
jbidoret Oct 22, 2024
7931cf7
Navbars (dropdown menus): wrapping of each input in a p.field, labels…
jbidoret Oct 22, 2024
4bc81fe
JS: closeSubmenus function updated to accommodate change in dropdowns…
jbidoret Oct 22, 2024
8e3a65d
CSS: removed percentage padding from p
jbidoret Oct 22, 2024
5289e4a
CSS: navbar background-color
jbidoret Oct 22, 2024
04dda98
CSS: help buttons in dropdowns
jbidoret Oct 22, 2024
7acf421
CSS: help buttons style
jbidoret Oct 22, 2024
781d569
UI guidelines added (wip)
jbidoret Oct 22, 2024
127c560
Default theme that almost match current state of UI design
jbidoret Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 additions & 0 deletions UI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# UI Guidelines

A (work-in-progress) guide to help in building bars, dropdowns, panels, fields and other UI elements within W admin interface.

## Main principles

Never rely on a first level tag name to style elements but prefer classnames. Tag names might be used within a child selector (so they can benefit from the cascade) :
```css
/* instead of */
details { }
/* prefer */
.dropdown { }
.dropdown h2 { }
```

## Elements

### Layout helpers

`.flexrow` helps to layout horizontal items, whichever is their inline/block natural behavior.

`.flexcol` is the same for vertical layouts.

### Fields

Each field (input, submit, checkbox or radio) is wrapped widthin a `<p class="field"></p>`.
```html
<p class="field">
<label for="myinput">label</label>
<input type="text" name="myinput" id="myinput" value="">
</p>
```

Label comes first, then comes the input. CSS manages the order in case of checkboxes or radios.

When two fields whould be in a row, wrap them in a `.flexrow`:
```html
<div class="flexrow">
<p class="field">
<label for="myinput">label</label>
<input type="text" name="myinput" id="myinput" value="">
</p>
<p class="field">
<label for="myinput2">label</label>
<input type="text" name="myinput2" id="myinput2" value="">
</p>
</div>
```
Submit inputs or buttons are wrapped in a `<p class="field submit-field"></p>`.
```html
<p class="field submit-field">
<input type="submit" value="submit">
</p>
```
### Horizontal bar

Used for main top-bar and dropwdowns menu-bar.

Should have the class `.hbar`, and contain one or many `.hbar-section`.

Each section should contain one or many `.flexrow` to properly layout any kind of children :
- `div`: for grouping elements – which might not be useful
- `form > input(s)`: for update/post actions
- `a`: for links actions
- `span`: for help info

### Dropdown menus

Like stated above, these menus should be put in a `.hbar-section` within a `.hbar`.

They are based on `<details>` element – so that they can be closed and opened without js – that receive à `.dropdown` class.

The inner content is wrapped within a `.dropdown-content`.
```html
<details class="dropdown">
<summary>Menu name</summary>
<div class="dropdown-content">
(dropdown sections)
</div>
</details>
```

The content itself is wrapped within one or multiple `.dropdown-section` that can be a `div` or a `form`.
```html
<form class="dropdown-section" method="">
<h2>Section title</h2>
<div class="dropdown-section-content">
(fields)
</div>
</form>
```



## Main structure

```
HEADER.hbar#topbar

div.hbar-section
div.flexrow
div | form | input | button | a | span

NAV.hbar#navbar

div.hbar-section
details.dropdown
summary
{div|form}.dropdown-content
{div|form}.dropdown-section
h2.dropdown-section-title
div.dropdown-section-content
(p.help)
p.field
label
input | button | a | span

MAIN

? aside.panel
(h1.panel-title)
div.scrollable
? {div|form}.panel-section
h2.panel-section-title
{div|form}.panel-section-content
(.list | .tree | fieldset)
? details

? aside.collapsible
label + input[type=checkbox]
.collapsible-content
(h1.panel-title)
div.scrollable
{div|form}.panel-section
h2.panel-section-title
{div|form}.panel-section-content
(.list | .tree | fieldset)
(h3 | legend)
(p.help)
p.field
label
input | button | a

? section.main#pages
h1
text
div.flexrow
input | button | a
div#searchbar
div.scrollable
table

? section.main#page
div.tabs
div.tab
label + input[type=checkbox]
div.tab-content
textarea

? section.main#medias
h1
div.scrollable
table

? section.main#admin
div.scrollable
div.admin-section
h2.admin-section-title
div.admin-section-content

? section.main#users
h1
div.scrollable
table

? section.main#account
div.scrollable
div.admin-section
h2.admin-section-title
div.admin-section-content

? section.main#info
div.scrollable
```
121 changes: 50 additions & 71 deletions app/view/templates/backtopbar.php
Original file line number Diff line number Diff line change
@@ -1,83 +1,62 @@
<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 endforeach ?>
</datalist>
<header class="hbar" id="topbar">

<div class="hbar-section">
<div class="flexrow">

<form action="<?= $this->url('search') ?>" method="post" id="search">
<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 endforeach ?>
</datalist>
<?php endif ?>
</form>

<?php if($user->iseditor()) : ?>
<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>
<?php endif ?>
</div>
</div>

</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>
<div id="user" class="hbar-section">
<div class="flexrow">

<?php endif ?>


<span id="user">

<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>
<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 endif ?>

<a href="<?= $this->url('info') ?>" <?= $tab == 'info' ? 'class="currentpage"' : '' ?>>
<i class="fa fa-book"></i>
<span>documentation</span>
<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 href="<?= $this->url('profile') ?>" title="Edit my profile" <?= $tab == 'profile' ? 'class="currentpage"' : '' ?> >
<i class="fa fa-user"></i> <span><?= $user->id() ?></span>
</a>
</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 endif ?>

</form>



</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 endif ?>
</form>

</div>

</div>

</header>
Loading