Basic annotation creation
This commit is contained in:
@@ -2,6 +2,7 @@ class Legislation::AnnotationsController < ApplicationController
|
||||
skip_before_action :verify_authenticity_token
|
||||
|
||||
before_action :authenticate_user!, only: [:create]
|
||||
before_action :convert_ranges_parameters, only: [:create]
|
||||
|
||||
load_and_authorize_resource :process
|
||||
load_and_authorize_resource :draft_version, through: :process
|
||||
@@ -44,6 +45,13 @@ class Legislation::AnnotationsController < ApplicationController
|
||||
@annotation = Legislation::Annotation.find(params[:annotation_id])
|
||||
end
|
||||
|
||||
def new
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def annotation_params
|
||||
@@ -58,4 +66,11 @@ class Legislation::AnnotationsController < ApplicationController
|
||||
"legislation_draft_version_id": @draft_version.id
|
||||
end
|
||||
|
||||
def convert_ranges_parameters
|
||||
if params[:annotation] && params[:annotation][:ranges]
|
||||
params[:annotation][:ranges] = JSON.parse(params[:annotation][:ranges])
|
||||
end
|
||||
rescue JSON::ParserError
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user