<commit_before>class OpenWithModalItem extends JView

  constructor: (options= {}, data) ->

    options.cssClass = "app"

    super options, data

    {authorNick, name, version, icns} = manifest = @getData()

    resourceRoot = "#{KD.appsUri}/#{authorNick}/#{name}/#{version}/"

    if manifest.devMode
      resourceRoot = "https://#{authorNick}.koding.com/.applications/#{__utils.slugify name}/"

    image  = if name is "Ace" then "icn-ace" else "default.app.thumb"
    thumb  = "#{KD.apiUri}/images/#{image}.png"

    for size in [64, 128, 160, 256, 512]
      if icns and icns[String size]
        thumb = "#{resourceRoot}/#{icns[String size]}"
        break

    @img = new KDCustomHTMLView
      tagName     : "img"
      bind        : "error"
      error       : =>
        @img.$().attr "src", "/images/default.app.thumb.png"
      attributes  :
        src       : thumb

    @setClass "not-supported" unless @getOptions().supported

    @on "click", =>
      delegate = @getDelegate()
      delegate.selectedApp.unsetClass "selected" if delegate.selectedApp
      @setClass "selected"
      delegate.selectedApp = @

  pistachio: ->
    """
      {{> @img}}
      <div class="app-name">#{@getData().name}</div>
    """<commit_msg>make getAppIcon reusable<commit_after>class OpenWithModalItem extends JView

  constructor: (options= {}, data) ->

    options.cssClass = "app"

    super options, data

    @img = KD.utils.getAppIcon @getData()

    @setClass "not-supported" unless @getOptions().supported

    @on "click", =>
      delegate = @getDelegate()
      delegate.selectedApp.unsetClass "selected" if delegate.selectedApp
      @setClass "selected"
      delegate.selectedApp = @

  pistachio: ->
    data = @getData()
    """
      {{> @img }}
      <div class="app-name">#{data.name}</div>
    """
{'fraction_non_alphanumeric': 0.15595826468973092, 'fraction_numerical': 0.007688083470620538, 'mean_word_length': 2.680808080808081, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 16, 'https://': 1, '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': '6963439', 'n_tokens_mistral': 598, 'n_tokens_neox': 572, 'n_words': 124}