Add confirm delete text to ensure no mistakenly deleted.
This commit is contained in:
parent
384b6c1256
commit
cf2d6f29d6
|
@ -132,11 +132,8 @@ class Admin::SitePanelController < OrbitAdminController
|
||||||
@site = SiteConstruct.find(params[:id])
|
@site = SiteConstruct.find(params[:id])
|
||||||
render 'see_detail_for_created_site' and return
|
render 'see_detail_for_created_site' and return
|
||||||
elsif params[:type] == 'change_server_name'
|
elsif params[:type] == 'change_server_name'
|
||||||
SiteConstruct.find(params[:id]).update_attributes(domain_name: params[:site_construct][:domain_name])
|
|
||||||
cmd = "bundle exec rake create_site:change_site_server_name[#{params[:id]},'#{params[:site_construct][:domain_name]}']"
|
cmd = "bundle exec rake create_site:change_site_server_name[#{params[:id]},'#{params[:site_construct][:domain_name]}']"
|
||||||
Thread.new do
|
|
||||||
system(cmd)
|
system(cmd)
|
||||||
end
|
|
||||||
redirect_to :back and return
|
redirect_to :back and return
|
||||||
elsif params[:type] == 'delete_from_list'
|
elsif params[:type] == 'delete_from_list'
|
||||||
SiteConstruct.find(params[:id]).destroy
|
SiteConstruct.find(params[:id]).destroy
|
||||||
|
|
|
@ -144,10 +144,47 @@
|
||||||
var item = this;
|
var item = this;
|
||||||
if(window.confirm("Do you really want to delete this site?")){
|
if(window.confirm("Do you really want to delete this site?")){
|
||||||
if(window.confirm("Do you really want to delete this site?")){
|
if(window.confirm("Do you really want to delete this site?")){
|
||||||
$.post("<%=admin_site_panel_edit_site_path%>",{'id':$(this).attr("data-id"),'type':'delete'}).done(function(){
|
if($("#dialog-confirm").length == 0){
|
||||||
|
$("#main-wrap").before("<div id='dialog-confirm' title='site infos'>"+
|
||||||
|
"<div style='clear:both;'></div><div id='info_texts'>"+"Do you really want to "+$(this).attr('title')+"?</div>"+"<input id=\"confirm_input\"/ placeholder=\"<%= t('client_management.please_input_confirm_delete') %>\" style=\"width: 17em;\">"+"<div id='msg_end' style='height:0px; overflow:hidden'></div>"+
|
||||||
|
"</div>");
|
||||||
|
}else{
|
||||||
|
$("#info_texts").html("Do you really want to "+$(this).attr('title')+".");
|
||||||
|
$('#confirm_input').css('display','block');
|
||||||
|
$('#confirm_input').val('');
|
||||||
|
}
|
||||||
|
$( "#dialog-confirm" ).dialog({
|
||||||
|
resizable: true,
|
||||||
|
minHeight: 200,
|
||||||
|
maxHeight: 400,
|
||||||
|
modal: true,
|
||||||
|
width: '80%',
|
||||||
|
open: function(){
|
||||||
|
$('#confirm_input').blur();
|
||||||
|
},
|
||||||
|
close: function(){
|
||||||
|
$('#confirm_input').css('display','none');
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
"<%= t('client_management.confirm') %>": function(){
|
||||||
|
if($('#confirm_input').val().match(/<%= t('client_management.confirm_delete') %>/gi)){
|
||||||
|
$('#confirm_input').css('display','none');
|
||||||
|
$.post("<%=admin_site_panel_edit_site_path%>",{'id':$(item).attr("data-id"),'type':'delete'}).done(function(data){
|
||||||
show_infos_dialog(item);
|
show_infos_dialog(item);
|
||||||
item.remove();
|
item.remove();
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
alert("<%= t('client_management.please_input_confirm_delete').html_safe %>");
|
||||||
|
$('#confirm_input').focus();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"<%= t('client_management.cancel') %>": function(){
|
||||||
|
$('#confirm_input').css('display','none');
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -59,3 +59,6 @@ en:
|
||||||
sites_list: Site list
|
sites_list: Site list
|
||||||
server_manager: Server Manager
|
server_manager: Server Manager
|
||||||
confirm: Confirm
|
confirm: Confirm
|
||||||
|
cancel: Cancel
|
||||||
|
please_input_confirm_delete: "Please input 'Confirm delete' to here."
|
||||||
|
confirm_delete: Confirm delete
|
|
@ -59,3 +59,6 @@ zh_tw:
|
||||||
sites_list: Site list
|
sites_list: Site list
|
||||||
server_manager: Server Manager
|
server_manager: Server Manager
|
||||||
confirm: Confirm
|
confirm: Confirm
|
||||||
|
cancel: Cancel
|
||||||
|
please_input_confirm_delete: "請輸入'確認刪除'。"
|
||||||
|
confirm_delete: 確認刪除
|
Loading…
Reference in New Issue