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

* 'publication' of https://github.com/Rulingcom/orbit:
  coauthor edit and destroy fixed
This commit is contained in:
Rueshyna 2012-12-03 12:34:46 +08:00
commit fe5e5fd974
4 changed files with 52 additions and 4 deletions

View File

@ -263,6 +263,47 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
main: '.tinycanvas',
fill: '.s_grid_con'
})
$("a.bt-edit").click(function(){
$.ajax({
url : $(this).attr("href"),
type : "get",
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);
})
}
})
return false;
})
$("a.bt-delete").click(function(){
var delurl = $(this).attr("href");
var parent = $(this).parent().parent();
o.confirm({
buttons : ["Yes","No"],
highlighted : 2,
message : "Are you sure, you want to delete this author?"
},function(value){
if(value){
$.ajax({
url : delurl,
type : "DELETE",
success : function(data){
if(data.success){
parent.hide("slide",function(){parent.remove();});
o.notify(data.msg,"success");
}
}
})
}
})
return false;
})
}
bindHandlers();
}

View File

@ -660,7 +660,14 @@ var orbitDesktop = function(dom){
};
this.initializeSettings = function(target,url,cache){ //this is to initialize setting page
this.initializeSettings.account = function(){}
this.initializeSettings.account = function(data){}
this.initializeSettings.passwordUpdate = function(data){
if(data.success){
o.notify(data.msg,"success");
}else{
o.notify(data.msg,"alert");
}
}
this.initializeSettings.sections = function(){ // this load section page in setting page
var bindHandlers = function(){ // binding handlers in section page

View File

@ -16,8 +16,8 @@
<td><%= co_author.co_author %></td>
<td><%= co_author.email %></td>
<td><%= co_author.type%></td>
<td><%= link_to 'Edit', edit_desktop_co_author_path(co_author) %></td>
<td><%= link_to 'Destroy', desktop_co_author_path(co_author), method: :delete, confirm: 'Are you sure?' %></td>
<td><%= link_to 'Edit', edit_desktop_co_author_path(co_author), :class => "bt-edit" %></td>
<td><%= link_to 'Destroy', desktop_co_author_path(co_author), method: :delete, confirm: 'Are you sure?', :class=>"bt-delete" %></td>
</tr>
<% end %>
</table>

View File

@ -1,5 +1,5 @@
<%= form_for(resource, :as => resource_name, :url => users_passwd_path(resource_name), :html => { :method => :put, "form-type"=>"ajax_form" }) do |f| %>
<%= form_for(resource, :as => resource_name, :url => users_passwd_path(resource_name), :html => { :method => :put, "form-type"=>"ajax_form" ,"callback-method"=>"passwordUpdate" }) do |f| %>
<div><%= f.submit "Update" %></div>
<div><%= f.label :current_password %>