Last active
December 15, 2015 17:59
-
-
Save JogoShugh/5300295 to your computer and use it in GitHub Desktop.
Extend Backone.Model to consume Azure resource
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
<h2>Details</h2> | |
<p><a href='{{support.href}}'>{{support.title}}</a></p> | |
<p><b>Cost:</b> {{cost}}</p> | |
<p>{{description}}</p> | |
<ul class='textLinks nav nav-tabs nav-stacked'> | |
{{#each textLinks}} | |
<li> | |
<a href="{{href}}"> | |
<img src="img/{{type}}.png"> | |
{{title}} | |
</a> | |
</li> | |
{{/each}} | |
</ul> |
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
catalogApp.EntryModel = Backbone.Model.extend(url: -> | |
"http://appcatalog.azurewebsites.net/appcatalog/entries?staticId=" + @id | |
) |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>VersionOne App Catalog</title> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<style> | |
body { | |
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */ | |
} | |
</style> | |
<link href="css/bootstrap.css" rel="stylesheet"> | |
<link href="css/styles.css" rel="stylesheet"> | |
</head> | |
<body> | |
<div class="container-fluid"> | |
<div class="row-fluid"> | |
<div id="content" class="span12>"></div> | |
</div> | |
</div> | |
<script | |
data-main='scripts/main.js' | |
src='scripts/require.js' | |
type='text/JavaScript'> | |
</script> | |
</body> | |
</html> |
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
requirejs.config shim: | |
handlebars: | |
exports: 'Handlebars' | |
'underscore-min': | |
exports: '_' | |
'backbone-min': | |
deps: ['underscore-min'] | |
exports: 'Backbone' | |
'responsiveslides.min': ['jquery'] | |
'bootstrap.min': ['jquery'] | |
video: ['jquery'] | |
define 'catalogApp', [], () -> | |
return {} | |
require [ | |
'handlebars', | |
'jquery', | |
'moment', | |
'entryModel', | |
'catalogApp', | |
'entryViews', | |
'backbone-min', | |
'bootstrap.min', | |
'video', | |
'responsiveslides.min', | |
], (Handlebars, $, moment, EntryModel, catalogApp) -> | |
# etc |
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
catalogApp.Router = Backbone.Router.extend({ | |
routes: | |
"entries/:id": "entryDetails" | |
"": "home" | |
home: -> | |
this.entryDetails('v1clarityppm') # redirect to a known good id | |
entryDetails: (id) -> | |
entry = new catalogApp.EntryModel(id: "http://versionone.com/" + id) | |
entry.fetch success: -> | |
$("#content").html new catalogApp.EntryDetailsView(model: entry).render().el | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment