url fixed and edit form fixed for tinyscrollbar

This commit is contained in:
Harry Bomrah 2012-11-28 18:11:49 +08:00
parent 796dcc4dc6
commit 2f67a96532
6 changed files with 88 additions and 44 deletions

View File

@ -57,6 +57,10 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
success : function(data){
var prev_data = $("div[container=true]").html();
$("div[container=true]").html(data);
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
$(".bt-cancel").click(function(){
$("div[container=true]").html(prev_data);
})

View File

@ -65,15 +65,28 @@ var orbitDesktop = function(dom){
o.loadWallpaper(customwallpaper);
o.bindDesktopEvents();
o.loadIconCache();
$(o.contentHolder).empty().load("/desktop/desktop",function(){
o.desktopData["d_desktop"] = "";
o.initializeDesktop("d_desktop","",false);
})
var custom_load = window.location.hash;
if(!custom_load){
$(o.contentHolder).empty().load("/desktop/desktop",function(){
o.desktopData["d_desktop"] = "";
o.initializeDesktop("d_desktop","",false);
})
}else{
o.customPage(custom_load);
}
});
})
}
}
this.customPage = function(customload){
customload = customload.replace("#","");
if(customload.search("-") != -1){
customload = customload.split("-");
o.menu_item($(".docklist a[custom-load="+customload[0]+"]"),true,customload[1]);
}else{
o.menu_item($(".docklist a[custom-load="+customload+"]"),true);
}
}
this.changeTheme = function(theme){ // this function is used for changing theme
o.theme = theme;
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
@ -84,38 +97,10 @@ var orbitDesktop = function(dom){
o.loadIconCache();
})
};
this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc
$(".docklist a").click(function(){
var target = $(this).attr("id");
var url = $(this).attr("href");
o.data_method = $(this).attr("callback-method");
if(o.currenthtml!=target){
if(o.desktopData[o.currentface] == "undefined")
o.desktopData[o.currentface] = "";
o.desktopData[o.currentface] = $(o.contentHolder).html();
$("#content").hide("drop",o.transitionTime,function(){
o.currenthtml = target;
o.currentface = target;
var cache = false;
if(!o.desktopData[o.currentface]){
$(o.contentHolder).empty().load(url,function(){
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]"));
cache = true;
if(typeof o.data_method != "undefined"){
if(o.data_method != "")
window.o[o.data_method](target,url,cache);
}
}
});
}
o.menu_item($(this));
return false;
})
@ -223,6 +208,58 @@ var orbitDesktop = function(dom){
})
};
this.menu_item = function(dom,customload,submenuitem){
if(!customload)customload=false;
var target = dom.attr("id");
var url = dom.attr("href");
o.data_method = dom.attr("callback-method");
if(o.currenthtml!=target){
if(o.desktopData[o.currentface] == "undefined")
o.desktopData[o.currentface] = "";
o.desktopData[o.currentface] = $(o.contentHolder).html();
if(customload){
$(o.contentHolder).html("<div id='content'></div>");
}
$("#content").hide("drop",o.transitionTime,function(){
o.currenthtml = target;
o.currentface = target;
var cache = false;
if(!o.desktopData[o.currentface]){
$(o.contentHolder).empty().load(url,function(){
if(typeof o.data_method != "undefined"){
if(o.data_method != "")
window.o[o.data_method](target,url,cache);
}
if(!customload)
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
else{
if(submenuitem)
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"));
else
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
}
})
}else{
$(o.contentHolder).html(o.desktopData[o.currentface]);
if(!customload)
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
else{
if(submenuitem)
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"));
else
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);
}
}
});
}
}
this.sub_menu_item = function(dom){
if(!dom.hasClass('active')){
var sub_data_method = dom.attr('callback-method');
@ -623,6 +660,8 @@ var orbitDesktop = function(dom){
};
this.initializeSettings = function(target,url,cache){ //this is to initialize setting page
this.initializeSettings.account = function(){}
this.initializeSettings.sections = function(){ // this load section page in setting page
var bindHandlers = function(){ // binding handlers in section page
$('.tinycanvas').each(function(){

View File

@ -5,13 +5,13 @@
<ul class="dock_child hh3 thmc4" style="width: 180px;">
<li class="dock_item"><a callback-method='initializeAppSearch' href="<%= desktop_app_manager_path %>" class="widget_fn wh3 hh3" id="d_app_manager" onclick="return false;"><span class="widget_icon"><img src="" alt="App Manager" id="app_manager_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeSectionsManager' href="<%= desktop_sections_path %>" class="widget_fn wh3 hh3" id="d_sections" onclick="return false;"><span class="widget_icon"><img src="" alt="All Sections" id="sections_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeSettings' href="<%= desktop_settings_path %>" class="widget_fn wh3 hh3" id="d_settings" onclick="return false;"><span class="widget_icon"><img src="" alt="Settings" id="settings_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeSettings' href="<%= desktop_settings_path %>" custom-load="settings" class="widget_fn wh3 hh3" id="d_settings" onclick="return false;"><span class="widget_icon"><img src="" alt="Settings" id="settings_icon" width="30" height="30"/></span></a></li>
</ul>
</li>
<li class="d_cate"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_publication' onclick="return false;"><span class="widget_icon"><img src="" alt="Publication" id="publication_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 180px;">
<li class="dock_item"><a callback-method='initializeJournalPapers' href="<%= desktop_publications_journal_p_path %>" class="widget_fn wh3 hh3" id='d_journal_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Journal Papers" id="journal_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeJournalPapers' href="<%= desktop_publications_journal_p_path %>" class="widget_fn wh3 hh3" id='d_journal_p' custom-load="journal" onclick="return false;"><span class="widget_icon"><img src="" alt="Journal Papers" id="journal_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeSeminar' href="<%= desktop_publications_seminar_p_path %>" class="widget_fn wh3 hh3" id='d_seminar_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Seminar Papers" id="seminar_p_icon" width="30" height="30"/></span></a></li>

View File

@ -14,7 +14,7 @@
<div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'>
<li><a href="<%= desktop_journal_pages_path %>" callback-method="list" load="true" class="hh2 w2 hp thmc1 thmtxt xx" onclick='return false;'>List</a></li>
<li><a href="<%= new_desktop_journal_page_path %>" callback-method="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li>
<li><a href="<%= new_desktop_journal_page_path %>" callback-method="addpaper" custom-load="addpaper" class="admtxt hh2 w2 hp xx" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Journals</a></li>
<li><a href="<%= new_desktop_co_author_path %>" class="admtxt hh2 w2 hp" callback-method="coauthor" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>

View File

@ -10,8 +10,8 @@
<div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Overview</a></li>
<li><a href="<%= edit_user_registration_path %>" callback-method="account" class="admtxt hh2 w2 hp" load="true" onclick='return false;'>Account</a></li>
<li><a href="<%= desktop_sections_path %>" callback-method="sections" class="admtxt hh2 w2 hp" onclick='return false;'>Sections</a></li>
<li><a href="<%= edit_user_registration_path %>" callback-method="account" custom-load="account" class="admtxt hh2 w2 hp" load="true" onclick='return false;'>Account</a></li>
<li><a href="<%= desktop_sections_path %>" callback-method="sections" custom-load="sections" class="admtxt hh2 w2 hp" onclick='return false;'>Sections</a></li>
<li><a href="<%= desktop_themes_path %>" callback-method="themes" class="admtxt hh2 w2 hp" onclick='return false;'>Theme</a></li>
<li><a href="<%= desktop_connections_path %>" callback-method="connection" class="admtxt hh2 w2 hp" onclick='return false;'>Connection</a></li>
</ul>

View File

@ -1,6 +1,6 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, "form-type"=>"ajax_form" }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
@ -18,8 +18,9 @@
<div><%= f.submit "Update" %></div>
<% end %>
<h3>Cancel my account</h3>
<!--<h3>Cancel my account</h3>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<p>Unhappy? <%#= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<%= link_to "Back", :back %>
<%#= link_to "Back", :back %>
-->