As a stand-in to a full-fledged, publicly accessible JSON API, it would be incredibly liberating to have a Handlebars helper which allows us to loop through posts by parameters (maybe query params could even be mixed into the Handlebars context) instead of some internal state dictated by the URL. This would allow for easy creation of "related content", or a "search" function.
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
_.extend Marionette.Renderer, | |
render: (template, data) -> | |
throw "Template #{template} not found!" unless JST[template] | |
JST[template](data) |
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 M = Backbone.Marionette; | |
var App = new M.Application(); | |
var ListItem = M.ItemView.extend({ | |
tagName: 'li', | |
template: _.template('<h4 class="question"><%= question %></h4><p style="display: none;"><%= answer %></p>') | |
}); | |
var List = M.CollectionView.extend({ |
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
<script type="text/handlebars" id="my_list_template"> | |
<div class="{{whichuser}}"> | |
<img src="{{ image }}"> | |
<div class="message_body"> | |
{{{message_body}}} | |
</div> | |
</div> | |
</script> |
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
// Generated on 2014-03-05 using generator-webapp 0.4.7 | |
'use strict'; | |
// # Globbing | |
// for performance reasons we're only matching one level down: | |
// 'test/spec/**/*.js' | |
// use this if you want to recursively match all subfolders: | |
// 'test/spec/**/*.js' | |
module.exports = function (grunt) { |
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
@AnalyticsApp.module "Views", (Views, App, Backbone, Marionette, $, _) -> | |
_.extend Marionette.View::, | |
templateHelpers: -> | |
form: | |
App.request "get:form" | |
i18n: | |
App.request "get:i18n" |
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
describe "Saving", -> | |
before -> | |
@syncSpy = sinon.spy() | |
@syncStub = sinon.stub(Backbone, 'sync', @syncSpy) | |
@changeSpy = sinon.spy() | |
afterEach -> | |
@syncSpy.reset() | |
it 'sets errors on the model when trying to save', -> |
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 plan = require('flightplan'); | |
var moment = require('moment'); | |
var currentTime = new Date().getTime(); | |
var formattedCurrentTime = moment(currentTime).format('YYYY-MM-DD_HH-mm'); | |
var backupsFilename = 'backups.json'; | |
plan.target('staging', { | |
host: 'staging.some-host.com', | |
username: 'root-level-user', |
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
import BaseView from './BaseView'; | |
import listenToMany from '../utils/listenToMany'; | |
import template from '../templates/user'; | |
// Backbone's extend + ES6 | |
export default BaseView.extend({ | |
template, | |
listenToMany | |
}); |
When I render OfferList through React Router, The result is a rejected promise, saying:
`An error occured when handling the DONE state of a fetch`
{
message: "Not found",
name: "Not found",
status: 404
}
OlderNewer