From 1c72d59f71575666f29a303ab65107f05e2440d1 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 13 Oct 2015 09:25:52 +0800 Subject: [PATCH] =?UTF-8?q?forum=20tag=E5=8F=8C=E5=87=BB=E5=8F=AF=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=9A=84=E5=87=BD=E6=95=B0=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=BC=96=E8=BE=91=E5=99=A8=E5=9C=A8=E7=81=AB?= =?UTF-8?q?=E7=8B=90=E6=B5=8F=E8=A7=88=E5=99=A8=E6=8F=92=E5=85=A5=E5=9B=BE?= =?UTF-8?q?=E7=89=87bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/_forum_tag_list.html.erb | 2 +- app/views/layouts/base_forums.html.erb | 33 ++++++++++++++++++----- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/app/views/forums/_forum_tag_list.html.erb b/app/views/forums/_forum_tag_list.html.erb index b074cbca3..eebb5adfa 100644 --- a/app/views/forums/_forum_tag_list.html.erb +++ b/app/views/forums/_forum_tag_list.html.erb @@ -1,6 +1,6 @@ <% forum.tag_list.each do |tag|%> - <%= tag %> + <%= tag %> <%if forum.creator.id == User.current.id%> × <% end %> diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index 8677bc705..d32fbf4ed 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -98,13 +98,8 @@ domEle.parent().css("border","1px solid #ffffff"); $("#renameTagName").focus(); } - //监听所有的单击事件 - $(document).click(function(e){ - node = document.elementFromPoint(e.clientX, e.clientY); - if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了 - return; - } - if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态 + $("#renameTagName").live('blur',function(){ + if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态 if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态 ele.parent().css("border",""); ele.parent().html(tagNameHtml); @@ -122,6 +117,30 @@ } } }); + //监听所有的单击事件 +// $(document).click(function(e){ +// node = document.elementFromPoint(e.clientX, e.clientY); +// if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了 +// return; +// } +// if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态 +// if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态 +// ele.parent().css("border",""); +// ele.parent().html(tagNameHtml); +// +// }else{ //否则就要更新tag名称了 +// if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ +// $.post( +// '<%#= update_tag_name_path %>', +// {"taggableId": taggableId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim()} +// ) +// }else{ +// ele.parent().css("border",""); +// ele.parent().html(tagNameHtml); +// } +// } +// } +// }); function del_forum_confirm(){ if(confirm('您确定要删除么?')){