From a0fc2caaf6ff11ecf3bddb4344d095eeedc09bab Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Sat, 1 Dec 2012 00:21:49 +0800 Subject: [PATCH] refine co-authro page --- .../desktop/co_authors_controller.rb | 21 ++----------------- app/views/desktop/co_authors/index.html.erb | 4 ++++ app/views/desktop/journal_p.html.erb | 2 +- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/app/controllers/desktop/co_authors_controller.rb b/app/controllers/desktop/co_authors_controller.rb index d41e2348..559388a3 100644 --- a/app/controllers/desktop/co_authors_controller.rb +++ b/app/controllers/desktop/co_authors_controller.rb @@ -55,27 +55,10 @@ class Desktop::CoAuthorsController < ApplicationController end end - def delete + def destroy @co_author = CoAuthor.find(params[:id]) @co_author.destroy - #respond_to do |format| - # format.html { redirect_to desktop_co_authors_url, :layout => false } - # 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) + render :json => {success: true, msg: "Paper deleted successfully!"} end end diff --git a/app/views/desktop/co_authors/index.html.erb b/app/views/desktop/co_authors/index.html.erb index 147552d2..ccf78acc 100644 --- a/app/views/desktop/co_authors/index.html.erb +++ b/app/views/desktop/co_authors/index.html.erb @@ -1,3 +1,6 @@ +

list all coauthor

+<%= link_to "New Co-Author", new_desktop_co_author_path %> +<%= link_to "New Type", "#" %> @@ -13,6 +16,7 @@ + <% end %> diff --git a/app/views/desktop/journal_p.html.erb b/app/views/desktop/journal_p.html.erb index f9eec4ef..37a0aed1 100644 --- a/app/views/desktop/journal_p.html.erb +++ b/app/views/desktop/journal_p.html.erb @@ -16,7 +16,7 @@
  • List
  • Add/Edit
  • Journals
  • -
  • Co-Authors
  • +
  • Co-Authors
  • Tags & Keywords
  • Analysis
  • Import
  • Name<%= co_author.co_author %> <%= co_author.email %> <%= co_author.type%><%= link_to 'Edit', edit_desktop_co_author_path(co_author) %> <%= link_to 'Destroy', desktop_co_author_path(co_author), method: :delete, confirm: 'Are you sure?' %>