Skip to content

Commit

Permalink
* [MOD] Layout drawer is now closed when clicking on action. Closes #483
Browse files Browse the repository at this point in the history
. Thanks to @basil-twisleton for the feedback

* [MOD] Changed layout distribution by placing session buttons on top within a menu. Related #453. Thanks to @basil-twisleton for the feedback
  • Loading branch information
nuxsmin committed Mar 13, 2017
1 parent 8c4beec commit 07e62d4
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 82 deletions.
8 changes: 0 additions & 8 deletions inc/SP/Controller/MainController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,6 @@ private function getMenu()

$this->view->append('actions', $ActionEventlog);
}

$ActionNotice = new DataGridAction();
$ActionNotice->setId(self::ACTION_NOT);
$ActionNotice->setTitle(__('Notificaciones'));
$ActionNotice->setIcon($this->icons->getIconNotices());
$ActionNotice->setData(['historyReset' => 1, 'view' => 'notices']);

$this->view->append('actions', $ActionNotice);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion inc/SP/Util/Util.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public static function getAppInfo($index = null)
*/
public static function getVersion($retBuild = false, $normalized = false)
{
$build = 17031301;
$build = 17031401;
$version = [2, 1, 2];

if ($normalized === true) {
Expand Down
10 changes: 9 additions & 1 deletion inc/themes/material-blue/js/app-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ sysPass.Theme = function (Common) {
}
}

for (;i++<=Common.passwordData.complexity.numlength;) {
for (; i++ <= Common.passwordData.complexity.numlength;) {
genPassword += getRandomChar(0, chars.length - 1);
}

Expand Down Expand Up @@ -327,6 +327,14 @@ sysPass.Theme = function (Common) {
* Triggers que se ejecutan en determinadas vistas
*/
var viewsTriggers = {
main: function () {
var layout = document.querySelector(".mdl-layout");
var $drawer = $(".mdl-layout__drawer");

$drawer.find("a").click(function () {
layout.MaterialLayout.toggleDrawer();
});
},
search: function () {
var $frmSearch = $("#frmSearch");
var $resContent = $("#res-content");
Expand Down
32 changes: 16 additions & 16 deletions inc/themes/material-blue/js/app-theme.min.js

Large diffs are not rendered by default.

42 changes: 3 additions & 39 deletions inc/themes/material-blue/views/main/body-footer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,16 @@
<div id="footer-left" class="footer-parts">
<?php if ($loadApp === true): ?>
<div id="session">
<i id="btnLogout" class="material-icons">exit_to_app</i>
<span for="btnLogout"
class="mdl-tooltip mdl-tooltip--top"><?php echo __('Salir'); ?></span>

<?php if ($showPassIcon): ?>
<i id="btnUserPass" class="btn-action material-icons"
data-onclick="appMgmt/show"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_USR_USERS_EDITPASS; ?>"
data-item-id="<?php echo $userId; ?>"
data-sk="<?php echo $sk; ?>">security</i>
<span for="btnUserPass"
class="mdl-tooltip mdl-tooltip--top"><?php echo __('Cambiar Clave de Usuario'); ?></span>
<?php endif; ?>
<i id="btnPrefs" class="material-icons"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_USR_PREFERENCES; ?>">account_circle</i>
<span for="btnPrefs"
class="mdl-tooltip mdl-tooltip--top"><?php echo __('Preferencias de usuario'); ?></span>

<?php if ($userNotices > 0): ?>
<div id="notices-user"
class="btn-menu material-icons mdl-badge mdl-badge--overlap mdl-color-text--amber-200"
data-badge="<?php echo $userNotices; ?>"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_NOT; ?>">notifications
</div>
<span for="notices-user"
class="mdl-tooltip mdl-tooltip--top"><?php printf(__('Hay %d notificaciones pendientes'), $userNotices); ?></span>
<?php else: ?>
<div id="notices-user" class="btn-menu material-icons mdl-badge mdl-badge--overlap"
data-badge="0" data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_NOT; ?>">
notifications
</div>
<span for="notices-user"
class="mdl-tooltip mdl-tooltip--top"><?php echo __('No hay no hay notificaciones pendientes'); ?></span>
<?php endif; ?>

<span id="user-info">
<span id="user-name-footer"><?php echo $userName; ?></span>
<span for="user-name-footer"
class="mdl-tooltip mdl-tooltip--top"><?php printf('%s : %s', __('Grupo'), $userGroup); ?></span>

<?php /** @var \SP\Html\Assets\IconInterface $userType */
if ($userType !== null): ?>
<i id="user-type-footer" class="material-icons"><?php echo $userType->getIcon(); ?></i>
<span for="user-type-footer"
class="mdl-tooltip mdl-tooltip--top"><?php echo $userType->getTitle(); ?></span>
<?php endif; ?>
<span id="user-name-footer"><?php echo $userName; ?></span>
<span for="user-name-footer"
class="mdl-tooltip mdl-tooltip--top"><?php printf('%s : %s', __('Grupo'), $userGroup); ?></span>
</span>
</div>
<?php endif; ?>
Expand Down
70 changes: 70 additions & 0 deletions inc/themes/material-blue/views/main/body-header-menu.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,57 @@
<span for="btn-<?php echo $action->getId(); ?>"
class="mdl-tooltip mdl-tooltip--bottom"><?php echo $action->getTitle(); ?></span>
<?php endforeach; ?>

<?php if ($userNotices > 0): ?>
<a id="notices-user" class="btn-menu mdl-navigation__link"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_NOT; ?>"
data-historyreset="1"
data-view="notices">
<i class="material-icons mdl-badge mdl-badge--overlap" data-badge="<?php echo $userNotices; ?>">notifications</i>
</a>

<span for="notices-user"
class="mdl-tooltip mdl-tooltip--bottom"><?php printf(__('Hay %d notificaciones pendientes'), $userNotices); ?></span>
<?php else: ?>
<a id="notices-user" class="btn-menu mdl-navigation__link"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_NOT; ?>"
data-historyreset="1"
data-view="notices">
<i class="material-icons mdl-badge mdl-badge--overlap" data-badge="0">notifications</i>
</a>
<span for="notices-user"
class="mdl-tooltip mdl-tooltip--bottom"><?php echo __('No hay no hay notificaciones pendientes'); ?></span>
<?php endif; ?>

<!-- User's menu -->
<!-- Right aligned menu below button -->
<button id="users-menu-lower-right"
class="mdl-button mdl-js-button mdl-button--icon">
<i class="material-icons">more_vert</i>
</button>

<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect"
for="users-menu-lower-right">
<?php if ($showPassIcon): ?>
<li id="btnUserPass" class="btn-action mdl-menu__item"
data-onclick="appMgmt/show"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_USR_USERS_EDITPASS; ?>"
data-item-id="<?php echo $userId; ?>"
data-sk="<?php echo $sk; ?>">
<i class="material-icons">security</i>
<?php echo __('Cambiar Clave de Usuario'); ?>
</li>
<?php endif; ?>
<li id="btnPrefs" class="mdl-menu__item"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_USR_PREFERENCES; ?>">
<i class="material-icons">account_circle</i>
<?php echo __('Preferencias de usuario'); ?>
</li>
<li id="btnLogout" class="mdl-menu__item">
<i class="material-icons">exit_to_app</i>
<?php echo __('Salir'); ?>
</li>
</ul>
</nav>
<?php endif; ?>
</div>
Expand All @@ -47,6 +98,25 @@
<?php echo $action->getTitle(); ?>
</a>
<?php endforeach; ?>

<?php if ($userNotices > 0): ?>
<a id="notices-user" class="btn-menu mdl-navigation__link"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_NOT; ?>"
data-historyreset="1"
data-view="notices">
<i class="material-icons mdl-badge mdl-badge--overlap" data-badge="<?php echo $userNotices; ?>">notifications</i>
<?php echo __('Notificaciones'); ?>
</a>
<?php else: ?>
<a id="notices-user" class="btn-menu mdl-navigation__link"
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_NOT; ?>"
data-historyreset="1"
data-view="notices">
<i class="material-icons mdl-badge mdl-badge--overlap" data-badge="0">notifications</i>
<?php echo __('Notificaciones'); ?>
</a>
<?php endif; ?>

<?php if ($showPassIcon): ?>
<a class="btn-action mdl-navigation__link"
title="<?php echo __('Cambiar Clave de Usuario'); ?>"
Expand Down
19 changes: 12 additions & 7 deletions js/app-triggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,19 @@ sysPass.Triggers = function (Common) {
Common.appActions().doAction({actionId: $this.data("action-id")}, $this.data("view"));
});

$("#btnLogout").click(function (e) {
Common.appActions().main.logout();
});

$("#btnPrefs").click(function (e) {
Common.appActions().doAction({actionId: $(this).data("action-id")});
});

Common.appActions().doAction({actionId: 1}, "search");

if (typeof Common.appTheme().viewsTriggers.main === "function") {
Common.appTheme().viewsTriggers.main();
}
},
search: function () {
log.info("views:search");
Expand Down Expand Up @@ -243,13 +255,6 @@ sysPass.Triggers = function (Common) {
footer: function () {
log.info("views:footer");

$("#btnLogout").click(function (e) {
Common.appActions().main.logout();
});

$("#btnPrefs").click(function (e) {
Common.appActions().doAction({actionId: $(this).data("action-id")});
});
},
common: function ($container) {
log.info("views:common");
Expand Down
Loading

0 comments on commit 07e62d4

Please sign in to comment.