This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title> | |
</title> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-role="page" id="page1"> | |
<div data-role="header"> | |
<h3> | |
Page 1 | |
</h3> | |
</div> | |
<div data-role="content"> | |
<!-- components go here --> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-role="page" id="page2"> | |
<div data-role="header"> | |
<h3> | |
Page 2 | |
</h3> | |
<a data-role="button" data-direction="reverse" data-rel="back" href="#page2" data-icon="arrow-l" data-iconpos="left"> | |
Back | |
</a> | |
</div> | |
<div data-role="content"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-role="page" id="page2"> | |
<div data-role="header"> | |
<h3> | |
Page 2 | |
</h3> | |
<a data-role="button" data-direction="reverse" data-rel="back" href="#page2" data-icon="arrow-l" data-iconpos="left"> | |
Back | |
</a> | |
</div> | |
<div data-role="content"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = new UserApp(); | |
a.id = id; | |
a.fetch({ | |
success: function(r) { | |
var name = r.get('name'); | |
console.log('Loaded app:', name); | |
}, | |
error: function(r) { | |
console.log('Unable to load app'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var versions = new UserAppVersions(); | |
versions.id = appId; | |
versions.fetch({ | |
error: function() { | |
console.log('Unable to load user app versions'); | |
}, | |
success: function(versions) { | |
console.log('Versions', versions); | |
// iterate over them with the each function, or with a for loop over version.models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var UserAppVersions = Backbone.Collection.extend({ | |
model: UserAppVersion, | |
url: function() { | |
return '/api/v1/user/app/' + this.id + '/versions'; | |
}, | |
parse: function(response) { | |
return response.versions; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"versions":[ | |
{ | |
"created_at":"" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var UserApp = Backbone.Model.extend({ | |
urlRoot: '/api/v1/user/app' | |
}); |