Skip to content
Snippets Groups Projects
Commit b85a7f3b authored by Andreas Gohr's avatar Andreas Gohr
Browse files

use menu system for user tools

also adjusts styles and adds images
parent 7c844e0e
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,8 @@ namespace dokuwiki\Menu\Item;
class Admin extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/settings.svg';
/** @inheritdoc */
public function __construct() {
global $INFO;
......
......@@ -4,6 +4,8 @@ namespace dokuwiki\Menu\Item;
class Login extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/login.svg';
/** @inheritdoc */
public function __construct() {
global $INPUT;
......@@ -17,6 +19,7 @@ class Login extends AbstractItem {
}
$this->params['do'] = 'logout';
$this->type = 'logout';
$this->svg = DOKU_INC . 'lib/images/menu/logout.svg';
}
}
......
......@@ -4,6 +4,8 @@ namespace dokuwiki\Menu\Item;
class Profile extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/account-card-details.svg';
/** @inheritdoc */
public function __construct() {
global $INPUT;
......
......@@ -7,10 +7,10 @@ class UserMenu extends AbstractMenu {
protected $view = 'user';
protected $types = array(
'Login',
'Register',
'Profile',
'Admin'
'Admin',
'Register',
'Login',
);
}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M2 3h20c1.05 0 2 .95 2 2v14c0 1.05-.95 2-2 2H2c-1.05 0-2-.95-2-2V5c0-1.05.95-2 2-2m12 3v1h8V6h-8m0 2v1h8V8h-8m0 2v1h7v-1h-7m-6 3.91C6 13.91 2 15 2 17v1h12v-1c0-2-4-3.09-6-3.09M8 6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 17.25V14H3v-4h7V6.75L15.25 12 10 17.25M8 2h9a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-4h2v4h9V4H8v4H6V4a2 2 0 0 1 2-2z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M17 17.25V14h-7v-4h7V6.75L22.25 12 17 17.25M13 2a2 2 0 0 1 2 2v4h-2V4H4v16h9v-4h2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 15.5A3.5 3.5 0 0 1 8.5 12 3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5 3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97 0-.33-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1 0 .33.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.66z"/></svg>
\ No newline at end of file
......@@ -106,84 +106,10 @@
margin-left: 0;
}
#dokuwiki__usertools a.action,
#dokuwiki__usertools a.iw_user {
padding-left: 20px;
background: transparent url(images/usertools.png) no-repeat 0 0;
}
[dir=rtl] #dokuwiki__usertools a.action {
padding-left: 0;
padding-right: 20px;
}
#dokuwiki__header .mobileTools {
display: none; /* hide mobile tools dropdown to only show in mobile view */
}
/*____________ user tools ____________*/
#dokuwiki__usertools {
position: absolute;
top: .5em;
right: .5em;
text-align: right;
width: 100%;
ul {
margin: 0 auto;
padding: 0;
max-width: @ini_site_width;
}
a.action.admin {
background-position: left 0;
}
a.iw_user,
a.action.profile {
background-position: left -32px;
}
a.action.register {
background-position: left -64px;
}
a.action.login {
background-position: left -96px;
}
a.action.logout {
background-position: left -128px;
}
}
[dir=rtl] #dokuwiki__usertools {
text-align: left;
left: 40px;
right: auto;
a.action.admin {
background-position: right 0;
}
a.action.profile {
background-position: right -32px;
}
a.action.register {
background-position: right -64px;
}
a.action.login {
background-position: right -96px;
}
a.action.logout {
background-position: right -128px;
}
}
/*____________ site tools ____________*/
#dokuwiki__sitetools {
......
......@@ -20,16 +20,6 @@
height: auto;
}
#dokuwiki__usertools {
/* move the tools just outside of the site */
right: 40px;
}
[dir=rtl] #dokuwiki__usertools {
right: auto;
left: 40px;
}
#dokuwiki__pagetools {
@ico-width: 25px;
@ico-margin: 5px;
......
#dokuwiki__usertools {
position: absolute;
top: .5em;
right: 40px; // pagetool width
text-align: right;
width: 100%;
ul {
margin: 0 auto;
padding: 0;
max-width: @ini_site_width;
}
li.action a {
display: inline-flex;
flex-direction: row-reverse;
flex-wrap: nowrap;
svg {
height: 1.4em;
width: 1.4em;
vertical-align: middle;
fill: @ini_border;
margin-right: 0.2em;
}
}
li.action a:hover,
li.action a:active {
svg {
fill: @ini_link;
}
}
}
[dir=rtl] #dokuwiki__usertools {
text-align: left;
left: 40px; // pagetool width
right: auto;
li.action a {
svg {
margin-right: 0;
margin-left: 0.2em;
}
}
}
......@@ -34,6 +34,7 @@ css/_forms.css = screen
css/_admin.less = screen
css/structure.less = screen
css/design.less = screen
css/usertools.less = screen
css/pagetools.less = screen
css/content.less = screen
......
......@@ -46,12 +46,9 @@ if (!defined('DOKU_INC')) die();
tpl_userinfo(); /* 'Logged in as ...' */
echo '</li>';
}
tpl_toolsevent('usertools', array(
tpl_action('admin', true, 'li', true),
tpl_action('profile', true, 'li', true),
tpl_action('register', true, 'li', true),
tpl_action('login', true, 'li', true)
));
$menu = new \dokuwiki\Menu\UserMenu();
echo $menu->getListItems('action ');
unset($menu);
?>
</ul>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment