From 43d57074e51277b505fc7d7f7ed781c2a81cb2a8 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 18 Aug 2015 17:26:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/views/users/user_resource.html.erb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c3c5da9cf..2caae19e1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -894,7 +894,7 @@ class UsersController < ApplicationController # format.js # end if @flag - render :text=>'sucess' + render :text=> download_named_attachment_path(@attachment.id, @attachment.filename) else render :text=>'fail' end diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 09bee5ac6..1cad8f2de 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -158,7 +158,7 @@ $(".resourcesList").click(function(e) { //将当前行改变为白色 line.children().css("background-color", 'white'); //当前行恢复编辑状态到链接状态 - if(ele.nodeName != 'INPUT') { + if(ele && ele.nodeName != 'INPUT') { restore(); } line = null; @@ -224,9 +224,10 @@ $(".resourcesList").click(function(e) { '<%=rename_resource_user_path(@user) %>', $("#res_name_form").serialize(), function (data){ - if(data =='sucess'){//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变 + if(data != 'fail'){//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变 last_line.children().first().html(res_link); 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); }else{ last_line.children().first().html(res_link);