forked from joaool/MotherGithub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backbone_menu1.html
152 lines (147 loc) · 5.25 KB
/
backbone_menu1.html
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Backbone/menu v1.0</title>
<!-- Bootstrap core CSS -->
<!--
<link href="../smartmenus-master/src/libs/demo-assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
-->
<link href="../bootstrap/css/cerulean.css" rel="stylesheet">
<!-- SmartMenus jQuery Bootstrap Addon CSS -->
<link href="../smartmenus-master/src/addons/bootstrap/jquery.smartmenus.bootstrap.css" rel="stylesheet">
</head>
<body style="padding-top:40px;">
<p><strong>FrameLink Menus: Bootstrap with smartmenus addon (to subport submenus). CSS is bootstrap bootswatch</strong></p>
<div id="xcontainer">
<button>Load</button>
<ul id="list">
</ul>
</div>
<div id="list-template">
<li><a href=""></a></li>
</div>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!--
<a class="navbar-brand" href="#">Project name</a>
-->
<a class="navbar-brand" href="./index.html"><img style="height:55px;" src="../bootstrap/img/framelink-logoWithText.png"></a>
</div>
<div class="navbar-collapse collapse">
<!-- Left nav -->
<ul class="nav navbar-nav">
<li><a href="#">FrameLink</a></li>
<li><a href="#">Item 2</a>
<ul class="dropdown-menu">
<li><a href="#">Item 2-1</a></li>
<li><a href="#">Item 2-2</a>
<ul class="dropdown-menu">
<li><a href="#">Item 2-2-1</a></li>
<li><a href="#">Item 2-2-2</a></li>
<li><a href="#">Item 2-2-3</a>
<ul class="dropdown-menu">
<li><a href="http://microsoft.com">Microsoft</a></li>
<li><a href="#">Item 2-2-3-2</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Item 2-3</a></li>
</ul>
</li>
<li><a href="#">Item 3</a></li>
</ul>
</div>
</div>
</div>
<p>navBuilder</p>
<!--<script type="text/javascript" charset="utf-8" src="../rivets/dist/rivets.js" ></script>-->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js" type="text/javascript"></script>
<script type="text/javascript">
var oMenu = {
"menu" : [
{
"title" : "Menu A - Tier 1",
"uri":"http://www.microsoft.com"
},
{
"title" : "Menu B - Tier 1",
"uri" : "#",
"menu" : [
{
"title" : "Menu B - Tier 2 - I",
"uri":"#1"
},
{
"title" : "Menu B - Tier 2 - II",
"uri":"#"
}
]
},
{
"title" : "Menu C - Tier 1",
"uri":"#3",
},
{
"title" : "Menu D - Tier 1",
"uri":"#3",
"menu":"hjhj"
}
]
};
model = new Backbone.Model({
data:[
{text:"Google",href:"http://google.com"},
{text:"Facebook",href:"http://facebook.com"},
{text:"YouTube",href:"http://youtube.com"}
]
});
var View = Backbone.View.extend({
initialize:function(){
console.log("Initializing view with..." + this.options.JOBlankOption );
this.xtemplate = $("#list-template").children(); //we want the li line.
},
el:"#xcontainer", //the prebuild option is used here meaning that this view always refers to #container
events:{
"click button":"render" //this will trigger button in container, outside the container will not receive the event...
},
render:function(){
var data = this.model.get("data");
for (var i=0; i<data.length; i++) {
console.log("line= "+i+" "+data[i].text);
var li = this.xtemplate.clone().find("a").attr("href",data[i].href).text(data[i].text).end();
this.$el.find("ul").append(li);
}
// alert("JO");
return null;
}
});
var view = new View({model:model,JOBlankOption:"empty string"});
view.render();
console.log(document.title+"...... END..");
</script>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../smartmenus-master/src/libs/demo-assets/bootstrap/js/bootstrap.min.js"></script>
<!--
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js" type="text/javascript"></script>
-->
<!-- SmartMenus jQuery plugin -->
<script type="text/javascript" src="../smartmenus-master/src/jquery.smartmenus.js"></script>
<!-- SmartMenus jQuery Bootstrap Addon -->
<script type="text/javascript" src="../smartmenus-master/src/addons/bootstrap/jquery.smartmenus.bootstrap.js"></script>
</body>
</html>