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,15 +207,13 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
}
bindHandlers();
}
this.initializeJournalPapers.coAuthorformCallback = function(ruse){
this.initializeJournalPapers.formCallback = function(data){
this.initializeJournalPapers.coAuthorformCallback = 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

View File

@ -133,7 +133,7 @@ var orbitDesktop = function(dom){
}
},'*[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 options = {
success:function(responseText, statusText, xhr, $form){

View File

@ -35,18 +35,18 @@ class Desktop::JournalPagesController < ApplicationController
end
def create
if params[:commit].eql?"Save"
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 }
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
end
end
end
end
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} %>
<%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} %>
<%end%>