Merge branch 'make_jsFunc_for_journalP' of https://github.com/Rulingcom/orbit into make_jsFunc_for_journalP

* 'make_jsFunc_for_journalP' of https://github.com/Rulingcom/orbit:
  small fix for journal_pages desktop
This commit is contained in:
Rueshyna 2012-11-21 17:12:22 +08:00
commit 24bb56416e
5 changed files with 11 additions and 13 deletions

View File

@ -207,8 +207,7 @@ 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));
@ -216,7 +215,6 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
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
o.simple_drop_down(); o.simple_drop_down();

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,7 +35,7 @@ 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])
@ -46,7 +46,7 @@ class Desktop::JournalPagesController < ApplicationController
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%>