Skip to content

Commit

Permalink
Fixed default contextual behavior and content in MyApp
Browse files Browse the repository at this point in the history
  • Loading branch information
EGreg committed Nov 8, 2020
1 parent d9b8a02 commit 4cc58e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
7 changes: 7 additions & 0 deletions MyApp/views/MyApp/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
<div id="dashboard_user">
<?php echo Q::tool('Users/status') ?>
</div>

<div id="dashboard_user_contextual">
<ul class="Q_listing">
<li data-action="setIdentifier"><?php echo $dashboard['SetEmailAddress'] ?></li>
<li data-action="logout"><?php echo $dashboard['LogOut'] ?></li>
</ul>
</div>

<?php echo Q::tool('Q/tabs', array(
'vertical' => !$isMobile and Q_Config::get('Q', 'response', 'layout', 'sidebar', false),
Expand Down
1 change: 1 addition & 0 deletions MyApp/web/css/MyApp.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ table { table-layout: fixed; }
.Q_mobile.Users_loggedIn #dashboard_user { margin: 0; }
.Q_mobile.Users_loggedOut #dashboard_user { line-height: 40px; }
#dashboard .Q_contextual * { color: black; }
#dashboard_user_contextual { display: none; }
#dashboard td { vertical-align: middle; }
#dashboard table { width: 100%; padding: 0; margin: 0; }
#dashboard .Q_dashboard_logo { padding: 0; }
Expand Down
15 changes: 9 additions & 6 deletions MyApp/web/js/MyApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ var MyApp = (function (Q, $) {
Q.Users.login();
return false;
});

Q.addScript("{{Q}}/js/contextual.js", function () {
$('#dashboard .Users_avatar_tool').plugin('Q/contextual', {
elements: $('#dashboard_user_contextual .Q_listing').clone().children(),
defaultHandler: MyApp.userContextual

var $userCommands = $('#dashboard_user_contextual .Q_listing').children();
if ($userCommands.length) {
Q.addScript("{{Q}}/js/contextual.js", function () {
$('#dashboard .Users_avatar_tool').plugin('Q/contextual', {
elements: $userCommands.clone(),
defaultHandler: MyApp.userContextual
});
});
});
}

// For example, we can hide notices when the user clicks/taps on them
$('#notices li').on(Q.Pointer.fastclick, true, function () {
Expand Down

0 comments on commit 4cc58e1

Please sign in to comment.