<commit_before>class App.ControllerTable extends App.Controller
  constructor: (params) ->
    for key, value of params
      @[key] = value

    @table = @tableGen(params)
    if @el
      @el.append( @table )

  ###

    new App.ControllerTable(
      header:   ['Host', 'User', 'Adapter', 'Active'],
      overview: ['host', 'user', 'adapter', 'active'],
      model:    App.Channel,
      objects:  data,
      checkbox: false,
      radio:    false,
    )

    new App.ControllerTable(
      overview_extended: [
        { name: 'number',                 link: true },
        { name: 'title',                  link: true },
        { name: 'customer',               class: 'user-data', data: { id: true } },
        { name: 'ticket_state',           translate: true },
        { name: 'ticket_priority',        translate: true },
        { name: 'group' },
        { name: 'owner',                  class: 'user-data', data: { id: true } },
        { name: 'created_at',             callback: @frontendTime },
        { name: 'last_contact',           callback: @frontendTime },
        { name: 'last_contact_agent',     callback: @frontendTime },
        { name: 'last_contact_customer',  callback: @frontendTime },
        { name: 'first_response',         callback: @frontendTime },
        { name: 'close_time',             callback: @frontendTime },
      ],
      model:    App.Ticket,
      objects:  tickets,
      checkbox: false,
      radio:    false,
    )

  ###

  tableGen: (data) ->
    overview   = data.overview || data.model.configure_overview || []
    attributes = data.attributes || data.model.configure_attributes || {}
    header     = data.header

    # check if table is empty
    if _.isEmpty(data.objects)
      table = '<span>-' + App.i18n.translateContent( 'none' ) + '-</span>'
      return $(table)

    # define normal header
    if header
      header_new = []
      for key in header
        header_new.push {
          display: key
        }
      header = header_new
    else if !data.overview_extended
      header = []
      for row in overview
        if attributes
          for attribute in attributes
            if row is attribute.name
              header.push attribute
            else
              rowWithoutId = row + '_id'
              if rowWithoutId is attribute.name
                header.push  attribute

    dataTypesForCols = []
    for row in overview
      dataTypesForCols.push {
        name: row
        link: true
      }

    # extended table format<commit_msg>Improved style of content is available.<commit_after>class App.ControllerTable extends App.Controller
  constructor: (params) ->
    for key, value of params
      @[key] = value

    @table = @tableGen(params)
    if @el
      @el.append( @table )

  ###

    new App.ControllerTable(
      header:   ['Host', 'User', 'Adapter', 'Active'],
      overview: ['host', 'user', 'adapter', 'active'],
      model:    App.Channel,
      objects:  data,
      checkbox: false,
      radio:    false,
    )

    new App.ControllerTable(
      overview_extended: [
        { name: 'number',                 link: true },
        { name: 'title',                  link: true },
        { name: 'customer',               class: 'user-data', data: { id: true } },
        { name: 'ticket_state',           translate: true },
        { name: 'ticket_priority',        translate: true },
        { name: 'group' },
        { name: 'owner',                  class: 'user-data', data: { id: true } },
        { name: 'created_at',             callback: @frontendTime },
        { name: 'last_contact',           callback: @frontendTime },
        { name: 'last_contact_agent',     callback: @frontendTime },
        { name: 'last_contact_customer',  callback: @frontendTime },
        { name: 'first_response',         callback: @frontendTime },
        { name: 'close_time',             callback: @frontendTime },
      ],
      model:    App.Ticket,
      objects:  tickets,
      checkbox: false,
      radio:    false,
    )

  ###

  tableGen: (data) ->
    overview   = data.overview || data.model.configure_overview || []
    attributes = data.attributes || data.model.configure_attributes || {}
    header     = data.header

    # check if table is empty
    if _.isEmpty(data.objects)
      table = '<p>-' + App.i18n.translateContent( 'none' ) + '-</p>'
      return $(table)

    # define normal header
    if header
      header_new = []
      for key in header
        header_new.push {
          display: key
        }
      header = header_new
    else if !data.overview_extended
      header = []
      for row in overview
        if attributes
          for attribute in attributes
            if row is attribute.name
              header.push attribute
            else
              rowWithoutId = row + '_id'
              if rowWithoutId is attribute.name
                header.push  attribute

    dataTypesForCols = []
    for row in overview
      dataTypesForCols.push {
        name: row
        link: true
      }

    # extended table format
{'fraction_non_alphanumeric': 0.11812106918238993, 'fraction_numerical': 0.0007861635220125787, 'mean_word_length': 1.7732970027247956, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '7592740', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1390, 'n_words': 380}