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
/** @jsx React.DOM */ | |
/* jshint trailing:false, quotmark:false, newcap:false */ | |
define(function (require) { | |
'use strict'; | |
var React = require('react'), | |
Promise = require('bluebird'), | |
$ = require('jquery'); |
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
define(function () { | |
'use strict'; | |
var _ = require('underscore'); | |
var ValidationMixin = { | |
getInitialState: function () { | |
return { | |
errors: [] |
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
define(function () { | |
'use strict'; | |
var _ = require('underscore'); | |
var EDITABLE_STATE = 'editable', | |
SUBMITTING_STATE = 'submitting', | |
SUBMITTED_STATE = 'submitted'; |
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 Popover = React.createClass({ | |
mixins: [ClassNameMixin], | |
className: 'Popover', | |
propTypes: { | |
anchorOffset: React.PropTypes.oneOf(['normal', 'fromRoundBtn', 'fromSmallRoundBtn']), | |
expandFrom: React.PropTypes.shape({ | |
horizontal: React.PropTypes.oneOf(['left', 'center', 'right']).isRequired, |
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
// Assumes you're using normalizr https://github.com/gaearon/normalizr | |
// --------------- | |
// Helpers: | |
// --------------- | |
// StoreUtils | |
'use strict'; |
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 Article = React.createClass({ | |
mixins: [createStoreMixin(ArticleStore)], | |
propTypes: { | |
articleId: PropTypes.number.isRequired | |
}, | |
getStateFromStores() { | |
return { | |
article: ArticleStore.get(this.props.articleId); |
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 Article = React.createClass({ | |
mixins: [createStoreMixin(UserStore)], | |
propTypes: { | |
article: PropTypes.object.isRequired | |
}, | |
getStateFromStores() { | |
return { | |
author: UserStore.get(this.props.article.authorId); |
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 is declarative document.title for React. | |
// No more updating document.title in lifecycle hooks and promise handlers! | |
// | |
// Usage: | |
// | |
// var SomePage = React.createClass({ | |
// render() { | |
// // Title might depend on state but it's fine with DocumentTitle | |
// return ( | |
// <DocumentTitle title={this.state.someData && this.state.someData.text}> |
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 makeIdentitySourceMap(map, source, resourcePath) { | |
source.split('\n').map(function (line, index) { | |
map.addMapping({ | |
source: resourcePath, | |
original: { | |
line: index + 1, | |
column: 0 | |
}, | |
generated: { | |
line: index + 1, |
OlderNewer