<commit_before>kd    = require 'kd'
JView = require 'app/jview'


module.exports = class StackRepoItem extends kd.ListItemView

  JView.mixin @prototype

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

    options.cssClass = kd.utils.curry 'repo-item', options.cssClass

    super options, data


  toggleSelectView: ->
    return @selectView.toggleClass 'hidden'  if @selectView

    repoData = @getData()
    delegate = @getDelegate()

    @selectView  = new kd.CustomHTMLView
      cssClass   : 'select-view'

    @selectView.addSubView branchOrTagInput = new kd.SelectBox
      placeholder   : 'Branch or Tag'
      selectOptions : [
        { title: 'Branch', value: 'branch' }
        { title: 'Tag',    value: 'tag' }
      ]

    @selectView.addSubView nameInput = new kd.InputView
      placeholder : 'Branch/Tag Name'
      required    : yes

    @selectView.addSubView locationInput = new kd.InputView
      placeholder : '/file/location.json'
      required    : yes

    @selectView.addSubView addButton = new kd.ButtonView
      title       : 'ADD'
      cssClass    : 'solid green medium'
      type        : 'submit'
      callback    : ->

        name      = nameInput.getValue()
        type      = branchOrTagInput.getValue()
        location  = locationInput.getValue()

        delegate.emit 'RepoSelected', {
          name, type, location, repoData
        }

    @addSubView @selectView


  click: (event) ->

    return  unless event.target.classList.contains 'repo-item'<commit_msg>StackRepoItem: add defaults as `master` and `/koding.json`<commit_after>kd    = require 'kd'
JView = require 'app/jview'


module.exports = class StackRepoItem extends kd.ListItemView

  JView.mixin @prototype

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

    options.cssClass = kd.utils.curry 'repo-item', options.cssClass

    super options, data


  toggleSelectView: ->
    return @selectView.toggleClass 'hidden'  if @selectView

    repoData = @getData()
    delegate = @getDelegate()

    @selectView  = new kd.CustomHTMLView
      cssClass   : 'select-view'

    @selectView.addSubView branchOrTagInput = new kd.SelectBox
      placeholder   : 'Branch or Tag'
      selectOptions : [
        { title: 'Branch', value: 'branch' }
        { title: 'Tag',    value: 'tag' }
      ]

    @selectView.addSubView refInput = new kd.InputView
      placeholder  : 'Branch/Tag Name'
      required     : yes
      defaultValue : 'master'

    @selectView.addSubView locationInput = new kd.InputView
      placeholder  : '/file/location.json'
      required     : yes
      defaultValue : '/koding.json'

    @selectView.addSubView addButton = new kd.ButtonView
      title       : 'ADD'
      cssClass    : 'solid green medium'
      type        : 'submit'
      callback    : ->

        ref       = refInput.getValue()
        type      = branchOrTagInput.getValue()
        location  = locationInput.getValue()

        delegate.emit 'RepoSelected', {
          ref, type, location, repo: repoData
        }

    @addSubView @selectView


  click: (event) ->

    return  unless event.target.classList.contains 'repo-item'
{'fraction_non_alphanumeric': 0.10448717948717949, 'fraction_numerical': 0.0, 'mean_word_length': 2.396082698585419, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4817378', 'n_tokens_mistral': 951, 'n_tokens_neox': 927, 'n_words': 220}