资源库

This commit is contained in:
lizanle 2015-08-18 17:26:39 +08:00
parent ae6260571b
commit 43d57074e5
2 changed files with 4 additions and 3 deletions

View File

@ -894,7 +894,7 @@ class UsersController < ApplicationController
# format.js # format.js
# end # end
if @flag if @flag
render :text=>'sucess' render :text=> download_named_attachment_path(@attachment.id, @attachment.filename)
else else
render :text=>'fail' render :text=>'fail'
end end

View File

@ -158,7 +158,7 @@ $(".resourcesList").click(function(e) {
//将当前行改变为白色 //将当前行改变为白色
line.children().css("background-color", 'white'); line.children().css("background-color", 'white');
//当前行恢复编辑状态到链接状态 //当前行恢复编辑状态到链接状态
if(ele.nodeName != 'INPUT') { if(ele && ele.nodeName != 'INPUT') {
restore(); restore();
} }
line = null; line = null;
@ -224,9 +224,10 @@ $(".resourcesList").click(function(e) {
'<%=rename_resource_user_path(@user) %>', '<%=rename_resource_user_path(@user) %>',
$("#res_name_form").serialize(), $("#res_name_form").serialize(),
function (data){ function (data){
if(data =='sucess'){//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变 if(data != 'fail'){//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变
last_line.children().first().html(res_link); last_line.children().first().html(res_link);
last_line.children().first().children().attr('title',name); last_line.children().first().children().attr('title',name);
last_line.children().first().children().attr('href',data);
last_line.children().first().children().html(name.length > 17? name.substring(0,17)+'...' : name); last_line.children().first().children().html(name.length > 17? name.substring(0,17)+'...' : name);
}else{ }else{
last_line.children().first().html(res_link); last_line.children().first().html(res_link);