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
# New validation | |
validation = new Validator() | |
# Datas to validate | |
datas = | |
name: 'Batman' | |
# Rules of validation to use | |
rules = | |
name: 'required|length:6' |
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
route.match '/tweet', -> | |
syphon = new Syphon() | |
tweet = syphon.exclude('title').get('#tweet') | |
# Will log the json | |
# | |
# { | |
# nickname: "batman" |
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
route.match '/tweet', -> | |
syphon = new Syphon() | |
tweet = syphon.get '#tweet' | |
# Will log the json | |
# | |
# { | |
# title: "My super tweet", |
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
<form id="tweet"> | |
<input type="text" name="title" value="My super tweet" /> | |
<input type="text" name="nickname" value="batman" /> | |
</form> |
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
jsonObject = | |
"name": "batman" | |
"lvl": "25" |
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
<form id="new"> | |
<input type="text" name="name" value="batman" /> | |
<input type="text" name="lvl" value="25" /> | |
</form> |
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
Controller = require 'core/controller' | |
Class Robin extends Controller | |
run: -> | |
user = | |
name: 'robin' | |
# Load a view |
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
# Don't forget to put that line in the top of the file | |
View = require 'core/view' | |
route.match '/users', -> | |
# Our user | |
user = | |
name: 'Batman' | |
lvl: 25 | |
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 class="user"> | |
<span class="user-name"><%- @name %>, level <span class="user-lvl"><%- @lvl %></span> | |
</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
route.match '/users', -> | |
user = | |
name: 'Batman' | |
lvl: 25 | |
block = '<div class="user"><span class="user-name">' + user.name + '</span>, level <span class="user-lvl">' + user.lvl + '</span></div>' | |
$('body').html block | |