<commit_before>{div, span, button, i, h4, img, p, a} = React.DOM

@CompanyProfile_Content_Funding_View = React.createFactory React.createClass
  propTypes: 
    company:     React.PropTypes.object.isRequired
    saveProfile: React.PropTypes.func.isRequired
    
  getInitialState: ->
    company: @props.company
  
  render: ->
    if _.isEmpty(@state.company.fundings)
      @_renderEmpty()
    else if @state.funding
      CompanyProfile_Content_Funding_Form(funding: @state.funding, saveProfile: @props.saveProfile, onCancel: @_onFormCancel)
    else
      @_renderListings()
      
  _onEditFunding: (object, event)->
    @setState funding: object
  
  _onFormCancel: (company)->
    options = form: false, funding: null
    options.company = company if company

    @setState(options)
    
  _onEdit: ->
    @setState edit_mode: true
    
  _onCancel: ->
    @setState edit_mode: false

  _renderEmpty: ->
    (div className: 'section__body section__body_empty',
      (div className: 'empty-body',
        (i className: 'empty-body__icon fa fa-usd')<commit_msg>prioritize conditions in fundings component<commit_after>{div, span, button, i, h4, img, p, a} = React.DOM

@CompanyProfile_Content_Funding_View = React.createFactory React.createClass
  propTypes: 
    company:     React.PropTypes.object.isRequired
    saveProfile: React.PropTypes.func.isRequired
    
  getInitialState: ->
    company: @props.company
  
  render: ->
    if @state.edit_mode
      @_renderListings()
    else if @state.funding
      CompanyProfile_Content_Funding_Form(funding: @state.funding, saveProfile: @props.saveProfile, onCancel: @_onFormCancel)
    else if _.isEmpty(@state.company.fundings)
      @_renderEmpty()
    else
      @_renderListings()
      
  _onEditFunding: (object, event)->
    @setState funding: object
  
  _onFormCancel: (company)->
    options = form: false, funding: null
    options.company = company if company

    @setState(options)
    
  _onEdit: ->
    @setState edit_mode: true
    
  _onCancel: ->
    @setState edit_mode: false

  _renderEmpty: ->
    (div className: 'section__body section__body_empty',
      (div className: 'empty-body',
        (i className: 'empty-body__icon fa fa-usd')
{'fraction_non_alphanumeric': 0.10595130748422002, 'fraction_numerical': 0.0009017132551848512, 'mean_word_length': 3.350980392156863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4943456', 'n_tokens_mistral': 708, 'n_tokens_neox': 699, 'n_words': 155}