renames & refactors annotations.js into annotable.js
This commit is contained in:
20
app/assets/javascripts/annotable.js.coffee
Normal file
20
app/assets/javascripts/annotable.js.coffee
Normal file
@@ -0,0 +1,20 @@
|
||||
App.Annotable =
|
||||
initialize: ->
|
||||
$("[data-annotable-type]").each ->
|
||||
$this = $(this)
|
||||
ann_type = $this.data("annotable-type")
|
||||
ann_id = $this.data("annotable-id")
|
||||
ann_user_id = $this.data("annotable-user-id")
|
||||
|
||||
app = new annotator.App()
|
||||
.include(annotator.ui.main, { element: this })
|
||||
.include(annotator.storage.http, { prefix: "", urls: { search: "/annotations/search" } })
|
||||
.include ->
|
||||
beforeannotationCreated: (ann) ->
|
||||
ann[ann_type + "_id"] = ann_id
|
||||
ann.user_id = ann_user_id
|
||||
|
||||
app.start().then ->
|
||||
options = {}
|
||||
options[ann_type + "_id"] = ann_id
|
||||
app.annotations.load(options)
|
||||
Reference in New Issue
Block a user