<commit_before>import React, { PropTypes, Component } from 'react'
import { Form, InputSet } from 'rform'

export default class EditTranslationForm extends Component {
  static contextTypes = {
    disableUiElements: PropTypes.bool
  }

  render() {
    const { property, source } = this.props

    return (
      <tr>
        <td>
          {this.renderTextOrForm()}
        </td>
        <td>
          {source && source[`${property}-de`]}
        </td>
      </tr>
    )
  }

  renderTextOrForm(){
    const { property, length, source, content, type } = this.props
    const { disableUiElements } = this.context

    if (disableUiElements == false && (source && source[`translated-${property}`] || content)) {
      return (
        <div>
          <InputSet
            attribute={property} type={type} label={property}
            wrapperClassName='form-group' className='form-control'
            wrapperErrorClassName='has-error' errorClassName='help-block'
          />
          Länge: {length}
        </div>
      )
    }
    else {
      return (
        <div>
          {content}
        </div>
      )
    }
  }
}<commit_msg>Fix for clarat-org/clarat#1282 - fixed UI elements not being rendered when the translation in rform is empty (access to source was wrong)<commit_after>import React, { PropTypes, Component } from 'react'
import { Form, InputSet } from 'rform'

export default class EditTranslationForm extends Component {
  static contextTypes = {
    disableUiElements: PropTypes.bool
  }

  render() {
    const { property, source } = this.props

    return (
      <tr>
        <td>
          {this.renderTextOrForm()}
        </td>
        <td>
          {source && source[`${property}-de`]}
        </td>
      </tr>
    )
  }

  renderTextOrForm(){
    const { property, length, source, content, type } = this.props
    const { disableUiElements } = this.context

    if (disableUiElements == false && (source && source[`${property}-de`] || content)) {
      return (
        <div>
          <InputSet
            attribute={property} type={type} label={property}
            wrapperClassName='form-group' className='form-control'
            wrapperErrorClassName='has-error' errorClassName='help-block'
          />
          Länge: {length}
        </div>
      )
    }
    else {
      return (
        <div>
          {content}
        </div>
      )
    }
  }
}
{'fraction_non_alphanumeric': 0.1286549707602339, 'fraction_numerical': 0.001670843776106934, 'mean_word_length': 2.0744544287548137, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '16790', 'n_tokens_mistral': 692, 'n_tokens_neox': 686, 'n_words': 162}