# @cjsx React.DOM $ = require('jquery') React = require('react/addons') Modal = require('react-bootstrap/lib/Modal') Button = require('react-bootstrap/lib/Button') module.exports = React.createClass mixins: [React.addons.LinkedStateMixin] displayName: 'EditTag' getInitialState: ()-> updating: false name: @props.tag.get('name') errors: false shaking: false onChangeName: (event)-> @setState name: event.target.value onClickOk: (event)-> event.preventDefault() @setState updating: true attributes = {new_name: @state.name} @props.tag.save attributes, success: ()=> @props.tag.set 'name', @state.name @props.onRequestHide() error: (model, response, options)=> @setState errors: response.responseJSON.tag.errors @setState updating: false @setState shaking: true setTimeout (=> @setState shaking: false), 300 render: -> } animation={false}>
{ if @state.errors
    { for key, errors of @state.errors for error in errors
  • {key + ' ' + error}
  • }
}