modified error msgs and cancle button, but those two have bug...

This commit is contained in:
Rueshyna 2012-11-26 15:45:51 +08:00
parent 613bbec1f0
commit 0125010a05
3 changed files with 10 additions and 20 deletions

View File

@ -39,7 +39,8 @@ class Desktop::CoAuthorsController < ApplicationController
if @co_author.save if @co_author.save
render json: {success:true, msg: "Co-author successfully saved!"}.to_json render json: {success:true, msg: "Co-author successfully saved!"}.to_json
else else
render json: {success: false, msg: @co_author.errors.full_messages}.to_json error_msg = @co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end end
end end
@ -49,7 +50,8 @@ class Desktop::CoAuthorsController < ApplicationController
if @co_author.update_attributes(params[:co_author]) if @co_author.update_attributes(params[:co_author])
render json: {success:true, msg: "Co-author successfully update!"}.to_json render json: {success:true, msg: "Co-author successfully update!"}.to_json
else else
render json: {success: false, msg: @co_author.errors.full_messages}.to_json error_msg = @co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end end
end end

View File

@ -23,7 +23,6 @@ class Desktop::JournalPagesController < ApplicationController
@journal_candidate = @journal_candidate =
WritingJournal.where(create_user_id: current_user.id).map{|j|j.journal_title}.uniq WritingJournal.where(create_user_id: current_user.id).map{|j|j.journal_title}.uniq
respond_to do |format| respond_to do |format|
format.html { render :layout => false} format.html { render :layout => false}
end end
@ -47,7 +46,8 @@ class Desktop::JournalPagesController < ApplicationController
if @writing_journal.save if @writing_journal.save
render json: {success: true, msg: "Paper successfully saved!"}.to_json render json: {success: true, msg: "Paper successfully saved!"}.to_json
else else
render json: {success: false, msg: @writing_journal.errors.full_messages}.to_json error_msg = @writing_journal.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end end
end end
@ -58,7 +58,8 @@ class Desktop::JournalPagesController < ApplicationController
if @writing_journal.update_attributes(params[:writing_journal]) if @writing_journal.update_attributes(params[:writing_journal])
render json: {success: true, msg: "Paper successfully saved!"}.to_json render json: {success: true, msg: "Paper successfully saved!"}.to_json
else else
render json: {success: false, msg: @writing_journal.errors.full_messages}.to_json error_msg = @writing_journal.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end end
end end
end end
@ -66,19 +67,6 @@ class Desktop::JournalPagesController < ApplicationController
def check_file_type file def check_file_type file
if not file.nil? if not file.nil?
file_type = MIME::Types.type_for(file).first.to_s.split("/")[1] file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
# case file_type
# when "jpg", "jpeg"
# type = "jpg"
# when "text", "txt"
# type = "txt"
# when "pdf"
# type = "pdf"
# when "png"
# type = "png"
# else "readme"
# end
file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png" file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png"
else else
file_type = "" file_type = ""

View File

@ -1,8 +1,8 @@
<div class="toolbar hh2"> <div class="toolbar hh2">
<div class="fn_g hp"> <div class="fn_g hp">
<%= f.submit "Save", name: "commit", value: "Save", class: "fn_btn hh2 thmc2 thmtxt" %> <%= f.submit "Save", name: "commit", value: "Save", class: "fn_btn hh2 thmc2 thmtxt" %>
<!-- class: bt-cancle can't be remove <!-- class: bt-cancle can't be remove -->
<%= submit_tag "Cancel", class: "bt-cancel fn_btn hh2 thmc2 thmtxt" %> --> <%= submit_tag "Cancel", :type => "button", class: "bt-cancel fn_btn hh2 thmc2 thmtxt" %>
</div> </div>
<div class="hh2 hp sdm"> <div class="hh2 hp sdm">
<div class="sdm_t hh2">Entry Year</div> <div class="sdm_t hh2">Entry Year</div>