     data or= {}
     super options, data
 
-    domain = data?.domain
-
     @on "domainChanged", (domainListItem)->
       @getData().domain = domainListItem.data
       @updateViewContent()

    newAction = @actionButton.getOptions().title.toLowerCase()
    futureAction = if newAction is 'deny' then 'allow' else 'deny'

    KD.remote.api.JDomain.updateBehavior
      domainName : data.domainName
      ruleName   : data.ruleName
      behaviorInfo :
        enabled : "yes"
        action  : newAction
        index   : "0"
    , (err, response)=>
      return console.log err if err?
      @$().find("div.fw-li-view").removeClass(futureAction).addClass(newAction)
      @actionButton.setTitle futureAction


  deleteProxyRule:->
    data = @getData()

    KD.remote.api.JDomain.deleteBehavior
      domainName : data.domainName
      ruleName   : data.ruleName
    , (err, result)=>
      return console.log err if err?
      new KDNotificationView {title:"Action has been deleted from your firewall.", type:"top"}
      @destroy()


  viewAppended:->

    ruleType   = if @ruleInput.getValue().match /[0-9+]/ then "ip" else "country"
    ruleName   = @ruleNameInput.getValue()
    ruleMatch  = @ruleInput.getValue()
    domain     = @getData().domain
    domainName = domain.domain
    delegate   = @getDelegate()

    domain.createProxyRule {ruleInfo:{type:ruleType, match:ruleMatch}}, (err, response)->
      if err
        return new KDNotificationView 
          title : "An error occured while performing your action. Please try again."
          type  : "top"
      delegate.emit "newRuleCreated", 
        domainName:domainName
        ruleName:response.Name
        match:response.Match


  viewAppended:->
