GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — changes :clock4: · msolov/fullstack-javascript@b25e64c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • 05-backbone
    • binding
      • index.html
    • collections
      • index.html
    • hello-world
      • index.html
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎05-backbone/binding/index.html‎

Copy file name to clipboardExpand all lines: 05-backbone/binding/index.html
+9-10Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<script src="backbone.js"></script>
77

88
<script>
9+
910
var appleData = [
1011
{
1112
name: 'fuji',
@@ -16,7 +17,9 @@
1617
url: 'img/gala.jpg'
1718
}
1819
]
20+
1921
var app
22+
2023
var router = Backbone.Router.extend({
2124
routes: {
2225
'': 'home',
@@ -33,7 +36,6 @@
3336
},
3437
loadApple: function(appleName){
3538
this.appleView.loadApple(appleName)
36-
3739
}
3840
})
3941

@@ -43,11 +45,11 @@
4345
render: function(){
4446
this.$el.html(this.template({data: JSON.stringify(this.collection.models)}))
4547
}
46-
//TODO subviews
4748
})
4849

4950
var Apples = Backbone.Collection.extend({
5051
})
52+
5153
var appleView = Backbone.View.extend({
5254
initialize: function(){
5355
this.model = new (Backbone.Model.extend({}))
@@ -59,25 +61,22 @@
5961
<figcaption><%= attributes.name %></figcaption>\
6062
</figure>'),
6163
templateSpinner: '<img src="img/spinner.gif" width="30"/>',
62-
63-
loadApple:function(appleName){
64+
loadApple: function(appleName){
6465
this.trigger('spinner')
65-
var view = this //we'll need to access that inside of a closure
66-
setTimeout(function(){ //simulates real time lag when fetching data from the remote server
66+
var view = this // We'll need to access that inside of a closure
67+
setTimeout(function(){ // Simulates real time lag when fetching data from the remote server
6768
view.model.set(view.collection.where({name: appleName})[0].attributes)
68-
},1000)
69-
69+
}, 1000)
7070
},
71-
7271
render: function(appleName){
7372
var appleHtml = this.template(this.model)
7473
$('body').html(appleHtml)
7574
},
7675
showSpinner: function(){
7776
$('body').html(this.templateSpinner)
7877
}
79-
8078
})
79+
8180
$(document).ready(function(){
8281
app = new router
8382
Backbone.history.start()
Collapse file

‎05-backbone/collections/index.html‎

Copy file name to clipboardExpand all lines: 05-backbone/collections/index.html
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<script src="backbone.js"></script>
77

88
<script>
9+
910
var appleData = [
1011
{
1112
name: 'fuji',
@@ -16,7 +17,9 @@
1617
url: 'img/gala.jpg'
1718
}
1819
]
20+
1921
var app
22+
2023
var router = Backbone.Router.extend({
2124
routes: {
2225
'': 'home',
@@ -42,30 +45,29 @@
4245
render: function(){
4346
this.$el.html(this.template({data: JSON.stringify(this.collection.models)}))
4447
}
45-
//TODO subviews
4648
})
4749

4850
var Apples = Backbone.Collection.extend({
49-
5051
})
52+
5153
var appleView = Backbone.View.extend({
5254
template: _.template('<figure>\
5355
<img src="<%= attributes.url%>"/>\
5456
<figcaption><%= attributes.name %></figcaption>\
5557
</figure>'),
56-
//re-write with load apple and event binding
58+
// Re-write with load apple and event binding
5759
render: function(appleName){
5860
var appleModel = this.collection.where({name: appleName})[0]
5961
var appleHtml = this.template(appleModel)
6062
$('body').html(appleHtml)
6163
}
6264
})
65+
6366
$(document).ready(function(){
6467
app = new router
6568
Backbone.history.start()
6669
})
6770

68-
6971
</script>
7072
</head>
7173
<body>
Collapse file

‎05-backbone/hello-world/index.html‎

Copy file name to clipboardExpand all lines: 05-backbone/hello-world/index.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<script>
99

10-
var app // becomes window.app
10+
var app // Becomes window.app
1111
var router = Backbone.Router.extend({
1212
routes: {
1313
'': 'home'

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.