7 changed files with 115 additions and 23 deletions
@ -1,17 +0,0 @@
|
||||
# frozen_string_literal: true |
||||
|
||||
class CaseDoctrinesController < ApplicationController |
||||
def index; end |
||||
|
||||
def new; end |
||||
|
||||
def edit; end |
||||
|
||||
def show; end |
||||
|
||||
def create; end |
||||
|
||||
def update; end |
||||
|
||||
def destroy; end |
||||
end |
||||
@ -0,0 +1,54 @@
|
||||
class Doctrine::AnnotationsController < ApplicationController |
||||
load_and_authorize_resource :doctrine, class: "Doctrine" |
||||
load_and_authorize_resource :annotation, class: "Annotation", through: :doctrine |
||||
|
||||
def create |
||||
attrs = resource_params.to_unsafe_h |
||||
document_id = attrs.delete(:document_id) |
||||
|
||||
@annotation = Annotation.new(attrs) |
||||
|
||||
if document_id.present? |
||||
@annotation.document = Cdao::Jurisprudence.find(attrs.delete(:document_id)) |
||||
end |
||||
|
||||
respond_to do |format| |
||||
if @annotation.save |
||||
format.html { redirect_to document_path(@doctrine.document) , notice: "Doctrine Annotation was successfully created." } |
||||
else |
||||
format.html { redirect_to document_path(@doctrine.document) } |
||||
end |
||||
end |
||||
end |
||||
|
||||
def update |
||||
attrs = resource_params.to_unsafe_h |
||||
document_id = attrs.delete(:document_id) |
||||
|
||||
attrs[:document] = Cdao::Jurisprudence.find(document_id) if document_id.present? |
||||
|
||||
respond_to do |format| |
||||
if @annotation.update(attrs) |
||||
format.html { redirect_to document_path(@doctrine.document), notice: "Doctrine Annotation was successfully updated." } |
||||
else |
||||
format.html { redirect_to document_path(@doctrine.document) } |
||||
end |
||||
end |
||||
end |
||||
|
||||
def destroy |
||||
respond_to do |format| |
||||
if @annotation.destroy |
||||
format.html { redirect_to subject_indexes_path, notice: "Doctrine Annotation was successfully destroyed." } |
||||
else |
||||
format.html { redirect_to document_path(@doctrine.document), alert: @annotation.errors.full_messages } |
||||
end |
||||
end |
||||
end |
||||
|
||||
private |
||||
|
||||
def resource_params |
||||
params.permit(:document_id, :annomark_id, :phil_rep, :editor_notes, :rank) |
||||
end |
||||
end |
||||
@ -0,0 +1,40 @@
|
||||
class Jurisprudence::DoctrinesController < ApplicationController |
||||
load_and_authorize_resource :jurisprudence, class: "Cdao::Jurisprudence" |
||||
load_and_authorize_resource :doctrine, class: "Doctrine", through: :jurisprudence |
||||
|
||||
def create |
||||
respond_to do |format| |
||||
if @doctrine.save |
||||
format.html { redirect_to document_path(@jurisprudence), notice: "Doctrine was successfully created." } |
||||
else |
||||
format.html { redirect_to document_path(@jurisprudence) } |
||||
end |
||||
end |
||||
end |
||||
|
||||
def update |
||||
respond_to do |format| |
||||
if @doctrine.update(resource_params) |
||||
format.html { redirect_to document_path(@jurisprudence), notice: "Doctrine was successfully updated." } |
||||
else |
||||
format.html { redirect_to document_path(@jurisprudence) } |
||||
end |
||||
end |
||||
end |
||||
|
||||
def destroy |
||||
respond_to do |format| |
||||
if @doctrine.destroy |
||||
format.html { redirect_to subject_indexes_path, notice: "Doctrine was successfully destroyed." } |
||||
else |
||||
format.html { redirect_to document_path(@jurisprudence), alert: @doctrine.errors.full_messages } |
||||
end |
||||
end |
||||
end |
||||
|
||||
private |
||||
|
||||
def resource_params |
||||
params.permit(:content, subject_ids: []) |
||||
end |
||||
end |
||||
Loading…
Reference in new issue