Add "Show menu" link at awaiting users page

Fixes #95
This commit is contained in:
Dmitriy Simushev 2015-04-08 09:44:05 +00:00
parent e4a104f52e
commit 48d8805605
6 changed files with 65 additions and 12 deletions

View File

@ -47,7 +47,6 @@ class UsersController extends AbstractController
$_SESSION[SESSION_PREFIX . "operatorgroups"] = get_operator_groups_list($operator['operatorid']);
$page = array();
$page['havemenu'] = !$request->query->has('nomenu');
$page['showonline'] = (Settings::get('showonlineoperators') == '1');
$page['showvisitors'] = (Settings::get('enabletracking') == '1');
$page['title'] = getlocal("List of visitors waiting");
@ -55,6 +54,8 @@ class UsersController extends AbstractController
$page = array_merge($page, prepare_menu($operator));
$page['showMenu'] = !$request->query->has('nomenu');
// Attach files of the client side application and start it
$this->getAssetManager()->attachJs('js/compiled/users_app.js');
$this->getAssetManager()->attachJs(

View File

@ -91,6 +91,10 @@ a {
padding: 10px 60px 10px 20px;
overflow: hidden;
}
#toggle-menu {
float: right;
margin-top: 12px;
}
.content-no-menu {
padding: 10px 20px 10px 20px;
}
@ -179,6 +183,9 @@ img.logo {
position: relative;
line-height: 180%
}
.sidebar-hidden {
display: none;
}
#sidebar ul {
margin: 0;
padding: 0;

View File

@ -0,0 +1,39 @@
/*!
* This file is a part of Mibew Messenger.
*
* Copyright 2005-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function (Mibew, $) {
$(function() {
$('#toggle-menu a').on('click', function(e) {
e.preventDefault();
// A special variable is used here only for readability.
var isMenuShown = $('#content').hasClass('content-inner');
if (isMenuShown) {
$('#sidebar').addClass('sidebar-hidden');
$('#content').removeClass('content-inner');
$('#content').addClass('content-no-menu');
$(this).html(Mibew.Localization.trans('Show menu'));
} else {
$('#sidebar').removeClass('sidebar-hidden');
$('#content').removeClass('content-no-menu');
$('#content').addClass('content-inner');
$(this).html(Mibew.Localization.trans('Hide menu'));
}
});
});
})(Mibew, jQuery);

View File

@ -62,7 +62,7 @@
<div class="content-div">
{{#ifOverridden "menu"}}
<div id="content" class="content-inner">
<div id="content" class="{{#if showMenu}}content-inner{{else}}content-no-menu{{/if}}">
{{else}}
<div id="content" class="content-no-menu">
{{/ifOverridden}}

View File

@ -1,4 +1,4 @@
<div id="sidebar">
<div id="sidebar"{{#unless showMenu}} class="sidebar-hidden"{{/unless}}>
<ul>
{{#if warnOffline}}
{{#unless isOnline}}
@ -8,7 +8,6 @@
</li>
{{/unless}}
{{/if}}
{{#if showMenu}}
<li>
<h2>{{l10n "Main"}}</h2>
<ul class="submenu">
@ -46,6 +45,5 @@
<li><a href="{{route "logout"}}">{{l10n "Exit"}}</a></li>
</ul>
</li>
{{/if}}
</ul>
</div>

View File

@ -1,15 +1,23 @@
{{#extends "_layout"}}
{{#if havemenu}}
{{#override "menu"}}{{> _menu}}{{/override}}
{{/if}}
{{#override "menu"}}{{> _menu}}{{/override}}
{{#override "head"}}
<script type="text/javascript" src="{{asset "@CurrentStyle/js/toggle_menu.js"}}"></script>
{{/override}}
{{#override "content"}}
<div>
{{l10n "This page displays a list of visitors who are waiting."}}
<br/>
{{l10n "To answer the visitor click their name in the list."}}
<div id="toggle-menu">
<a href="#">{{#if showMenu}}{{l10n "Hide menu"}}{{else}}{{l10n "Show menu"}}{{/if}}</a>
</div>
<div>
{{l10n "This page displays a list of visitors who are waiting."}}
<br/>
{{l10n "To answer the visitor click their name in the list."}}
</div>
<div style="clear: both;"></div>
</div>
<br/>
<div id="threads-region"></div>