fixed journal update method

This commit is contained in:
Rueshyna 2012-11-29 16:48:07 +08:00 committed by chris
parent ee830f148e
commit 7f7b33f310
3 changed files with 8 additions and 10 deletions

View File

@ -54,15 +54,13 @@ class Desktop::JournalPagesController < ApplicationController
def update def update
params[:writing_journal][:update_user_id] = current_user.id params[:writing_journal][:update_user_id] = current_user.id
@writing_journal= WritingJournal.find(params[:id]) @writing_journal= WritingJournal.find(params[:id])
# @writing_journal.update_user_id = current_user.id
if @writing_journal.update_attributes(params[:writing_journal])
render json: {success: true, msg: t('update.success.paper')}.to_json
else
error_msg = @writing_journal.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
if @writing_journal.update_attributes(params[:writing_journal])
render json: {success: true, msg: t('update.success.paper')}.to_json
else
error_msg = @writing_journal.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end end
def check_file_type file def check_file_type file

View File

@ -16,7 +16,7 @@
<li><a href="<%= desktop_journal_pages_path %>" callback-method="list" load="true" class="hh2 w2 hp thmc1 thmtxt xx" onclick='return false;'>List</a></li> <li><a href="<%= desktop_journal_pages_path %>" callback-method="list" load="true" class="hh2 w2 hp thmc1 thmtxt xx" onclick='return false;'>List</a></li>
<li><a href="<%= new_desktop_journal_page_path %>" custom-load="addpaper" callback-method="addpaper" custom-load="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li> <li><a href="<%= new_desktop_journal_page_path %>" custom-load="addpaper" callback-method="addpaper" custom-load="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li>
<li><a href="<%= new_desktop_co_author_path %>" class="admtxt hh2 w2 hp" callback-method="coauthor" onclick='return false;'>Co-Authors</a></li> <li><a href="<%= new_desktop_co_author_path %>" class="admtxt hh2 w2 hp" callback-method="coauthor" custom-load="coauthor" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Import</a></li> <li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Import</a></li>

View File

@ -23,4 +23,4 @@
<p>Unhappy? <%#= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p> <p>Unhappy? <%#= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<%#= link_to "Back", :back %> <%#= link_to "Back", :back %>
--> -->