       delegate: @
     }
     , data
+
+    @form.on "IntroductionFormNeedsReload", => @reload()
 
   viewAppended: ->
     super

  insertParent: ->
    KD.remote.api.JIntroSnippet.create @createPostData(), =>
      @buttons["Save"].hideLoader()
      log "new created"

  insertChild: ->
    @parentData.addChild @createPostData(), =>
      @buttons["Save"].hideLoader()
      log "child created"

  updateParent: ->
    @parentData.update @createPostData(), =>
      log "parent updated"

  updateChild: ->
    data = @createPostData()
    data.oldIntroId = @parentData.introId
    @parentData.introductionItem.getData().updateChild data, =>
      log "child updated"

    # {
    #   introTitle : postData.IntroTitle
    #   introId    : postData.IntroId
    #   snippet    : postData.Snippet
    #   oldIntroId : @getData().IntroId
    # }
    # @getData().snippet.updateChild @createPostData(), =>
      # introId    = "EDITED"
      # snippet    = "alert"
      # introTitle = "TITLE"
      # @getDelegate().getData().updateChild {
      #   oldIntroId : @getData().introId
      #   introId
      #   introTitle
      #   snippet
      # }, => @setData {
      #     introTitle
      #     introId
      #     snippet
      #   }

  createPostData: ->
    {inputs}     = @

    buttons.Update.show()

  initIntroductionTab: ->
    parentView = @modalTabs.forms["Introduction"]
    parentView.addSubView new IntroductionAdmin { parentView }


class IntroductionAdmin extends JView
