/
layout.cshtml
73 lines (68 loc) · 2.18 KB
/
layout.cshtml
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
@using FreyaMusicStore
<!DOCTYPE html>
<html>
<head>
<title>Freya Music Store</title>
<link href="/Site.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script>
if (!String.format) {
String.format = function (format) {
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
</script>
</head>
<body>
<div id="header">
<h1><a href="/">FREYA MUSIC STORE</a></h1>
<ul id="navlist">
<li class="first"><a href="@Uris.home" id="current">Home</a></li>
<li><a href="@Uris.genres">Genres</a></li>
@{
var cartId = ViewBag.UserName ?? ViewBag.CartId;
var cartItems = ViewBag.CartItems;
if (cartId != null){
<li><a href="@String.Format(Uris.cart, cartId)">Cart (@cartItems)</a></li>
}
}
<li><a href="@Uris.albums">Albums</a></li>
</ul>
<div style="float: right; margin-top: 20px;">
@if (@ViewBag.UserName == null)
{
<a href="@Uris.logon">Log In</a>
}
else
{
<span>Logged in as @ViewBag.UserName, </span>
<a href="#" id="logoff">Log Off</a>
}
</div>
</div>
<div id="main">
@RenderSection("Main")
</div>
<div id="footer">
built with <a href="http://docs.freya.io/en/latest/">Freya</a> and <a href="http://fsharp.org">F#</a>
</div>
<script>
$('#logoff').click(function () {
var success = function () {
window.location = "@Uris.home";
};
$.ajax({
type: "DELETE",
url: String.format("@Uris.session", "@ViewBag.UserName"),
success: success
});
});
</script>
</body>
</html>