This commit is contained in:
Rueshyna committed 2012-11-21 14:52:26 +08:00
1 parent da1b871481
commit 5c0b137c6d
5 files changed
+21 -25

No files matched your search

@@ -36,12 +36,10 @@ class Desktop::CoAuthorsController < ApplicationController
@co_author = CoAuthor.new(params[:co_author])
@co_author.name_id= current_user.id
respond_to do |format|
if @co_author.save
format.html { redirect_to desktop_co_authors_path, :layout => false, notice: 'CoAuthor was successfully created.' }
else
format.html { render action: "new", :layout => false}
end
if @writing_journal.save
render :json => {success:true, msg: "Paper successfully saved!"}.to_json
else
render :json => {success:false, msg: "Saving failed!"}
end
end
@@ -39,20 +39,14 @@ class Desktop::JournalPagesController < ApplicationController
params[:writing_journal][:create_user_id] = current_user.id
@writing_journal = WritingJournal.new(params[:writing_journal])
respond_to do |format|
if @writing_journal.save
# respond_to do |format|
# format.html { redirect_to desktop_journal_pages_url, :layout => false, notice: 'User was successfully created.'}
# # format.json { render json: @writing_journal, status: :created, location: @writing_journal}
# # format.js
# end
render :json => {"success"=>true,"msg"=>"Paper successfully saved!"}.to_json
format.json {render json: {success: true, msg: "Paper successfully saved!"}.to_json}
else
render :json => {"success"=>false,"msg"=>"Saving failed!"}
format.json {render json: {success: false, msg: "Saving failed!"}.to_json }
end
end
render :json => {"success"=>true,"msg"=>"Paper successfully saved!"}.to_json
end
end
end
def update
@@ -60,11 +54,6 @@ class Desktop::JournalPagesController < ApplicationController
@writing_journal= WritingJournal.find(params[:id])
end
if not params[:writing_journal][:publication_date].nil?
params[:writing_journal][:publication_date] = \
Date.new *(params[:writing_journal][:publication_date].split("/").map{|s| s.to_i})
end
respond_to do |format|
if @writing_journal.update_attributes(params[:writing_journal])
format.html { redirect_to desktop_journal_pages_url, :layout => false, notice: 'User was successfully updated.'}