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: fix for json and some other bugs
This commit is contained in:
commit
773cd2b190
|
@ -2,8 +2,10 @@
|
||||||
//harry
|
//harry
|
||||||
//Inititialize function will initialize desktop
|
//Inititialize function will initialize desktop
|
||||||
|
|
||||||
//callback-method will be called after desktop controlled ajax call;
|
//callback-method will be called after desktop controlled ajax call
|
||||||
//container=true is the area where the view will be loaded
|
//container=true is the area where the view will be loaded
|
||||||
|
//load = true is used to load the list element by default
|
||||||
|
//response-type = "json"|"script"|"xml|html" default is json
|
||||||
|
|
||||||
|
|
||||||
$.extend($.expr[':'], {
|
$.extend($.expr[':'], {
|
||||||
|
@ -88,30 +90,30 @@ var orbitDesktop = function(dom){
|
||||||
o.data_method = $(this).attr("callback-method");
|
o.data_method = $(this).attr("callback-method");
|
||||||
if(o.currenthtml!=target){
|
if(o.currenthtml!=target){
|
||||||
if(o.desktopData[o.currentface] == "undefined")
|
if(o.desktopData[o.currentface] == "undefined")
|
||||||
o.desktopData[o.currentface] = "";
|
o.desktopData[o.currentface] = "";
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
$("#content").hide("drop",o.transitionTime,function(){
|
||||||
o.currenthtml = target;
|
o.currenthtml = target;
|
||||||
o.currentface = target;
|
o.currentface = target;
|
||||||
var cache = false;
|
var cache = false;
|
||||||
if(!o.desktopData[o.currentface]){
|
if(!o.desktopData[o.currentface]){
|
||||||
$(o.contentHolder).empty().load(url,function(){
|
$(o.contentHolder).empty().load(url,function(){
|
||||||
if(typeof o.data_method != "undefined"){
|
if(typeof o.data_method != "undefined"){
|
||||||
if(o.data_method != "")
|
if(o.data_method != "")
|
||||||
window.o[o.data_method](target,url,cache);
|
window.o[o.data_method](target,url,cache);
|
||||||
|
}
|
||||||
|
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
||||||
|
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
|
||||||
|
cache = true;
|
||||||
|
if(typeof o.data_method != "undefined"){
|
||||||
|
if(o.data_method != "")
|
||||||
|
window.o[o.data_method](target,url,cache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
|
|
||||||
});
|
});
|
||||||
}else{
|
|
||||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
|
||||||
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]").trigger("click"));
|
|
||||||
cache = true;
|
|
||||||
if(typeof o.data_method != "undefined"){
|
|
||||||
if(o.data_method != "")
|
|
||||||
window.o[o.data_method](target,url,cache);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
@ -135,13 +137,22 @@ var orbitDesktop = function(dom){
|
||||||
|
|
||||||
$("body").on("submit","form[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 dt = null;
|
||||||
|
dt = $(this).attr("response-type");
|
||||||
|
if(dt == null){
|
||||||
|
dt = "json";
|
||||||
|
}
|
||||||
var options = {
|
var options = {
|
||||||
|
dataType : dt,
|
||||||
success:function(responseText, statusText, xhr, $form){
|
success:function(responseText, statusText, xhr, $form){
|
||||||
if(typeof callback_method != "undefined"){
|
if(typeof callback_method != "undefined"){
|
||||||
if(callback_method != ""){
|
if(callback_method != ""){
|
||||||
window.o[o.data_method][callback_method](responseText,statusText,xhr,$form);
|
window.o[o.data_method][callback_method](responseText,statusText,xhr,$form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
o.notify("Please try again later!","imp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(this).ajaxSubmit(options);
|
$(this).ajaxSubmit(options);
|
||||||
|
|
Reference in New Issue