finishing saving edited file online and redo dev.rake modification

This commit is contained in:
Kaito committed 2011-07-28 18:08:16 +08:00
1 parent 9eb80d7424
commit 1839269581
4 files changed
+30 -14

No files matched your search

+4 -5
View File
@@ -1,9 +1,9 @@
function r_editor(tgetUrl,tpostUrl,tfileid,toption){
function r_editor(tgetUrl,tpostUrl,tfilename,toption){
if(!toption){ toption =new Array();}
if(!toption['width']){toption['width']=400;}
if(!toption['height']){toption['height']=300;}
var editor = this;
editor.fileid = tfileid;
editor.filename = tfilename;
editor.getUrl = tgetUrl;
editor.postUrl = tpostUrl;
editor.width = toption['width'];
@@ -23,12 +23,11 @@ function r_editor(tgetUrl,tpostUrl,tfileid,toption){
};
editor.reload = function(){
$.get(editor.getUrl,function(data){
alert("reload!");
html.children("textarea").text(data);
});
};
editor.send = function(){
$.post(editor.postUrl,{fileid:editor.fileid,context:html.text()});
$.post(editor.postUrl,{filename:editor.filename,context:html.children("textarea").val(),authenticity_token:$('meta[name=csrf-token]').attr('content')});
};
editor.destroy = function(){
html.remove();
@@ -36,7 +35,7 @@ function r_editor(tgetUrl,tpostUrl,tfileid,toption){
}
$(".r_edit").live("click",function(){
new_editor = new r_editor($(this).attr("path"),"edit_file",$(this).attr("fileid"));
new_editor = new r_editor($(this).attr("path"),"edit_file",$(this).attr("filename"));
$(this).after(new_editor.init());
});