Carga anotaciones de la propuesta
This commit is contained in:
@@ -8,8 +8,12 @@ proposalId = ->
|
||||
|
||||
App.annotations =
|
||||
initialize: ->
|
||||
new annotator.App()
|
||||
.include(annotator.ui.main, {element: $(proposalSelector)[0]})
|
||||
.include(annotator.storage.http, {id: 1, prefix: ""})
|
||||
app = new annotator.App()
|
||||
.include(annotator.ui.main, { element: $(proposalSelector)[0] })
|
||||
.include(annotator.storage.http, { prefix: "", urls: { search: "/annotations/search" } })
|
||||
.include(proposalId)
|
||||
.start();
|
||||
|
||||
app.start()
|
||||
.then( ->
|
||||
app.annotations.load( { proposal_id: $(proposalSelector).data("id") } )
|
||||
)
|
||||
@@ -22,6 +22,12 @@ class AnnotationsController < ApplicationController
|
||||
render json: { status: :ok }
|
||||
end
|
||||
|
||||
def search
|
||||
@annotations = Annotation.where(proposal_id: params[:proposal_id])
|
||||
annotations_hash = { total: @annotations.size, rows: @annotations }
|
||||
render json: annotations_hash.to_json
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def annotation_params
|
||||
|
||||
@@ -61,7 +61,11 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
resources :annotations
|
||||
resources :annotations do
|
||||
collection do
|
||||
get :search
|
||||
end
|
||||
end
|
||||
|
||||
resources :users, only: [:show]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user