# @cjsx React.DOM $ = require('jquery') React = require('react') Edit = require('./edit') CardModel = require('../models/card') ModalTrigger = require('react-bootstrap/lib/ModalTrigger') config = require('../../shared/config.json') module.exports = React.createClass displayName: 'Header' getInitialState: ()-> searchText: '' componentWillMount: ()-> console.log 'header mounted' @card = new CardModel() @card._isNew = true @card.on 'sync', (model)=> console.log 'sync!!!' @card = new CardModel() @card._isNew = true @forceUpdate() onChangeSearchText: ()-> @setState searchText: event.target.value onKeyPressSearchText: ()-> if event.keyCode == 13 # ENTER console.log '13 enter' event.preventDefault() query = {title: @state.searchText} location.hash = '/?' + $.param(query) render: ->