tmp
This commit is contained in:
parent
d502f561ef
commit
b47be52309
|
@ -1034,7 +1034,16 @@ var orbitDesktop = function(dom){
|
|||
}
|
||||
bindHandlers();
|
||||
}
|
||||
|
||||
this.initializeJournalPapers.coAuthorformCallback = function(ruse){
|
||||
this.initializeJournalPapers.formCallback = function(data){
|
||||
if(data.success){
|
||||
o.notify(data.msg,"success");
|
||||
o.sub_menu_item($("div[content-type=menu] a").eq(0));
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
}
|
||||
}
|
||||
}
|
||||
this.initializeJournalPapers.coauthor = function(){ // to open add pages in journal papers page
|
||||
var bindHandlers = function(){ // to bind handlers for add page
|
||||
o.simple_drop_down();
|
||||
|
|
|
@ -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.'}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= form_for @co_author, url: desktop_co_authors_path do |f| %>
|
||||
<%= form_for @co_author, html: { multipart: true ,:type=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: desktop_co_authors_path do |f| %>
|
||||
<%= render partial: 'desktop/co_authors/form', locals: {:f => f} %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= form_for @writing_journal , url: desktop_journal_pages_path do |f| %>
|
||||
<%= form_for @writing_journal, html: { multipart: true, :type=>"ajax_form", "callback-method"=>"formCallback"} , url: desktop_journal_pages_path do |f| %>
|
||||
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
|
||||
<%end%>
|
||||
|
|
Reference in New Issue