<commit_before>{
  namespace,
  utils,
  ui: {progress},
  templates: {tpl},
  jQuery: $,
  crop: {CropWidget},
  locale: {t}
} = uploadcare

namespace 'uploadcare.widget.tabs', (ns) ->

  class ns.GroupView

    # dpm — abbreviation of dialog-preview-multiple
    CLASS_PREFIX = 'uploadcare-dpm-'
    ROLE_PREFIX = '@' + CLASS_PREFIX

    constructor: (@container, @fileColl) ->
      @container.append tpl('tab-preview-multiple')

      @fileListEl = @__find('file-list')
      @filesCountEl = @__find('files-count')
      # @doneBtnEl = @container.find('@uploadcare-dialog-preview-done')
      
      @__addFile(file) for file in @fileColl.get()

      @fileColl.onAdd.add [@__addFile, @__updateContainerView]
      @fileColl.onRemove.add [@__removeFile, @__updateContainerView]

      @fileColl.onAnyProgress.add @__updateFileView

      @fileColl.onAnyFail.add (file, error) ->
        @__fileToEl(file).addClass(CLASS_PREFIX + 'error')

      @fileColl.onAnyDone.add (file, info) ->
        @__fileToEl(file).addClass(CLASS_PREFIX + 'uploaded')

    __find: (s, context = @container) ->
      $(ROLE_PREFIX + s, context)

    __updateContainerView: =>
      @filesCountEl.text t('file', @fileColl.length())
      # @doneBtnEl.toggleClass('uploadcare-disabled-el', @fileColl.length() == 0)

    __updateFileView: (file, progressInfo) =>
      info = progressInfo.incompleteFileInfo
      fileEl = @__fileToEl(file)

      fileEl.toggleClass(CLASS_PREFIX + 'image', info.isImage)
      if info.isImage
        @__find('file-preview', fileEl).attr('src', info.previewUrl)

      @__find('file-name', fileEl)
        .text(info.name or t('dialog.tabs.preview.unknownName'))

      @__find('file-size', fileEl)
        .text(utils.readableFileSize(info.size, '–'))

      @__find('file-progressbar-value', fileEl)
        .css('width', Math.round(progressInfo.progress * 100) + '%')<commit_msg>bugfix in multiple preview<commit_after>{
  namespace,
  utils,
  ui: {progress},
  templates: {tpl},
  jQuery: $,
  crop: {CropWidget},
  locale: {t}
} = uploadcare

namespace 'uploadcare.widget.tabs', (ns) ->

  class ns.GroupView

    # dpm — abbreviation of dialog-preview-multiple
    CLASS_PREFIX = 'uploadcare-dpm-'
    ROLE_PREFIX = '@' + CLASS_PREFIX

    constructor: (@container, @fileColl) ->
      @container.append tpl('tab-preview-multiple')

      @fileListEl = @__find('file-list')
      @filesCountEl = @__find('files-count')
      # @doneBtnEl = @container.find('@uploadcare-dialog-preview-done')
      
      @__addFile(file) for file in @fileColl.get()

      @fileColl.onAdd.add [@__addFile, @__updateContainerView]
      @fileColl.onRemove.add [@__removeFile, @__updateContainerView]

      @fileColl.onAnyProgress.add @__updateFileView

      @fileColl.onAnyFail.add (file, error) =>
        @__fileToEl(file).addClass(CLASS_PREFIX + 'error')

      @fileColl.onAnyDone.add (file, info) =>
        @__fileToEl(file).addClass(CLASS_PREFIX + 'uploaded')

    __find: (s, context = @container) ->
      $(ROLE_PREFIX + s, context)

    __updateContainerView: =>
      @filesCountEl.text t('file', @fileColl.length())
      # @doneBtnEl.toggleClass('uploadcare-disabled-el', @fileColl.length() == 0)

    __updateFileView: (file, progressInfo) =>
      info = progressInfo.incompleteFileInfo
      fileEl = @__fileToEl(file)

      fileEl.toggleClass(CLASS_PREFIX + 'image', info.isImage)
      if info.isImage
        @__find('file-preview', fileEl).attr('src', info.previewUrl)

      @__find('file-name', fileEl)
        .text(info.name or t('dialog.tabs.preview.unknownName'))

      @__find('file-size', fileEl)
        .text(utils.readableFileSize(info.size, '–'))

      @__find('file-progressbar-value', fileEl)
        .css('width', Math.round(progressInfo.progress * 100) + '%')
{'fraction_non_alphanumeric': 0.1540888772022088, 'fraction_numerical': 0.002103602419142782, 'mean_word_length': 3.4027777777777777, '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': '7394218', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1240, 'n_words': 211}