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
module.exports = function(Thread, Post) { | |
return { | |
post: function(req, res) { | |
new Thread({title: req.body.title, author: req.body.author}).save(); | |
}, | |
list: function(req, res) { | |
Thread.find(function(err, threads) { | |
res.send(threads); | |
}); |
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
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |
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
(function($) { | |
var app = $.sammy('#main', function() { | |
this.use('Template'); | |
this.get('#/', function(context) { | |
this.load('thread') | |
.then( function(threads) { | |
$.each(threads, function(i, thread) { | |
context.render('templates/thread.template', {thread : thread}) | |
.appendTo(context.$element()); | |
}); |
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
$(function() { | |
window.ThreadController = Backbone.Controller.extend({ | |
initialize: function() { | |
this.threadListModel = new ThreadListModel; | |
this.threadListView = new ThreadListView; | |
Backbone.history.start(); | |
}, | |
routes: { | |
"/" : "listThreads" |
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
this.post('#/thread', function(context) { | |
$.post('thread', this.params); | |
this.redirect('#/thread/' + this.params.title); | |
}); |
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
<pre> | |
<div class="thread"> | |
<div class="thread-title"> | |
<a href="#/thread/<%= thread.title %>"><%= thread.title %></a> | |
</div> | |
<time><%= thread.postdate %></time> | |
<div class="thread-author"><%= thread.author %></div> | |
</div> | |
</pre> |
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
this.get('#/', function(context) { | |
this.load('thread') | |
.then( function(threads) { | |
$.each(threads, function(i, thread) { | |
context.render('templates/thread.template', {thread : thread}).appendTo(context.$element()); | |
}); | |
}); | |
}); |
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
(function($) { | |
var app = $.sammy('#main', function() { | |
this.get('#/', function(context) { | |
alert('index!'); | |
}); | |
}); | |
$(function() { | |
app.run('#/'); | |
}); |
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
public static void clickElement(WebDriver driver, By condition) { | |
WebElement sbutton = driver.findElement(condition); | |
sbutton.sendKeys("\n"); | |
try { | |
sbutton = driver.findElement(condition); | |
sbutton.click(); | |
} catch (NoSuchElementException e) {} | |
} |
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
if (System.getProperty("os.name").startsWith("Windows")) | |
suppliers.add(INTERNET_EXPLORER_SUPPLIER) | |
} |