This file contains hidden or 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
li { | |
margin-bottom: 10px; | |
margin-left: 30px; | |
padding: 5px; | |
list-style: square; | |
font-size: 1.2em; | |
} |
This file contains hidden or 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
/**************************************************************************************** | |
* Router stuff | |
****************************************************************************************/ | |
var Router = function() { | |
}; | |
Router.prototype.triggerRoute = function(verb, path, actionFunction, params, id) { | |
switch(verb) { |
This file contains hidden or 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
describe("AjaxThingy", function () { | |
var successResponse = { | |
basket: { | |
itemCount: 2 | |
} | |
} | |
describe("Requesting something", function () { | |
it("Makes an AJAX request", function () { |
This file contains hidden or 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
//Jungle.js | |
var Jungle = {}; | |
//Jungle.Global.js | |
Jungle.Global = {}; | |
//Jungle.Global.AutoComplete.js | |
Jungle.Global.AutoComplete = {}; | |
//Jungle.Global.AnotherGlobalComponent .js |
This file contains hidden or 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
<body id="pgPaymentInformation" class="checkout"> |
This file contains hidden or 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 App = App || {}; | |
App.Controllers = App.Controllers || {}; | |
App.Controllers.UserEdit = function() { | |
this.model = new App.Models.Users(); | |
this.view = new App.Views.UserEdit(); | |
App.Routes.addRoute("/users/:user_uuid/edit/", $.proxy(this.handleUserEditRoute, this)); | |
// This is a little jQuery plugin that provides custom events | |
$.subscribe("UserEditFormSubmitted", $.proxy(this.handleFormSubmitted, this)); | |
} | |
App.Controllers.UserList.prototype.handleUserEditRoute = function(params) { |
This file contains hidden or 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
<script id="tmplUserEdit" type="text/x-jquery-tmpl"> | |
<div id="userEdit"> | |
<form> | |
<input type="hidden" name="uuid" value="${uuid}" /> | |
<div class="field"> | |
<label for="email">Email</label> | |
<input type="text" name="email" id="email" value="${email}" /> | |
</div> | |
<div class="field"> | |
<label for="first_name">First name</label> |
This file contains hidden or 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
{ "data": { "uuid": "123456", "first_name": "Adam", "last_name": "Silver" } } } |
This file contains hidden or 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 App = App || {}; | |
App.Views = App.Views || {}; | |
App.Views.UserEdit = function() { | |
this.container = "#someContainer"; // a container where users edit will render into | |
} | |
App.Views.UserEdit.prototype.render = function(viewModel) { | |
var container = $(this.container); | |
// inject jQuery template into container | |
container.html($.tmpl($("#userEditTemplate").html(), viewModel)); | |
container.find("form").bind("submit", $.proxy(this.handleFormSubmit, this)); |
This file contains hidden or 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
//previous code | |
App.Models.User.prototype.getRecord = function(options) { | |
$.ajax({ | |
type: "GET", | |
url: this.url + "/" options.uuid + ".json", | |
success: options.success | |
}); | |
} |