Sha256: 02bbfdd3f51c937db4bd85a5ba28f78d2ba7070efc26c7e791ce66b665d99f3f

Contents?: true

Size: 963 Bytes

Versions: 6

Compression:

Stored size: 963 Bytes

Contents

namespace "SensuDashboard.Models", (exports) ->

  class exports.Stash extends Backbone.Model

    defaults:
      path: "silence"
      content: {}

    idAttribute: "path"

    isNew: =>
      !_.contains(SensuDashboard.Stashes.models, this)

    create: (attributes, options) =>
      options ||= {}
      options.wait = true
      Backbone.create(attributes, options)

    sync: (method, model, options) =>
      options ||= {}
      if method == "delete"
        options.url = "#{SensuDashboard.Stashes.url}/#{model.get("path")}"
      Backbone.sync(method, model, options)

    remove: (options = {}) =>
      @successCallback = options.success
      @errorCallback = options.error
      @destroy
        wait: true
        success: (model, response, opts) =>
          @successCallback.apply(this, [model, response, opts]) if @successCallback
        error: (model, xhr, opts) =>
          @errorCallback.apply(this, [model, xhr, opts]) if @errorCallback

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sensu-dashboard-0.10.4 lib/sensu-dashboard/assets/javascripts/models/stash.coffee
sensu-dashboard-0.10.3 lib/sensu-dashboard/assets/javascripts/models/stash.coffee
sensu-dashboard-0.10.2 lib/sensu-dashboard/assets/javascripts/models/stash.coffee
sensu-dashboard-0.10.1 lib/sensu-dashboard/assets/javascripts/models/stash.coffee
sensu-dashboard-0.10.0 lib/sensu-dashboard/assets/javascripts/models/stash.coffee
sensu-dashboard-0.9.9 lib/sensu-dashboard/assets/javascripts/models/stash.coffee