Browse Source

Add `content` in `annotation`

pull/110/head
alexdbondoc17 4 years ago
parent
commit
099854f3ad
  1. 2
      app/controllers/api/doctrine/annotations_controller.rb
  2. 3
      app/javascript/controllers/annotations_controller.js
  3. 5
      db/migrate/20220307043427_add_content_in_annotation.rb

2
app/controllers/api/doctrine/annotations_controller.rb

@ -81,7 +81,7 @@ module Api
private private
def resource_params def resource_params
params.permit(:document_id, :phil_rep, :editor_notes, :rank, annomark_ids: []) params.permit(:document_id, :content, :phil_rep, :editor_notes, :rank, annomark_ids: [])
end end
def search_params def search_params

3
app/javascript/controllers/annotations_controller.js

@ -19,7 +19,6 @@ export default class extends ApplicationController {
var $this = this, annotation_id = $this.element.dataset["annotationId"], doctrine_id = $this.element.dataset["doctrineId"], var $this = this, annotation_id = $this.element.dataset["annotationId"], doctrine_id = $this.element.dataset["doctrineId"],
document_title = "", document_ref_no = "", document_date_or_year = "", $modal = $("#annotationModal") document_title = "", document_ref_no = "", document_date_or_year = "", $modal = $("#annotationModal")
console.log($this.element.dataset["currentDocumentId"])
$modal.find("#current_document_id").val($this.element.dataset["currentDocumentId"]) $modal.find("#current_document_id").val($this.element.dataset["currentDocumentId"])
if(annotation_id !== null && annotation_id !== undefined && annotation_id !== "") { if(annotation_id !== null && annotation_id !== undefined && annotation_id !== "") {
$modal.find(".modal-title").text("Edit Annotation") $modal.find(".modal-title").text("Edit Annotation")
@ -74,7 +73,7 @@ export default class extends ApplicationController {
current_document_id = $this.current_document_idTarget.value, doctrine_id = $this.doctrine_idTarget.value current_document_id = $this.current_document_idTarget.value, doctrine_id = $this.doctrine_idTarget.value
const params = { annomark_ids: $modal.find("select[name='annomark_ids[]']").val(), document_id: $this.document_idTarget.value, const params = { annomark_ids: $modal.find("select[name='annomark_ids[]']").val(), document_id: $this.document_idTarget.value,
document_ids: $this.document_idsTarget.value || "", phil_rep: $this.phil_repTarget.value || "", document_ids: $this.document_idsTarget.value || "", phil_rep: $this.phil_repTarget.value || "",
editor_notes: $this.editor_notesTarget.value || "" } editor_notes: $this.editor_notesTarget.value || "", content: $modal.find("#document_title").val() }
if (annotation_id !== null && annotation_id !== undefined && annotation_id !== "") { if (annotation_id !== null && annotation_id !== undefined && annotation_id !== "") {
$.ajax({ $.ajax({

5
db/migrate/20220307043427_add_content_in_annotation.rb

@ -0,0 +1,5 @@
class AddContentInAnnotation < ActiveRecord::Migration[6.1]
def change
add_column :annotations, :content, :text, default: "", null: false
end
end
Loading…
Cancel
Save