1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-27 00:22:45 +00:00

CREATE_MODE(1/2)

This commit is contained in:
Rokt33r
2015-10-14 15:20:16 +09:00
parent 9a5e4b3f54
commit 9d2b64e82b
11 changed files with 226 additions and 70 deletions

View File

@@ -1,6 +1,8 @@
var fs = require('fs')
var path = require('path')
var url = path.resolve(process.cwd(), './submodules/ace/src-min')
module.exports = fs.readdirSync(__dirname + '/../browser/ace/src-min')
module.exports = fs.readdirSync(url)
.filter(function (file) {
return file.match(/^mode-/)
})

View File

@@ -24,6 +24,7 @@ function getUsers (input, cb) {
export default class CreateNewTeam extends React.Component {
constructor (props) {
super(props)
this.state = {
create: {
name: '',
@@ -99,7 +100,7 @@ export default class CreateNewTeam extends React.Component {
<div className='createTab'>
<div className='title'>Create new team</div>
<input valueLink={linkState(this, 'create.name')} className='ipt' type='text' placeholder='Enter your team name'/>
<input valueLink={this.linkState('create.name')} className='ipt' type='text' placeholder='Enter your team name'/>
{alertEl}
<button onClick={e => this.handleContinueClick(e)} disabled={createState.isSending} className='confirmBtn'>Continue <i className='fa fa-arrow-right fa-fw'/></button>
</div>
@@ -260,3 +261,4 @@ export default class CreateNewTeam extends React.Component {
CreateNewTeam.propTypes = {
close: PropTypes.func
}
CreateNewTeam.prototype.linkState = linkState

View File

@@ -1,5 +1,5 @@
function getIn (object, path) {
var stack = path.split('.')
let stack = path.split('.')
while (stack.length > 1) {
object = object[stack.shift()]
}
@@ -7,8 +7,8 @@ function getIn (object, path) {
}
function updateIn (object, path, value) {
var current = object
var stack = path.split('.')
let current = object
let stack = path.split('.')
while (stack.length > 1) {
current = current[stack.shift()]
}
@@ -21,7 +21,14 @@ function setPartialState (component, path, value) {
updateIn(component.state, path, value))
}
export default function linkState (el, path) {
export default function linkState (path) {
return {
value: getIn(this.state, path),
requestChange: setPartialState.bind(null, this, path)
}
}
export function linkState2 (el, path) {
return {
value: getIn(el.state, path),
requestChange: setPartialState.bind(null, el, path)