forked from emoncms/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.php
82 lines (66 loc) · 1.87 KB
/
sidebar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
global $path, $session, $user;
$apikey = "";
if ($session['write']) $apikey = "&readkey=".$user->get_apikey_read($session['userid']);
?>
<!-- Side-bar navigation -->
<div class="sidenav">
<div class="sidenav_inner">
<ul class="appmenu">
<?php
foreach ($applist as $name=>$appitem) {
echo "<li><a href='".$path."app/view?name=".$name.$apikey."'>".$name."</a></li>";
}
?>
<li><a href="<?php echo $path; ?>app/new"><i class="icon-plus icon-white"></i> Add new app</a></li>
</ul>
</div>
</div>
<script>
var max_wrapper_width = 1150;
$("#app_menu").parent().attr("href","#");
$("#app_menu").find("i").removeClass("icon-leaf");
$("#app_menu").find("i").addClass("icon-list");
var sidebar_enabled = true;
var sidebar_visible = true;
sidebar_resize();
function sidebar_resize() {
var width = $(window).width();
var height = $(window).height();
var nav = $(".navbar").height();
$(".sidenav").height(height-nav);
if (width<max_wrapper_width) {
hide_sidebar()
} else {
if (sidebar_enabled) show_sidebar()
}
}
$(window).resize(function(){
sidebar_resize();
});
$("#app_menu").parent().click(function(){
if (sidebar_visible) {
sidebar_enabled = false;
hide_sidebar();
} else {
sidebar_enabled = true;
show_sidebar();
}
});
function show_sidebar() {
var width = $(window).width();
sidebar_visible = true;
$(".sidenav").css("left","250px");
if (width>=max_wrapper_width) $("#wrapper").css("padding-left","250px");
$("#wrapper").css("margin","0");
$("#sidenav-open").hide();
$("#sidenav-close").hide();
}
function hide_sidebar() {
sidebar_visible = false;
$(".sidenav").css("left","0");
$("#wrapper").css("padding-left","0");
$("#wrapper").css("margin","0 auto");
$("#sidenav-open").show();
}
</script>