@@ -12,11 +12,12 @@ define([
12
12
13
13
// Extends Backbone.Router
14
14
var CategoryRouter = Backbone . Router . extend ( {
15
+ backToHome : false ,
15
16
16
17
// The Router constructor
17
18
initialize : function ( ) {
18
19
19
- this . pagecontainer = $ ( ".ui-pagecontainer" ) . pagecontainer ( "instance " ) ;
20
+ this . pagecontainerHandle = $ ( ".ui-pagecontainer" ) ;
20
21
21
22
// Instantiates a new Animal Category View
22
23
this . animalsView = new CategoryView ( { el : "#animals" , collection : new CategoriesCollection ( [ ] , { type : "animals" } ) } ) ;
@@ -27,9 +28,9 @@ define([
27
28
// Instantiates a new Vehicles Category View
28
29
this . vehiclesView = new CategoryView ( { el : "#vehicles" , collection : new CategoriesCollection ( [ ] , { type : "vehicles" } ) } ) ;
29
30
31
+
30
32
// Tells Backbone to start watching for hashchange events
31
33
Backbone . history . start ( ) ;
32
-
33
34
} ,
34
35
35
36
// Backbone.js Routes
@@ -47,21 +48,21 @@ define([
47
48
home : function ( ) {
48
49
49
50
// Programatically changes to the categories page
50
- this . pagecontainer . change ( "#categories" , {
51
+ this . pagecontainerHandle . pagecontainer ( "change" , "#categories" , {
51
52
reverse : false ,
52
- changeHash : false
53
+ changeUrl : false
53
54
} ) ;
54
-
55
55
} ,
56
56
57
57
// Category method that passes in the type that is appended to the url hash
58
58
category : function ( type ) {
59
59
60
60
// Stores the current Category View inside of the currentView variable
61
61
var currentView = this [ type + "View" ] ;
62
+ var that = this ;
62
63
63
64
// If there are no collections in the current Category View
64
- if ( ! currentView . collection . length ) {
65
+ if ( ! currentView . collection . length ) {
65
66
66
67
// Show's the jQuery Mobile loading icon
67
68
$ . mobile . loading ( "show" ) ;
@@ -70,9 +71,9 @@ define([
70
71
currentView . collection . fetch ( ) . done ( function ( ) {
71
72
72
73
// Programatically changes to the current categories page
73
- this . pagecontainer . change ( "#" + type , {
74
+ that . pagecontainerHandle . pagecontainer ( "change" , "#" + type , {
74
75
reverse : false ,
75
- changeHash : false
76
+ changeUrl : false
76
77
} ) ;
77
78
} ) ;
78
79
@@ -82,9 +83,9 @@ define([
82
83
else {
83
84
84
85
// Programatically changes to the current categories page
85
- this . pagecontainer . change ( "#" + type , {
86
+ this . pagecontainerHandle . pagecontainer ( "change" , "#" + type , {
86
87
reverse : false ,
87
- changeHash : false
88
+ changeUrl : false
88
89
} ) ;
89
90
90
91
}
0 commit comments