diff --git a/app/controllers/desktop/co_authors_controller.rb b/app/controllers/desktop/co_authors_controller.rb index 1c74314e..ccda3786 100644 --- a/app/controllers/desktop/co_authors_controller.rb +++ b/app/controllers/desktop/co_authors_controller.rb @@ -62,4 +62,18 @@ class Desktop::CoAuthorsController < ApplicationController format.json { head :no_content } end end + + def get_co_authors_json + @co_authors = CoAuthor.where(name_id: current_user.id) + data = Array.new + + @co_authors.each do |co_author| + data << { + author: co_author.co_author, + email: co_author.email, + type: co_author.type + } + end + render json: JSON.pretty_generate(data) + end end diff --git a/app/views/desktop/journal_pages/_form.html.erb b/app/views/desktop/journal_pages/_form.html.erb index 223bea04..b6320c6a 100644 --- a/app/views/desktop/journal_pages/_form.html.erb +++ b/app/views/desktop/journal_pages/_form.html.erb @@ -1,7 +1,8 @@