hidden file field, and fixed updated function

This commit is contained in:
Rueshyna committed 2012-11-22 02:37:56 +08:00
1 parent 262df57298
commit bb69a059e8
5 files changed
+45 -35

No files matched your search

@@ -35,32 +35,24 @@ class Desktop::JournalPagesController < ApplicationController
end
def create
params[:writing_journal][:create_user_id] = current_user.id
@writing_journal = WritingJournal.new(params[:writing_journal])
respond_to do |format|
if @writing_journal.save
format.json {render json: {success: true, msg: "Paper successfully saved!"}.to_json}
else
format.json {render json: {success: false, msg: "Saving failed!"}.to_json }
end
if @writing_journal.save
render json: {success: true, msg: "Paper successfully saved!"}.to_json
else
render json: {success: false, msg: "Saving failed!"}.to_json
end
end
def update
if params[:commit].eql?"Save"
@writing_journal= WritingJournal.find(params[:id])
end
params[:writing_journal][:update_user_id] = current_user.id
@writing_journal= WritingJournal.find(params[:id])
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.'}
format.json { head :no_content }
render json: {success: true, msg: "Paper successfully saved!"}.to_json
else
format.html { render action: "edit" }
format.json { render json: @user.errors, status: :unprocessable_entity }
render json: {success: false, msg: "Saving failed!"}.to_json
end
end
end
@@ -117,4 +109,11 @@ class Desktop::JournalPagesController < ApplicationController
render json: JSON.pretty_generate(data)
end
private
def check_for_cancel
if params[:commit] == "Cancel"
end
end
end