Sha256: cd3ad86fd3262753d6b3594d9971d22d8e81668e988b7767b5bc4c2abcf89f4d

Contents?: true

Size: 727 Bytes

Versions: 3

Compression:

Stored size: 727 Bytes

Contents

#
# This represents the Bookmark model within the angular js framework.
# The user can star/unstar, i.e. create or destroy bookmarks
# for bookmarkable objects.
#

@app.factory "Bookmark", ["$resource", ($resource) ->

  # Model initialization: Bind it to a JSON resource.
  Bookmark = $resource(
    "/bookmarks/:id?bookmarkable_id=:bookmarkable_id&bookmarkable_type=:bookmarkable_type&user_id=:user_id",
    { id: "@id" },
    { update: { method: "PUT" } }
  )

  # Add further instance methods here:

#  Bookmark.prototype.unstar = ->
#    this.$remove
#
#  # Add further class methods here.
#  Bookmark.someClassMethod = (arg) ->
#    console.log arg

  # The factory needs to return the model object.
  return Bookmark
]

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
your_platform-1.0.1 app/assets/javascripts/models-ng/bookmark.js.coffee
your_platform-1.0.0 app/assets/javascripts/models-ng/bookmark.js.coffee
your_platform-0.0.2 app/assets/javascripts/models-ng/bookmark.js.coffee