<commit_before>kd              = require 'kd'
curryIn         = require 'app/util/curryIn'

InitialView     = require './stacks/initialview'
DefineStackView = require './stacks/definestackview'
OnboardingView  = require './stacks/onboarding/onboardingview'


module.exports = class GroupStackSettings extends kd.View

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

    curryIn options, cssClass: 'stacks stacks-v2'

    super options, data

    @scrollView = new kd.ScrollView
    @addSubView @scrollView

    @createInitialView()


  createOnboardingView: (options = {}) ->

    @initialView.hide()
    @scrollView.addSubView onboardingView = new OnboardingView options

    onboardingView.on 'StackOnboardingCompleted', (template) =>
      onboardingView.destroy()
      @showEditor template

    onboardingView.on 'ScrollTo', (direction = 'top') =>
      @scrollView["scrollTo#{direction.capitalize()}"] 500


  createInitialView: ->

    @initialView = @scrollView.addSubView new InitialView

    @initialView.on 'EditStack', (template) => @showEditor template, yes
    @initialView.on [ 'CreateNewStack', 'NoTemplatesFound' ], @bound 'createOnboardingView'


  showEditor: (stackTemplate, inEditMode) ->
<commit_msg>Admin: Stacks: Fix scroll view bug.<commit_after>kd              = require 'kd'
curryIn         = require 'app/util/curryIn'

InitialView     = require './stacks/initialview'
DefineStackView = require './stacks/definestackview'
OnboardingView  = require './stacks/onboarding/onboardingview'


module.exports = class GroupStackSettings extends kd.View

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

    curryIn options, cssClass: 'stacks stacks-v2'

    super options, data

    @scrollView = new kd.ScrollView
    @addSubView @scrollView

    @createInitialView()


  createOnboardingView: (options = {}) ->

    @initialView.hide()
    @scrollView.addSubView onboardingView = new OnboardingView options

    onboardingView.on 'StackOnboardingCompleted', (template) =>
      onboardingView.destroy()
      @showEditor template

    onboardingView.on 'ScrollTo', (direction = 'top') =>
      duration = 500
      top      = if direction is 'top' then 0 else @scrollView.getScrollHeight()

      @scrollView.scrollTo { top, duration }


  createInitialView: ->

    @initialView = @scrollView.addSubView new InitialView

    @initialView.on 'EditStack', (template) => @showEditor template, yes
    @initialView.on [ 'CreateNewStack', 'NoTemplatesFound' ], @bound 'createOnboardingView'


  showEditor: (stackTemplate, inEditMode) ->

{'fraction_non_alphanumeric': 0.11382434029145333, 'fraction_numerical': 0.0035447026388341868, 'mean_word_length': 3.7388059701492535, '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': '7582223', 'n_tokens_mistral': 800, 'n_tokens_neox': 734, 'n_words': 169}