-
+
<%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %>
- <%= raw [annotation.document.title, annotation.document.reference_number, annotation.document.docdate.strftime("%B %d, %Y"), annotation.phil_rep].reject(&:blank?).join(', ').html_safe %>
+ <%= raw [annotation.document.title, annotation.document.reference_number, annotation.document.docdate.strftime("%B %d, %Y"), annotation.phil_rep].reject(&:blank?).join(', ').html_safe %>
diff --git a/app/components/document_index_table_body_component/document_index_table_body_component.html.erb b/app/components/document_index_table_body_component/document_index_table_body_component.html.erb
index 97d5d8d..f39b4c6 100644
--- a/app/components/document_index_table_body_component/document_index_table_body_component.html.erb
+++ b/app/components/document_index_table_body_component/document_index_table_body_component.html.erb
@@ -40,7 +40,7 @@
<%= label_tag :editor_notes %>
- <%= params[:editor_notes] %>
+ <%= rich_text_area_tag :editor_notes, params[:editor_notes], placeholder: "Editor Notes" %>
diff --git a/app/controllers/api/doctrine/annotations_controller.rb b/app/controllers/api/doctrine/annotations_controller.rb
new file mode 100644
index 0000000..a6e37df
--- /dev/null
+++ b/app/controllers/api/doctrine/annotations_controller.rb
@@ -0,0 +1,56 @@
+module Api
+ module Doctrine
+ class AnnotationsController < ::Api::BaseController
+ load_and_authorize_resource :doctrine, class: "Doctrine"
+ load_and_authorize_resource :annotation, class: "Annotation", through: :doctrine
+
+ def index
+ respond_with @annotations
+ end
+
+ def show
+ respond_with @annotation
+ end
+
+ def create
+ attrs = resource_params.to_unsafe_h.deep_symbolize_keys
+ subject_ids = attrs.delete(:subject_ids)
+
+ @annotation = @jurisprudence.annotations.new(attrs)
+
+ if @annotation.save
+ @annotation.subject_ids = subject_ids if subject_ids.present?
+
+ respond_with @annotation
+ else
+ render errors: @annotation.errors, status: 422
+ end
+ end
+
+ def update
+ attrs = resource_params.to_unsafe_h.deep_symbolize_keys
+ subject_ids = attrs.delete(:subject_ids)
+
+ if @annotation.update(attrs)
+ @annotation.subject_ids = subject_ids if subject_ids.present?
+
+ respond_with @annotation
+ else
+ render errors: @annotation.errors, status: 422
+ end
+ end
+
+ def destroy
+ @annotation.destroy
+
+ respond_with @annotation
+ end
+
+ private
+
+ def resource_params
+ params.permit(:content, subject_ids: [])
+ end
+ end
+ end
+end