Skip to content

Commit

Permalink
initial values appear also in input fields
Browse files Browse the repository at this point in the history
fix formatting issue
  • Loading branch information
shaystern committed Jul 18, 2015
1 parent 3494dc4 commit dc505b0
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ Once included, you can initialize the component. you'll need to make the compone
- Navigate to http://localhost:8000/
- Run grunt build after you make the changes

your more than welcome to contribute. Enjoy!
You are more than welcome to contribute. Enjoy!

16 changes: 2 additions & 14 deletions grunt-tasks/browserify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ module.exports = ->
devFiles =
'<%= config.tmp %>/example/card-loader.js': ['example/card-loader.cjsx']

prodFiles =
'<%= config.lib %>/card-react-form-container.js': ['<%= config.src %>/coffee/card-react-form-container.cjsx']
'<%= config.lib %>/card-react-component.js': ['<%= config.src %>/coffee/card-react-component.cjsx']


browserifyOptions =
paths: ['./<%= config.src %>', './example', './<%= config.src %>/coffee']
paths: ['./<%= config.src %>', './example', './<%= config.src %>/components']
extensions: ['.coffee', '.cjsx']
debug: true

Expand All @@ -21,11 +16,4 @@ module.exports = ->
files : devFiles
options:
watch: true
browserifyOptions: browserifyOptions # Doesn't work if placed in the task-level options. See https://github.com/jmreidy/grunt-browserify/issues/280

prod:
files : prodFiles
options:
watch: false
external: ['react', 'classnames', 'payment', './card-react-component']
browserifyOptions: browserifyOptions
browserifyOptions: browserifyOptions # Doesn't work if placed in the task-level options. See https://github.com/jmreidy/grunt-browserify/issues/280
4 changes: 2 additions & 2 deletions grunt-tasks/cjsx.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = ->
@config "cjsx",
build:
files:
'<%= config.lib %>/card-react-form-container.js': '<%= config.src %>/coffee/card-react-form-container.cjsx'
'<%= config.lib %>/card-react-component.js': '<%= config.src %>/coffee/card-react-component.cjsx'
'<%= config.lib %>/card-react-form-container.js': '<%= config.src %>/components/card-react-form-container.cjsx'
'<%= config.lib %>/card-react-component.js': '<%= config.src %>/components/card-react-component.cjsx'
2 changes: 1 addition & 1 deletion grunt-tasks/compass.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ module.exports = ->
options:
sassDir: '<%= config.src %>/scss'
cssDir: '<%= config.lib %>/'
javascriptsDir: '<%= config.src %>/coffee'
javascriptsDir: '<%= config.src %>/components'
importPath: 'node_modules/bourbon/app/assets/stylesheets'
10 changes: 9 additions & 1 deletion grunt-tasks/watch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ module.exports = (grunt, options) ->
livereload:
options:
livereload: grunt.option('livereload') || true
files: ['<%= config.tmp %>/**/*']
files: [ '<%= config.lib %>/**/*','<%= config.tmp %>/**/*']

compass:
files: ['<%= config.src %>/scss/{,*/}*.{scss,sass}']
tasks: ['compass']

cjsx:
files: ['<%= config.src %>/components/{,*/}*.{cjsx,coffee}']
tasks: ['cjsx']

browserify:
files: ['example/{,*/}*.{cjsx, coffee}']
tasks: ['browserify']

@event.on 'watch', (action, filepath, target) =>
@log.writeln "#{target}: #{filepath} has #{action}.."
5 changes: 3 additions & 2 deletions lib/card-react-form-container.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,18 @@ ReactCardFormContainer = React.createClass
newClassName = inputsValidationClass

return React.cloneElement(child, {
onChange: @inputOnChange
onKeyUp: @inputOnKeyUp
onFocus: @inputOnFocus
onBlur: @inputOnBlur
ref: @inputsRefs[child.props.name]
defaultValue: @inputsValues[child.props.name]
className: newClassName
}, child.props && child.props.children)
else
return React.cloneElement(child, {}, this.traverseChildrenAndRegisterInputs(child.props && child.props.children))
)

inputOnChange: (event)->
inputOnKeyUp: (event)->
@inputsValues[event.target.name] = event.target.value
@validateInput event.target.name, event.target.value
@renderCardComponent()
Expand Down

0 comments on commit dc505b0

Please sign in to comment.