small fix for journal_pages desktop

This commit is contained in:
Harry Bomrah 2012-11-21 17:11:18 +08:00 committed by chris
parent 0b9af044ba
commit c53581c999
5 changed files with 11 additions and 13 deletions

View File

@ -207,15 +207,13 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
} }
bindHandlers(); bindHandlers();
} }
this.initializeJournalPapers.coAuthorformCallback = function(ruse){ this.initializeJournalPapers.coAuthorformCallback = function(data){
this.initializeJournalPapers.formCallback = function(data){
if(data.success){ if(data.success){
o.notify(data.msg,"success"); o.notify(data.msg,"success");
o.sub_menu_item($("div[content-type=menu] a").eq(0)); o.sub_menu_item($("div[content-type=menu] a").eq(0));
}else{ }else{
o.notify(data.msg,"alert"); o.notify(data.msg,"alert");
} }
}
} }
this.initializeJournalPapers.coauthor = function(){ // to open add pages in journal papers page this.initializeJournalPapers.coauthor = function(){ // to open add pages in journal papers page
var bindHandlers = function(){ // to bind handlers for add page var bindHandlers = function(){ // to bind handlers for add page

View File

@ -133,7 +133,7 @@ var orbitDesktop = function(dom){
} }
},'*[content-type=menu] a'); },'*[content-type=menu] a');
$("body").on("submit","form[type=ajax_form]",function(){ $("body").on("submit","form[form-type=ajax_form]",function(){
var callback_method = $(this).attr("callback-method"); var callback_method = $(this).attr("callback-method");
var options = { var options = {
success:function(responseText, statusText, xhr, $form){ success:function(responseText, statusText, xhr, $form){

View File

@ -35,18 +35,18 @@ class Desktop::JournalPagesController < ApplicationController
end end
def create def create
if params[:commit].eql?"Save"
params[:writing_journal][:create_user_id] = current_user.id params[:writing_journal][:create_user_id] = current_user.id
@writing_journal = WritingJournal.new(params[:writing_journal]) @writing_journal = WritingJournal.new(params[:writing_journal])
respond_to do |format| respond_to do |format|
if @writing_journal.save if @writing_journal.save
format.json {render json: {success: true, msg: "Paper successfully saved!"}.to_json} format.json {render json: {success: true, msg: "Paper successfully saved!"}.to_json}
else else
format.json {render json: {success: false, msg: "Saving failed!"}.to_json } format.json {render json: {success: false, msg: "Saving failed!"}.to_json }
end
end end
end
end
end end
def update def update

View File

@ -1,3 +1,3 @@
<%= form_for @writing_journal, url: desktop_journal_page_path(@writing_journal),html: { multipart: true ,:type=>"ajax_form", "callback-method"=>"formCallback"} do |f| %> <%= form_for @writing_journal, url: desktop_journal_page_path(@writing_journal),html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"formCallback"} do |f| %>
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %> <%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
<%end%> <%end%>

View File

@ -1,3 +1,3 @@
<%= form_for @writing_journal, html: { multipart: true, :type=>"ajax_form", "callback-method"=>"formCallback"} , url: desktop_journal_pages_path do |f| %> <%= form_for @writing_journal, html: { multipart: true, "form-type"=>"ajax_form", "callback-method"=>"formCallback"} , url: desktop_journal_pages_path do |f| %>
<%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %> <%= render partial: 'desktop/journal_pages/form', locals: {:f => f} %>
<%end%> <%end%>